Skip to content

Commit

Permalink
revert to a single job
Browse files Browse the repository at this point in the history
would have to jump through hoops to pass digest output between jobs given we have a testing matrix.
Github is still working on implementing the functionality - actions/runner#2477
  • Loading branch information
bennibbelink committed Jan 28, 2024
1 parent 9253ec2 commit c6ce0b4
Showing 1 changed file with 17 additions and 76 deletions.
93 changes: 17 additions & 76 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
- 'CHANGELOG.rst'

jobs:
cyclus-job:
build-test-cyclus:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -34,7 +34,8 @@ jobs:
]

outputs:
cyclus-${{matrix.ubuntu_versions}}-${{matrix.pkg_mgr}}-digest: ${{ steps.build-cyclus.outputs.digest }}
cycamore-build-failure: ${{ steps.build-cycamore.outcome }} != 'success'
cymetric-build-failure: ${{ steps.build-cymetric.outcome }} != 'success'

steps:
- name: Log in to the Container registry
Expand Down Expand Up @@ -63,118 +64,58 @@ jobs:
pkg_mgr=${{ matrix.pkg_mgr }}
ubuntu_version=${{ matrix.ubuntu_versions }}
cycamore-job:
runs-on: ubuntu-latest
needs: [ cyclus-job ]
if: ${{ github.event_name == 'pull_request' }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
ubuntu_versions : [
20.04,
22.04,
]
pkg_mgr : [
apt,
conda,
]

outputs:
cycamore-build-failure: ${{ steps.build-cycamore.outcome }} != 'success'
cycamore-${{}}-digest: ${{ steps.build-cycamore.outputs.digest }}

steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Checkout Cycamore
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4
with:
repository: bennibbelink/cycamore
ref: ci-test
path: ${{ github.workspace }}/cycamore

- name: Build Cycamore
env:
cyclus-digest: ${{needs.cyclus-job.outputs.digest}}
id: build-cycamore
if: ${{ github.event_name == 'pull_request' }}
continue-on-error: true
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile
file: ${{ github.workspace }}/cycamore/docker/Dockerfile
cache-from: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache
cache-to: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache,mode=max
tags: ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-image-cache
push: true
build-args: |
pkg_mgr=${{ matrix.pkg_mgr }}
ubuntu_version=${{ matrix.ubuntu_versions }}
cyclus_tag=ci-image-cache@${{needs.cyclus-job.outputs.cyclus-${{matrix.ubuntu_versions}}-${{matrix.pkg_mgr}}-digest}}
cymetric-job:
runs-on: ubuntu-latest
needs: [ cyclus-job, cycamore-job ]
if: ${{ github.event_name == 'pull_request' }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
ubuntu_versions : [
20.04,
22.04,
]
pkg_mgr : [
apt,
conda,
]
cyclus_tag=ci-image-cache@${{ steps.build-cyclus.outputs.digest }}
outputs:
cymetric-build-failure: ${{ steps.build-cymetric.outcome }} != 'success'

steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Checkout Cymetric
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4
with:
repository: bennibbelink/cymetric
ref: ci-test
path: ${{ github.workspace }}/cymetric

- name: Build Cymetric
if: ${{ github.event_name == 'pull_request' }}
id: build-cymetric
continue-on-error: true
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile
file: ${{ github.workspace }}/cycamore/docker/Dockerfile
cache-from: type=registry,ref=ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache
cache-to: type=registry,ref=ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache,mode=max
tags: ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-image-cache
push: true
build-args: |
pkg_mgr=${{ matrix.pkg_mgr }}
ubuntu_version=${{ matrix.ubuntu_versions }}
cycamore_tag=ci-image-cache@${{ steps.cycamore-job.outputs.digest }}
cycamore_tag=ci-image-cache@${{ steps.build-cycamore.outputs.digest }}
comment-downstream-statuses:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
needs: [ cyclus-job, cycamore-job, cymetric-job ]
needs: [ build-test-cyclus ]
permissions:
pull-requests: write

Expand All @@ -185,5 +126,5 @@ jobs:
comment_tag: downstream_statuses
message: |
## Downstream Build Statuses using Cyclus ${{ github.ref }}
- Cycamore: ${{needs.cycamore-job.outputs.cycamore-build-failure && '**Failure** :warning:' || '*Success* :white_check_mark:'}}
- Cymetric: ${{needs.cymetric-job.outputs.cymetric-build-failure && '**Failure** :warning:' || '*Success* :white_check_mark:'}}
- Cycamore: ${{needs.build-test-cyclus.outputs.cycamore-build-failure && '**Failure** :warning:' || '*Success* :white_check_mark:'}}
- Cymetric: ${{needs.built-test-cyclus.outputs.cymetric-build-failure && '**Failure** :warning:' || '*Success* :white_check_mark:'}}

0 comments on commit c6ce0b4

Please sign in to comment.