make each instance the same #34
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 Cyclus | |
on: | |
# allows us to run workflows manually | |
workflow_dispatch: | |
pull_request: | |
paths-ignore: | |
- '.github/workflows/publish_latest.yml' | |
- '.github/workflows/publish_release.yml' | |
- '.github/workflows/changelog_test.yml' | |
- '.github/workflows/code_coverage.yml' | |
- '.github/workflows/rocky_build_test.yml' | |
- 'doc/**' | |
- 'CHANGELOG.rst' | |
push: | |
paths-ignore: | |
- '.github/workflows/publish_latest.yml' | |
- '.github/workflows/publish_release.yml' | |
- '.github/workflows/changelog_test.yml' | |
- '.github/workflows/code_coverage.yml' | |
- '.github/workflows/rocky_build_test.yml' | |
- 'doc/**' | |
- 'CHANGELOG.rst' | |
jobs: | |
build-test-ubuntu: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ubuntu_versions : [ | |
20.04, | |
22.04, | |
] | |
pkg_mgr : [ | |
apt, | |
conda, | |
] | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: network=host | |
- name: Checkout Cyclus | |
uses: actions/checkout@v4 | |
- name: Build and Test Cyclus | |
id: build-cyclus | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/Dockerfile | |
cache-from: type=registry,ref=ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:ci-layer-cache | |
tags: localhost:5000/cyclus:local | |
push: true | |
build-args: | | |
pkg_mgr=${{ matrix.pkg_mgr }} | |
ubuntu_version=${{ matrix.ubuntu_versions }} | |
- name: Checkout Cycamore | |
if: ${{ github.event_name == 'pull_request' && steps.build-cyclus.outcome == 'success' }} | |
uses: actions/checkout@v4 | |
with: | |
repository: cyclus/cycamore | |
path: ${{ github.workspace }}/cycamore | |
- name: Build and Test Cycamore | |
id: build-cycamore | |
if: ${{ github.event_name == 'pull_request' && steps.build-cyclus.outcome == 'success' }} | |
continue-on-error: true | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ github.workspace }}/cycamore | |
file: ${{ github.workspace }}/cycamore/docker/Dockerfile | |
build-contexts: | | |
ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus=docker-image://localhost:5000/cyclus:local | |
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 }} | |
ubuntu_version=${{ matrix.ubuntu_versions }} | |
- name: Checkout Cymetric | |
if: ${{ github.event_name == 'pull_request' && steps.build-cycamore.outcome == 'success' }} | |
uses: actions/checkout@v4 | |
with: | |
repository: cyclus/cymetric | |
path: ${{ github.workspace }}/cymetric | |
- name: Build and Test Cymetric | |
if: ${{ github.event_name == 'pull_request' && steps.build-cycamore.outcome == 'success' }} | |
id: build-cymetric | |
continue-on-error: true | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ github.workspace }}/cymetric | |
file: ${{ github.workspace }}/cymetric/docker/Dockerfile | |
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 }} | |
- name: Export Environment Variables | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "CYCAMORE_BUILD_STATUS=${{steps.build-cycamore.outcome == 'success' && '**Success** :white_check_mark:' || | |
steps.build-cycamore.outcome == 'failure' && '**Failure** :x:' || | |
'**Skipped due to upstream failure** :warning:'}}" >> "$GITHUB_ENV" | |
echo "CYMETRIC_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 }}" >> "$GITHUB_ENV" | |
- name: Construct Artifact | |
if: github.event_name == 'pull_request' | |
run: | | |
echo " | |
##### Build \`FROM cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus\` | |
- Cycamore: ${{ env.CYCAMORE_BUILD_STATUS }} | |
- Cymetric: ${{ env.CYMETRIC_BUILD_STATUS }}" > ${{ env.ARTIFACT_NAME }}.txt | |
- name: Upload Artifact | |
if: github.event_name == 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: ${{ env.ARTIFACT_NAME }}.txt | |
upload-pr-number: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Checkout cyclus | |
uses: actions/checkout@v4 | |
- name: Save PR number and Commit hash to file | |
run: | | |
echo "${{ github.event.number }}" > pr_number | |
echo "${{ github.event.pull_request.head.sha }} - $(git log -1 --format=%ci)" > commit_hash_timestamp | |
- name: Upload PR number artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr_number | |
path: pr_number | |
- name: Upload Commit hash artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: commit_hash_timestamp | |
path: commit_hash_timestamp | |
build-test-rocky: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rocky_versions : [ | |
8, | |
9, | |
] | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Checkout Cyclus | |
uses: actions/checkout@v4 | |
- name: Build and Test Cyclus | |
id: build-cyclus | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/Rocky.dockerfile | |
cache-from: type=registry,ref=ghcr.io/cyclus/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:ci-layer-cache | |
build-args: | | |
rocky_version=${{ matrix.rocky_versions }} |