CI refactoring #1
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: Publish Latest Cycamore | |
on: | |
# allows us to run workflows manually | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- '.github/workflows/build_test_publish.yml' | |
- 'docker/**' | |
push: | |
branches: | |
- main | |
jobs: | |
build-dependency-and-test-img: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
ubuntu_versions : [ | |
20.04, | |
22.04, | |
] | |
pkg_mgr : [ | |
apt, | |
conda, | |
] | |
cyclus_tag : [ | |
latest, | |
] | |
name: Building Cycamore and Running Tests | |
steps: | |
- name: Tag as ci-image-cache | |
run: | | |
echo "tag=ci-image-cache" >> "$GITHUB_ENV" | |
- name: Tag as latest | |
if: ${{ github.repository_owner == 'cyclus' && github.ref == 'refs/heads/main' }} | |
run: | | |
echo "tag=latest" >> "$GITHUB_ENV" | |
- 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: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and Test Cycamore | |
uses: docker/build-push-action@v5 | |
with: | |
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 | |
build-args: | | |
pkg_mgr=${{ matrix.pkg_mgr }} | |
ubuntu_version=${{ matrix.ubuntu_versions }} | |
cyclus_tag=${{ matrix.cyclus_tag }} | |
- name: Push Cycamore Image | |
uses: docker/build-push-action@v5 | |
with: | |
cache-from: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache | |
file: docker/Dockerfile | |
target: cycamore | |
push: true | |
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 }} | |
cyclus_tag=latest |