From c33257760535b9fe3093dc5188998919e4952439 Mon Sep 17 00:00:00 2001 From: Avi Vajpeyi Date: Wed, 22 Apr 2026 13:27:24 -0400 Subject: [PATCH 1/7] fix command due to updates in @dvcorg/cml --- .github/workflows/comment-evolution-plot.yml | 24 +++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/comment-evolution-plot.yml b/.github/workflows/comment-evolution-plot.yml index ed7208168..f4ce9f09c 100644 --- a/.github/workflows/comment-evolution-plot.yml +++ b/.github/workflows/comment-evolution-plot.yml @@ -73,13 +73,16 @@ jobs: HEAD_SHA: ${{ github.event.workflow_run.head_sha }} RUN_ID: ${{ github.event.workflow_run.id }} run: | - echo "## ✅ COMPAS Build Successful!" >> report.md - echo "" >> report.md - echo "| Item | Value |" >> report.md - echo "|------|-------|" >> report.md - echo "| **Commit** | [\`$(echo "$HEAD_SHA" | cut -c1-7)\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${HEAD_SHA}) |" >> report.md - echo "| **Logs** | [View workflow](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${RUN_ID}) |" >> report.md - echo "" >> report.md + # Create the markdown file + cat < report.md + ## ✅ COMPAS Build Successful! + + | Item | Value | + |------|-------| + | **Commit** | [\`$(echo "$HEAD_SHA" | cut -c1-7)\`]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$HEAD_SHA) | + | **Logs** | [View workflow]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$RUN_ID) | + + EOF if [ -f "evolution-plot/${ARTIFACT_NAME}" ]; then echo "### Detailed Evolution Plot" >> report.md @@ -91,8 +94,7 @@ jobs: echo "### ⚠️ Evolution plot not found" >> report.md fi - echo "" >> report.md - echo "---" >> report.md - echo "Generated by COMPAS CI " >> report.md + echo -e "\n---\nGenerated by COMPAS CI " >> report.md - npx -y @dvcorg/cml comment create --pr "$PR_NUMBER" report.md + # Use the corrected CML command + npx -y @dvcorg/cml comment create --target=pr/"$PR_NUMBER" report.md From 41dfc453b182249763e05c75685bbaeefed203bb Mon Sep 17 00:00:00 2001 From: Avi Vajpeyi Date: Wed, 22 Apr 2026 13:29:55 -0400 Subject: [PATCH 2/7] fix node version, check for the saved evolution plot before trying to comment --- .github/workflows/comment-evolution-plot.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/comment-evolution-plot.yml b/.github/workflows/comment-evolution-plot.yml index f4ce9f09c..fb03ea8eb 100644 --- a/.github/workflows/comment-evolution-plot.yml +++ b/.github/workflows/comment-evolution-plot.yml @@ -60,11 +60,21 @@ jobs: Buffer.from(download.data) ); + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + - name: Unpack evolution plot artifact run: | + set -e mkdir -p evolution-plot unzip -o evolution-plot.zip -d evolution-plot - test -f "evolution-plot/${ARTIFACT_NAME}" + if [ ! -f "evolution-plot/${ARTIFACT_NAME}" ]; then + echo "Error: Expected artifact not found at evolution-plot/${ARTIFACT_NAME}" + exit 1 + fi + echo "✓ Artifact unpacked successfully" - name: Create report with evolution plot env: @@ -73,6 +83,9 @@ jobs: HEAD_SHA: ${{ github.event.workflow_run.head_sha }} RUN_ID: ${{ github.event.workflow_run.id }} run: | + set -e + trap 'rm -f evolution-plot.zip report.md' EXIT + # Create the markdown file cat < report.md ## ✅ COMPAS Build Successful! From 85af2afd84e957984dcb6fe0a8d13908cc4328bb Mon Sep 17 00:00:00 2001 From: Avi Vajpeyi Date: Wed, 22 Apr 2026 13:56:55 -0400 Subject: [PATCH 3/7] simligy setup --- .github/workflows/comment-evolution-plot.yml | 113 ------------------- .github/workflows/compas-compile-ci.yml | 23 ++++ 2 files changed, 23 insertions(+), 113 deletions(-) delete mode 100644 .github/workflows/comment-evolution-plot.yml diff --git a/.github/workflows/comment-evolution-plot.yml b/.github/workflows/comment-evolution-plot.yml deleted file mode 100644 index fb03ea8eb..000000000 --- a/.github/workflows/comment-evolution-plot.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: Comment PR with Evolution Plot - -on: - workflow_run: - workflows: - - COMPAS compile test - types: - - completed - -permissions: - actions: read - contents: read - issues: write - pull-requests: write - -jobs: - comment-with-plot: - name: Post evolution plot comment - runs-on: ubuntu-22.04 - if: > - github.event.workflow_run.conclusion == 'success' && - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.pull_requests[0].number - - env: - ARTIFACT_NAME: detailedEvolutionPlot.png - - steps: - - name: Download evolution plot artifact from triggering run - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - const path = require('path'); - const runId = context.payload.workflow_run.id; - const runNumber = context.payload.workflow_run.run_number; - const artifactName = `evolution-plot-${runNumber}`; - const { owner, repo } = context.repo; - - const artifacts = await github.paginate( - github.rest.actions.listWorkflowRunArtifacts, - { owner, repo, run_id: runId, per_page: 100 } - ); - const artifact = artifacts.find((entry) => entry.name === artifactName); - - if (!artifact) { - core.setFailed(`Artifact '${artifactName}' not found for workflow run ${runId}`); - return; - } - - const download = await github.rest.actions.downloadArtifact({ - owner, - repo, - artifact_id: artifact.id, - archive_format: 'zip', - }); - - fs.writeFileSync( - path.join(process.env.GITHUB_WORKSPACE, 'evolution-plot.zip'), - Buffer.from(download.data) - ); - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - - - name: Unpack evolution plot artifact - run: | - set -e - mkdir -p evolution-plot - unzip -o evolution-plot.zip -d evolution-plot - if [ ! -f "evolution-plot/${ARTIFACT_NAME}" ]; then - echo "Error: Expected artifact not found at evolution-plot/${ARTIFACT_NAME}" - exit 1 - fi - echo "✓ Artifact unpacked successfully" - - - name: Create report with evolution plot - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} - HEAD_SHA: ${{ github.event.workflow_run.head_sha }} - RUN_ID: ${{ github.event.workflow_run.id }} - run: | - set -e - trap 'rm -f evolution-plot.zip report.md' EXIT - - # Create the markdown file - cat < report.md - ## ✅ COMPAS Build Successful! - - | Item | Value | - |------|-------| - | **Commit** | [\`$(echo "$HEAD_SHA" | cut -c1-7)\`]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$HEAD_SHA) | - | **Logs** | [View workflow]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$RUN_ID) | - - EOF - - if [ -f "evolution-plot/${ARTIFACT_NAME}" ]; then - echo "### Detailed Evolution Plot" >> report.md - echo "
Click to view evolution plot" >> report.md - echo "" >> report.md - echo "![](./evolution-plot/${ARTIFACT_NAME})" >> report.md - echo "
" >> report.md - else - echo "### ⚠️ Evolution plot not found" >> report.md - fi - - echo -e "\n---\nGenerated by COMPAS CI " >> report.md - - # Use the corrected CML command - npx -y @dvcorg/cml comment create --target=pr/"$PR_NUMBER" report.md diff --git a/.github/workflows/compas-compile-ci.yml b/.github/workflows/compas-compile-ci.yml index e11255923..ec547002a 100644 --- a/.github/workflows/compas-compile-ci.yml +++ b/.github/workflows/compas-compile-ci.yml @@ -109,3 +109,26 @@ jobs: echo "- Python Dependencies: Success" >> $GITHUB_STEP_SUMMARY echo "- Example COMPAS Job: Success" >> $GITHUB_STEP_SUMMARY echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY + + - name: Setup CML for PR comment + uses: iterative/setup-cml@v2 + + - name: Post PR comment with evolution plot + if: github.event_name == 'pull_request' + env: + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cat < report.md + ## ✅ COMPAS Build Successful! + + ### Detailed Evolution Plot +
Click to view evolution plot + + ![](${ARTIFACT_PATH}/${ARTIFACT_NAME}) +
+ + --- + Generated by COMPAS CI + EOF + + cml comment update --target=pr/${{ github.event.pull_request.number }} report.md \ No newline at end of file From c272217764987eb48bb3aa316e741aded1e66d81 Mon Sep 17 00:00:00 2001 From: Avi Vajpeyi Date: Wed, 22 Apr 2026 14:11:15 -0400 Subject: [PATCH 4/7] add installs --- .github/workflows/compas-compile-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/compas-compile-ci.yml b/.github/workflows/compas-compile-ci.yml index ec547002a..9f96a71c7 100644 --- a/.github/workflows/compas-compile-ci.yml +++ b/.github/workflows/compas-compile-ci.yml @@ -30,14 +30,15 @@ jobs: name: Build COMPAS runs-on: ubuntu-22.04 - container: teamcompas/compas:latest - # TODO: Switch to GHCR when package is made public - # container: ghcr.io/teamcompas/compas:latest steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Install build dependencies + run: | + bash misc/cicd-scripts/linux-dependencies native-build + - name: Build COMPAS from source run: | echo "Building COMPAS from source..." From b12545527e6f5ccb461805d77379f34813a5c69e Mon Sep 17 00:00:00 2001 From: Avi Vajpeyi Date: Wed, 22 Apr 2026 14:29:12 -0400 Subject: [PATCH 5/7] update command --- .github/workflows/comment-evolution-plot.yml | 97 ++++++++++++++++++++ .github/workflows/compas-compile-ci.yml | 25 +---- 2 files changed, 98 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/comment-evolution-plot.yml diff --git a/.github/workflows/comment-evolution-plot.yml b/.github/workflows/comment-evolution-plot.yml new file mode 100644 index 000000000..1f996ee9c --- /dev/null +++ b/.github/workflows/comment-evolution-plot.yml @@ -0,0 +1,97 @@ +name: Comment PR with Evolution Plot + +on: + workflow_run: + workflows: + - COMPAS compile test + types: + - completed + +permissions: + actions: read + contents: read + issues: write + pull-requests: write + +jobs: + comment-with-plot: + name: Post evolution plot comment + runs-on: ubuntu-22.04 + if: > + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.pull_requests[0].number + + env: + ARTIFACT_NAME: detailedEvolutionPlot.png + + steps: + - name: Download evolution plot artifact from triggering run + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const path = require('path'); + const runId = context.payload.workflow_run.id; + const runNumber = context.payload.workflow_run.run_number; + const artifactName = `evolution-plot-${runNumber}`; + const { owner, repo } = context.repo; + + const artifacts = await github.paginate( + github.rest.actions.listWorkflowRunArtifacts, + { owner, repo, run_id: runId, per_page: 100 } + ); + const artifact = artifacts.find((entry) => entry.name === artifactName); + + if (!artifact) { + core.setFailed(`Artifact '${artifactName}' not found for workflow run ${runId}`); + return; + } + + const download = await github.rest.actions.downloadArtifact({ + owner, + repo, + artifact_id: artifact.id, + archive_format: 'zip', + }); + + fs.writeFileSync( + path.join(process.env.GITHUB_WORKSPACE, 'evolution-plot.zip'), + Buffer.from(download.data) + ); + + - name: Unpack evolution plot artifact + run: | + set -e + mkdir -p evolution-plot + unzip -o evolution-plot.zip -d evolution-plot + test -f "evolution-plot/${ARTIFACT_NAME}" + + - name: Post PR comment + env: + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} + HEAD_SHA: ${{ github.event.workflow_run.head_sha }} + RUN_ID: ${{ github.event.workflow_run.id }} + run: | + set -e + + cat < report.md + ## ✅ COMPAS Build Successful! + + | Item | Value | + |------|-------| + | **Commit** | [\`$(echo "$HEAD_SHA" | cut -c1-7)\`]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$HEAD_SHA) | + | **Logs** | [View workflow]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$RUN_ID) | + + ### Detailed Evolution Plot +
Click to view evolution plot + + ![](./evolution-plot/${ARTIFACT_NAME}) +
+ + --- + Generated by COMPAS CI + EOF + + npx -y @dvcorg/cml@0.20.6 comment create --target=pr/"$PR_NUMBER" report.md diff --git a/.github/workflows/compas-compile-ci.yml b/.github/workflows/compas-compile-ci.yml index 9f96a71c7..918b315b4 100644 --- a/.github/workflows/compas-compile-ci.yml +++ b/.github/workflows/compas-compile-ci.yml @@ -109,27 +109,4 @@ jobs: echo "- COMPAS Build: Success" >> $GITHUB_STEP_SUMMARY echo "- Python Dependencies: Success" >> $GITHUB_STEP_SUMMARY echo "- Example COMPAS Job: Success" >> $GITHUB_STEP_SUMMARY - echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY - - - name: Setup CML for PR comment - uses: iterative/setup-cml@v2 - - - name: Post PR comment with evolution plot - if: github.event_name == 'pull_request' - env: - REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - cat < report.md - ## ✅ COMPAS Build Successful! - - ### Detailed Evolution Plot -
Click to view evolution plot - - ![](${ARTIFACT_PATH}/${ARTIFACT_NAME}) -
- - --- - Generated by COMPAS CI - EOF - - cml comment update --target=pr/${{ github.event.pull_request.number }} report.md \ No newline at end of file + echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY \ No newline at end of file From 958edff28d956cbf1b3e40e8e1ba1eb4e74f6427 Mon Sep 17 00:00:00 2001 From: Avi Vajpeyi Date: Wed, 22 Apr 2026 14:38:21 -0400 Subject: [PATCH 6/7] Revert "add installs" This reverts commit c272217764987eb48bb3aa316e741aded1e66d81. --- .github/workflows/compas-compile-ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/compas-compile-ci.yml b/.github/workflows/compas-compile-ci.yml index 918b315b4..d2944b9ea 100644 --- a/.github/workflows/compas-compile-ci.yml +++ b/.github/workflows/compas-compile-ci.yml @@ -30,15 +30,14 @@ jobs: name: Build COMPAS runs-on: ubuntu-22.04 + container: teamcompas/compas:latest + # TODO: Switch to GHCR when package is made public + # container: ghcr.io/teamcompas/compas:latest steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Install build dependencies - run: | - bash misc/cicd-scripts/linux-dependencies native-build - - name: Build COMPAS from source run: | echo "Building COMPAS from source..." From f9cb0942497afc4fa895b020da9a5607afda3598 Mon Sep 17 00:00:00 2001 From: Avi Vajpeyi Date: Wed, 22 Apr 2026 14:52:02 -0400 Subject: [PATCH 7/7] Fix missing newline at end of compas-compile-ci.yml --- .github/workflows/compas-compile-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compas-compile-ci.yml b/.github/workflows/compas-compile-ci.yml index d2944b9ea..e11255923 100644 --- a/.github/workflows/compas-compile-ci.yml +++ b/.github/workflows/compas-compile-ci.yml @@ -108,4 +108,4 @@ jobs: echo "- COMPAS Build: Success" >> $GITHUB_STEP_SUMMARY echo "- Python Dependencies: Success" >> $GITHUB_STEP_SUMMARY echo "- Example COMPAS Job: Success" >> $GITHUB_STEP_SUMMARY - echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY \ No newline at end of file + echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY