Skip to content

Commit

Permalink
chore: Move ielixir build to separate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pprzetacznik committed Mar 28, 2024
1 parent d907008 commit 9c48a05
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 116 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/build_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: IElixir build and test

on:
workflow_call:
inputs:
version:
required: true
type: string
build_version:
required: true
type: string
is_release:
required: true
type: string

jobs:
build:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-22.04']
elixir-version: ['1.14']
otp-version: ['26']
python-version: ['3.8', '3.12']
steps:
- name: Checkout IElixir project
uses: actions/checkout@v2
- name: Set version
if: inputs.is_release == 'true'
run: |
echo ${{ inputs.version }} > VERSION
- name: Set build version
if: inputs.is_release == 'false'
run: |
echo ${{ inputs.build_version }} > VERSION
- name: Install prerequisites
run: |
sudo apt install -y openssl libncurses5
sudo apt install -y libzmq3-dev libsqlite3-dev libssl-dev
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: 'OTP-${{ matrix.otp-version }}'
elixir-version: 'v${{ matrix.elixir-version }}-otp-${{ matrix.otp-version }}'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install python packages
run: |
pip install pip --upgrade
pip install -r jupyter_kernel_test/requirements.txt
- name: Restore dependencies cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Compile IElixir and install
run: |
mix deps.get
mix deps.compile
MIX_ENV=dev ./install_script.sh
- name: Run tests
run: |
mix test
MIX_ENV=dev python jupyter_kernel_test/test_ielixir.py
6 changes: 2 additions & 4 deletions .github/workflows/docker_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ on:
required: true

jobs:
main:
build_docker:
name: Building docker images
runs-on: ubuntu-latest
steps:
- name: Checkout IElixir project
uses: actions/checkout@v2
- name: Set version
run: |
echo ${{ inputs.version }} >> VERSION
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand Down
62 changes: 41 additions & 21 deletions .github/workflows/docs_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,55 @@ on:
version:
required: true
type: string
build_version:
required: true
type: string
is_release:
required: true
type: string
secrets:
GH_TOKEN:
required: true
HEX_API_KEY:
required: true

jobs:
docs:
name: Documentation and coverage reports
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
steps:
- name: Checkout IElixir project
uses: actions/checkout@v2
- name: Set version
run: |
echo ${{ inputs.version }} > VERSION
- name: Install prerequisites
run: |
sudo apt install -y openssl libncurses5
sudo apt install -y libzmq3-dev libsqlite3-dev libssl-dev
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: 'OTP-26.0'
elixir-version: 'v1.14-otp-26'
- name: Generate documentation
run: |
MIX_ENV=docs mix deps.get
MIX_ENV=docs mix compile
MIX_ENV=docs mix docs
MIX_ENV=docs mix inch.report
MIX_ENV=test mix coveralls.github
- name: Checkout IElixir project
uses: actions/checkout@v2
- name: Set version
if: inputs.is_release == 'true'
run: |
echo ${{ inputs.version }} > VERSION
- name: Set build version
if: inputs.is_release == 'false'
run: |
echo ${{ inputs.build_version }} > VERSION
- name: Install prerequisites
run: |
sudo apt install -y openssl libncurses5
sudo apt install -y libzmq3-dev libsqlite3-dev libssl-dev
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: 'OTP-26.0'
elixir-version: 'v1.14-otp-26'
- name: Generate documentation
run: |
MIX_ENV=docs mix deps.get
MIX_ENV=docs mix compile
MIX_ENV=docs mix docs
MIX_ENV=docs mix inch.report
MIX_ENV=test mix coveralls.github
- name: Publish documentation
if: inputs.is_release == 'true'
run: |
mix hex.config api_key $HEX_API_KEY
mix hex.publish package --yes
MIX_ENV=docs mix hex.publish docs
62 changes: 12 additions & 50 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,68 +13,30 @@ jobs:
generate_version:
uses: ./.github/workflows/generate_version.yml

build_ielixir:
uses: ./.github/workflows/build_workflow.yml
needs: generate_version
with:
version: ${{ needs.generate_version.outputs.version }}
build_version: ${{ needs.generate_version.outputs.build_version }}
is_release: ${{ needs.generate_version.outputs.is_release }}

build_docker:
uses: ./.github/workflows/docker_workflow.yml
needs: generate_version
needs: [generate_version, build_ielixir]
with:
version: ${{ needs.generate_version.outputs.version }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

build:
name: Build and test
runs-on: ${{ matrix.os }}
needs: generate_version
strategy:
matrix:
os: [ubuntu-22.04]
elixir-version: ['1.14']
otp-version: ['26']
python-version: ['3.8', '3.12']
steps:
- name: Checkout IElixir project
uses: actions/checkout@v2
- name: Set version
run: |
echo ${{ needs.generate_version.outputs.build_version }} > VERSION
- name: Install prerequisites
run: |
sudo apt install -y openssl libncurses5
sudo apt install -y libzmq3-dev libsqlite3-dev libssl-dev
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: 'OTP-${{ matrix.otp-version }}'
elixir-version: 'v${{ matrix.elixir-version }}-otp-${{ matrix.otp-version }}'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install python packages
run: |
pip install pip --upgrade
pip install -r jupyter_kernel_test/requirements.txt
- name: Restore dependencies cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Compile IElixir and install
run: |
mix deps.get
mix deps.compile
MIX_ENV=dev ./install_script.sh
- name: Run tests
run: |
mix test
MIX_ENV=dev python jupyter_kernel_test/test_ielixir.py
docs:
uses: ./.github/workflows/docs_workflow.yml
needs: generate_version
with:
version: ${{ needs.generate_version.outputs.version }}
build_version: ${{ needs.generate_version.outputs.build_version }}
is_release: ${{ needs.generate_version.outputs.is_release }}
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
4 changes: 0 additions & 4 deletions .github/workflows/generate_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,4 @@ jobs:
run: |
echo "${{ github.ref }}"
echo "IELIXIR_IS_RELEASE=${{ startsWith(github.ref, 'refs/tags/') }}" >> $GITHUB_OUTPUT
- name: Print flags
run: |
cat $GITHUB_OUTPUT
echo $GITHUB_OUTPUT
38 changes: 1 addition & 37 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,14 @@ on:
push:
tags:
- 'v*'
pull_request:
branches:
- 'feature/**'

jobs:
generate_version:
uses: ./.github/workflows/generate_version.yml

release:
name: Documentation and coverage reports
name: Create a release
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
steps:
- name: Checkout IElixir project
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set version
run: |
echo ${{ needs.generate_version.outputs.version }} > VERSION
python -c 'import sys; a, b, c = sys.stdin.read().strip().split("."); print(f"{a}.{b}.{int(c)+1}")' < VERSION > VERSION
- name: Install prerequisites
run: |
sudo apt install -y openssl libncurses5
sudo apt install -y libzmq3-dev libsqlite3-dev libssl-dev
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: 'OTP-${{ matrix.otp-version }}'
elixir-version: 'v${{ matrix.elixir-version }}-otp-${{ matrix.otp-version }}'
- name: Generate documentation
run: |
MIX_ENV=docs mix deps.get
MIX_ENV=docs mix compile
MIX_ENV=docs mix docs
MIX_ENV=docs mix inch.report
MIX_ENV=test mix coveralls.github
mix hex.config api_key $HEX_API_KEY
mix hex.publish package --yes
MIX_ENV=docs mix hex.publish docs
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down

0 comments on commit 9c48a05

Please sign in to comment.