Refactor CI workflow #103
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Docker Images | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
workflow_dispatch: | |
# https://docs.github.com/en/actions/using-jobs/using-concurrency | |
concurrency: | |
# only cancel in-progress jobs or runs for the current workflow - matches against branch & tags | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
FORCE_COLOR: 1 | |
jobs: | |
build-amd64: | |
uses: ./.github/workflows/build.yml | |
with: | |
runsOn: ubuntu-22.04 | |
platforms: linux/amd64 | |
test-amd64: | |
needs: build-amd64 | |
strategy: | |
fail-fast: false | |
matrix: | |
target: ["base", "lab", "base-with-services", "full-stack"] | |
uses: ./.github/workflows/test.yml | |
with: | |
runsOn: ubuntu-22.04 | |
images: ${{ needs.build-amd64.outputs.images }} | |
target: ${{ matrix.target }} | |
integration: false | |
build: | |
needs: test-amd64 | |
uses: ./.github/workflows/build.yml | |
with: | |
runsOn: ubuntu-22.04 | |
platforms: linux/amd64,linux/arm64 | |
# To save self-hosted runner resources, we're only testing full-stack image | |
test-arm64: | |
needs: build | |
uses: ./.github/workflows/test.yml | |
with: | |
runsOn: buildjet-4vcpu-ubuntu-2204-arm | |
images: ${{ needs.build.outputs.images }} | |
target: full-stack | |
integration: false | |
test-integration: | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
runner: [ubuntu-22.04, buildjet-4vcpu-ubuntu-2204-arm] | |
uses: ./.github/workflows/test.yml | |
with: | |
runsOn: ${{ matrix.runner }} | |
images: ${{ needs.build.outputs.images }} | |
target: full-stack | |
integration: true | |
publish-ghcr: | |
needs: [build, test-amd64, test-arm64] | |
uses: ./.github/workflows/publish.yml | |
with: | |
runsOn: ubuntu-22.04 | |
images: ${{ needs.build.outputs.images }} | |
registry: ghcr.io | |
secrets: inherit | |
publish-dockerhub: | |
if: >- | |
github.repository == 'aiidalab/aiidalab-docker-stack' | |
&& (github.ref_type == 'tag' || github.ref_name == 'main') | |
needs: [build, publish-ghcr] | |
uses: ./.github/workflows/publish.yml | |
with: | |
runsOn: ubuntu-22.04 | |
images: ${{ needs.build.outputs.images }} | |
registry: docker.io | |
secrets: inherit |