Skip to content

Commit

Permalink
chore: Add generate_version.yml pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
pprzetacznik committed Mar 27, 2024
1 parent b54527e commit 0d0866e
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
name: IElixir Docker

on:
push:
branches: master
pull_request:
branches:
- 'master'
- 'feature/**'
- 'fix/**'
workflow_call:
inputs:
version:
required: true
type: string
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout IElixir project
uses: actions/checkout@v2
- name: Generate version
id: gen_ielixir_version
- name: Set version
run: |
echo "IELIXIR_VERSION=$(cat ./VERSION).$(date '+%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT"
echo ${{ inputs.version }} >> VERSION
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand All @@ -34,7 +36,7 @@ jobs:
with:
push: true
file: ./docker/ielixir-requirements/Dockerfile
tags: pprzetacznik/ielixir-requirements:${{ steps.gen_ielixir_version.outputs.IELIXIR_VERSION }}
tags: pprzetacznik/ielixir-requirements:${{ inputs.version }}
build-args: |
ERL_VERSION=26.2.3
ELIXIR_VERSION=1.14.2
Expand All @@ -44,8 +46,8 @@ jobs:
with:
push: true
file: ./docker/ielixir/Dockerfile
tags: pprzetacznik/ielixir:${{ steps.gen_ielixir_version.outputs.IELIXIR_VERSION }}
tags: pprzetacznik/ielixir:${{ inputs.version }}
build-args: |
IELIXIR_REQUIREMENTS_DOCKER_VERSION=${{ steps.gen_ielixir_version.outputs.IELIXIR_VERSION }}
IELIXIR_REQUIREMENTS_DOCKER_VERSION=${{ inputs.version }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
41 changes: 41 additions & 0 deletions .github/workflows/docs_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: IElixir generate documentation

on:
workflow_call:
inputs:
version:
required: true
type: string
secrets:
GITHUB_TOKEN:
required: true

jobs:
docs:
name: Documentation and coverage reports
runs-on: ubuntu-latest
needs: generate_version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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
44 changes: 22 additions & 22 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,30 @@ name: IElixir CI

on:
push:
branches: [ master ]
branches: master
pull_request:
branches:
- 'master'
- 'feature/**'
- 'fix/**'

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

build_docker:
uses: ./.github/workflows/docker_workflow.yml
needs: generate_version
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]
Expand All @@ -22,6 +35,9 @@ jobs:
steps:
- name: Checkout IElixir project
uses: actions/checkout@v2
- name: Set version
run: |
echo ${{ needs.generate_version.outputs.version }} >> VERSION
- name: Install prerequisites
run: |
sudo apt install -y openssl libncurses5
Expand Down Expand Up @@ -56,25 +72,9 @@ jobs:
MIX_ENV=dev python jupyter_kernel_test/test_ielixir.py
docs:
name: Documentation and coverage reports
runs-on: ubuntu-latest
env:
uses: ./.github/workflows/docs_workflow.yml
needs: generate_version
with:
version: ${{ needs.generate_version.outputs.version }}
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- 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
22 changes: 22 additions & 0 deletions .github/workflows/generate_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Reusable version generation workflow

on:
workflow_call:
outputs:
version:
description: "Generated version"
value: ${{ jobs.generate_version.outputs.version }}

jobs:
generate_version:
name: Generate version job
runs-on: ubuntu-latest
outputs:
version: ${{ steps.gen_ielixir_version.outputs.IELIXIR_VERSION }}
steps:
- name: Checkout IElixir project
uses: actions/checkout@v2
- name: Generate version
id: gen_ielixir_version
run: |
echo "IELIXIR_VERSION=$(cat ./VERSION).$(date '+%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +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
runs-on: ubuntu-latest
Expand Down

0 comments on commit 0d0866e

Please sign in to comment.