Push images and caches to github.repository_owner
#61
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: Build/Test for PR and collaborator push | |
on: | |
# allows us to run workflows manually | |
workflow_dispatch: | |
pull_request: | |
paths-ignore: | |
- '.github/workflows/publish_latest.yml' | |
- '.github/workflows/publish_release.yml' | |
- 'doc/**' | |
- 'CHANGELOG.rst' | |
push: | |
paths-ignore: | |
- '.github/workflows/publish_latest.yml' | |
- '.github/workflows/publish_release.yml' | |
- 'doc/**' | |
- 'CHANGELOG.rst' | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
ubuntu_versions : [ | |
20.04, | |
22.04, | |
] | |
pkg_mgr : [ | |
apt, | |
conda, | |
] | |
cycamore_tag: [ | |
latest, | |
stable, | |
] | |
steps: | |
- name: Checkout Cymetric | |
uses: actions/checkout@v4 | |
- 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: Build and Test Cymetric | |
id: build-cymetric | |
continue-on-error: true | |
uses: docker/build-push-action@v5 | |
with: | |
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 | |
file: docker/Dockerfile | |
build-args: | | |
pkg_mgr=${{ matrix.pkg_mgr }} | |
ubuntu_version=${{ matrix.ubuntu_versions }} | |
cycamore_tag=${{ matrix.cycamore_tag }} | |
- name: Export Environment Variables | |
run: | | |
echo "BUILD_STATUS=${{steps.build-cymetric.outcome == 'success' && '*Success* :white_check_mark:' || | |
steps.build-cymetric.outcome == 'failure' && '**Failure** :x:' || | |
'**Skipped due to upstream failure** :warning:'}}" >> "$GITHUB_ENV" | |
echo "ARTIFACT_NAME=${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}_${{ matrix.cycamore_tag }}" >> "$GITHUB_ENV" | |
- name: Construct Artifact | |
run: | | |
echo "Build against \`cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ matrix.cycamore_tag }}\` - ${{ env.BUILD_STATUS }}" | |
> ${{ env.ARTIFACT_NAME }}.txt | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: ${{ env.ARTIFACT_NAME }}.txt | |