diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml
index 9e602e3..c212bfb 100644
--- a/.github/workflows/build_test.yml
+++ b/.github/workflows/build_test.yml
@@ -22,7 +22,6 @@ jobs:
permissions:
contents: read
packages: write
- pull-requests: write
strategy:
fail-fast: false
@@ -59,21 +58,45 @@ jobs:
continue-on-error: true
uses: docker/build-push-action@v5
with:
- 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
+ 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: PR Comment
- if: ${{ github.event_name == 'pull_request' }}
- uses: thollander/actions-comment-pull-request@v2
+ - name: Export Environment Variables
+ if: github.event_name == 'pull_request'
+ 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
+ if: github.event_name == 'pull_request'
+ run: |
+ echo "Build \`FROM cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ matrix.cycamore_tag }}\` - ${{ env.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: Save PR number to file
+ run: |
+ echo "${{ github.event.number }}" > pr_number
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v4
with:
- comment_tag: ${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}_${{ matrix.cycamore_tag }}
- message: |
- ## Build statuses using cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}:${{ matrix.cycamore_tag }}
- - Cymetric: ${{steps.build-cymetric.outcome == 'success' && '*Success* :white_check_mark:' ||
- steps.build-cymetric.outcome == 'failure' && '**Failure** :x:' ||
- '**Skipped due to upstream failure** :warning:'}}
+ name: pr_number
+ path: pr_number
\ No newline at end of file
diff --git a/.github/workflows/pr_comment.yml b/.github/workflows/pr_comment.yml
new file mode 100644
index 0000000..0afad59
--- /dev/null
+++ b/.github/workflows/pr_comment.yml
@@ -0,0 +1,33 @@
+name: Comment on PR
+
+on:
+ workflow_run:
+ workflows: ["Build/Test for PR and collaborator push"]
+ types:
+ - completed
+
+jobs:
+ pr-comment:
+ runs-on: ubuntu-latest
+ if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
+ steps:
+ - name: Download artifacts
+ uses: actions/download-artifact@v4
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ run-id: ${{ github.event.workflow_run.id }}
+ merge-multiple: true
+
+ - name: Merge artifacts and get PR number
+ run: |
+ echo "### Build Status Report" > artifacts_merged.md
+ cat ./*.txt >> artifacts_merged.md
+ echo "PR_NUMBER=$(cat pr_number)" >> "$GITHUB_ENV"
+
+ - name: PR Comment
+ uses: thollander/actions-comment-pull-request@v2
+ with:
+ pr_number: ${{ env.PR_NUMBER }}
+ comment_tag: build_status_report
+ filePath: artifacts_merged.md
+
diff --git a/.github/workflows/publish_latest.yml b/.github/workflows/publish_latest.yml
index 69ca057..5ca76b1 100644
--- a/.github/workflows/publish_latest.yml
+++ b/.github/workflows/publish_latest.yml
@@ -13,7 +13,10 @@ on:
jobs:
build-cymetric-and-push:
runs-on: ubuntu-latest
-
+ permissions:
+ contents: read
+ packages: write
+
strategy:
matrix:
ubuntu_versions : [
@@ -52,11 +55,11 @@ jobs:
- name: Build and Test Cymetric
uses: docker/build-push-action@v5
with:
- 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
+ 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
push: true
- tags: ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:${{ env.tag }}
+ tags: ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:${{ env.tag }}
build-args: |
pkg_mgr=${{ matrix.pkg_mgr }}
ubuntu_version=${{ matrix.ubuntu_versions }}
diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml
index 471187b..7353f0e 100644
--- a/.github/workflows/publish_release.yml
+++ b/.github/workflows/publish_release.yml
@@ -52,13 +52,13 @@ jobs:
- name: Build and Test Cymetric
uses: docker/build-push-action@v5
with:
- 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
+ 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
push: true
tags: |
- ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:${{ env.version_tag }}
- ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:${{ env.stable_tag }}
+ ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:${{ env.version_tag }}
+ ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:${{ env.stable_tag }}
build-args: |
pkg_mgr=${{ matrix.pkg_mgr }}
ubuntu_version=${{ matrix.ubuntu_versions }}
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index dcbe676..67b8e2e 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -4,7 +4,7 @@ cymetric Change Log
.. current developments
**Added:**
-* GitHub workflows for CI (#188, #190, #191)
+* GitHub workflows for CI (#188, #190, #191, #193)
**Changed**
* Converted test suite from nose to pytest (#188)
diff --git a/README.rst b/README.rst
index b75dcf9..f60b02d 100644
--- a/README.rst
+++ b/README.rst
@@ -11,7 +11,7 @@ Dependencies
First, please check to make sure you have all of the dependencies.
Required dependencies:
-
+
* Cyclus and its dependencies
* `Jinja2 `_
* `pandas `_