Skip to content

Commit

Permalink
Merge pull request #583 from cyclus/ci-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gonuke authored Feb 15, 2024
2 parents 48dc913 + 3404412 commit 986abe8
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 34 deletions.
29 changes: 12 additions & 17 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ on:
jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
fail-fast: false
Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -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'
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/publish_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Publish Stable Cycamore

on:
pull_request:
paths:
- '.github/workflows/publish_release.yml'
release:
types: [released]

Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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 }}
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 986abe8

Please sign in to comment.