diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 8ba384af6..8d62f4bcb 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -19,9 +19,6 @@ on: jobs: build-and-test: runs-on: ubuntu-latest - permissions: - contents: read - packages: write strategy: fail-fast: false @@ -39,17 +36,18 @@ jobs: stable, ] + services: + registry: + image: registry:2 + ports: + - 5000:5000 + steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Log in to the Container registry - uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + driver-opts: network=host - name: Checkout Cycamore uses: actions/checkout@v4 @@ -60,9 +58,8 @@ jobs: uses: docker/build-push-action@v5 with: file: docker/Dockerfile - cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache - cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache,mode=max - tags: ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-image-cache + cache-from: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache + tags: localhost:5000/cycamore:local push: true build-args: | pkg_mgr=${{ matrix.pkg_mgr }} @@ -84,14 +81,12 @@ jobs: with: context: ${{ github.workspace }}/cymetric file: ${{ github.workspace }}/cymetric/docker/Dockerfile - cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache - cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache,mode=max + build-contexts: | + ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore=docker-image://localhost:5000/cycamore:local + cache-from: type=registry,ref=ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache build-args: | pkg_mgr=${{ matrix.pkg_mgr }} ubuntu_version=${{ matrix.ubuntu_versions }} - cycamore_tag=ci-image-cache - build-contexts: | - ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-image-cache=docker-image://ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-image-cache@${{ steps.build-cycamore.outputs.digest }} - name: Export Environment Variables if: github.event_name == 'pull_request' diff --git a/.github/workflows/publish_latest.yml b/.github/workflows/publish_latest.yml index 5512371fe..5e6eb44ff 100644 --- a/.github/workflows/publish_latest.yml +++ b/.github/workflows/publish_latest.yml @@ -49,18 +49,18 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.repository_owner }} + username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Test Cycamore id: build-cycamore uses: docker/build-push-action@v5 with: - cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache - cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache,mode=max + 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 file: docker/Dockerfile push: true - tags: ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.tag }} + tags: ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.tag }} build-args: | pkg_mgr=${{ matrix.pkg_mgr }} ubuntu_version=${{ matrix.ubuntu_versions }} @@ -78,9 +78,9 @@ jobs: with: context: ${{ github.workspace }}/cymetric file: ${{ github.workspace }}/cymetric/docker/Dockerfile - cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache - cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache,mode=max - tags: ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:${{ env.tag }} + 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:${{ env.tag }} push: true build-args: | pkg_mgr=${{ matrix.pkg_mgr }} diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 2987e3456..aedb83bc7 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -1,6 +1,9 @@ name: Publish Stable Cycamore on: + pull_request: + paths: + - '.github/workflows/publish_release.yml' release: types: [released] @@ -31,7 +34,7 @@ jobs: echo "stable_tag=ci-image-cache" >> "$GITHUB_ENV" - name: Tag as stable - if: ${{ github.repository_owner == 'cyclus' }} + if: ${{ github.repository_owner == 'cyclus' && github.event_name == 'release' }} run: | echo "version_tag=${{ github.event.release.tag_name }}" >> "$GITHUB_ENV" echo "stable_tag=stable" >> "$GITHUB_ENV" @@ -40,7 +43,7 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.repository_owner }} + username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx @@ -52,13 +55,12 @@ jobs: - name: Build, Test, and Push Cycamore uses: docker/build-push-action@v5 with: - cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache - cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache,mode=max + cache-from: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache file: docker/Dockerfile push: true tags: | - ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.version_tag }} - ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.stable_tag }} + ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.version_tag }} + ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.stable_tag }} build-args: | pkg_mgr=${{ matrix.pkg_mgr }} ubuntu_version=${{ matrix.ubuntu_versions }} diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8f64868cf..ae94b0ce9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,9 +5,9 @@ cycamore Change Log .. current developments **Added:** -* Downstream testing in CI workflows (#573, #580, #582) -* GitHub workflow for publishing images on release (#573, #582) -* GitHub workflows for building/testing on a PR and push to `main` (#549, #564, #573, #582) +* Downstream testing in CI workflows (#573, #580, #582, #583) +* GitHub workflow for publishing images on release (#573, #582, #583) +* GitHub workflows for building/testing on a PR and push to `main` (#549, #564, #573, #582, #583) * Add functionality for random behavior on the size (#550) and frequency (#565) of a sink * GitHub workflow to check that the CHANGELOG has been updated (#562) * Added inventory policies to Storage through the material buy policy (#574) diff --git a/docker/Dockerfile b/docker/Dockerfile index 8682a7c59..fb08841ad 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,6 @@ ARG pkg_mgr=apt ARG ubuntu_version=22.04 -ARG cyclus_tag=stable +ARG cyclus_tag=latest FROM ghcr.io/cyclus/cyclus_${ubuntu_version}_${pkg_mgr}/cyclus:${cyclus_tag} as cycamore ARG make_cores=2