Skip to content

Commit a62c637

Browse files
committed
fix image paths
1 parent f9a51e5 commit a62c637

File tree

2 files changed

+47
-328
lines changed

2 files changed

+47
-328
lines changed

.github/workflows/compas-compile-ci.yml

Lines changed: 47 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -95,86 +95,59 @@ jobs:
9595
id: upload
9696
uses: actions/upload-artifact@v4
9797
with:
98-
name: ${{ env.ARTIFACT_NAME }}
98+
name: evolution-plot-${{ github.run_number }}
9999
path: ${{ env.ARTIFACT_PATH }}/${{ env.ARTIFACT_NAME }}
100100
if-no-files-found: error
101101

102-
- name: Comment on PR with results
103-
if: github.event_name == 'pull_request'
104-
uses: actions/github-script@v7
105-
with:
106-
github-token: ${{ secrets.GITHUB_TOKEN }}
107-
script: |
108-
const fs = require('fs');
109-
const evolutionPlotPath = '${{ env.ARTIFACT_PATH }}/${{ env.ARTIFACT_NAME }}';
110-
const shortSha = context.sha.substring(0, 7);
111-
const workflowUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
112-
113-
let plotSection = '';
114-
115-
try {
116-
if (fs.existsSync(evolutionPlotPath)) {
117-
const tag = `pr-${context.issue.number}-${Date.now()}`;
118-
const plotData = fs.readFileSync(evolutionPlotPath);
119-
120-
const release = await github.rest.repos.createRelease({
121-
owner: context.repo.owner,
122-
repo: context.repo.repo,
123-
tag_name: tag,
124-
name: `Evolution Plot for PR #${context.issue.number}`,
125-
body: `Temporary release to host evolution plot for PR #${context.issue.number}`,
126-
draft: false,
127-
prerelease: true
128-
});
129-
130-
const asset = await github.rest.repos.uploadReleaseAsset({
131-
owner: context.repo.owner,
132-
repo: context.repo.repo,
133-
release_id: release.data.id,
134-
name: 'detailedEvolutionPlot.png',
135-
data: plotData,
136-
headers: {
137-
'content-type': 'image/png'
138-
}
139-
});
140-
141-
const imageUrl = asset.data.browser_download_url;
142-
143-
plotSection = `
144-
### Detailed Evolution Plot
145-
<details><summary>Click to view evolution plot</summary>
146-
147-
![Evolution Plot](${imageUrl})
148-
</details>`;
149-
} else {
150-
plotSection = '\n### ⚠️ Evolution plot not found';
151-
}
152-
} catch (error) {
153-
plotSection = `\n### ⚠️ Evolution plot error: ${error.message}`;
154-
}
155-
156-
await github.rest.issues.createComment({
157-
issue_number: context.issue.number,
158-
owner: context.repo.owner,
159-
repo: context.repo.repo,
160-
body: `![badge](https://img.shields.io/badge/Build_Success-28a745?style=for-the-badge&logo=github-actions&logoColor=white)
161-
162-
## ✅ COMPAS Build Successful!
163-
164-
| Item | Value |
165-
|------|-------|
166-
| **Commit** | [\`${shortSha}\`](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/commit/${context.sha}) |
167-
| **Logs** | [View workflow](${workflowUrl}) |
168-
${plotSection}
169-
170-
---
171-
<sub>Generated by COMPAS CI</sub>`
172-
});
173-
174102
- name: Test Summary
175103
run: |
176104
echo "### COMPAS CI Results" >> $GITHUB_STEP_SUMMARY
177105
echo "- COMPAS Build: Success" >> $GITHUB_STEP_SUMMARY
178106
echo "- Python Dependencies: Success" >> $GITHUB_STEP_SUMMARY
179107
echo "- Example COMPAS Job: Success" >> $GITHUB_STEP_SUMMARY
180-
echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY
108+
echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY
109+
110+
comment-with-plot:
111+
name: Comment PR with Evolution Plot
112+
runs-on: ubuntu-22.04
113+
container: docker://ghcr.io/iterative/cml:0-dvc2-base1
114+
needs: compas
115+
if: github.event_name == 'pull_request'
116+
117+
env:
118+
ARTIFACT_NAME: detailedEvolutionPlot.png
119+
120+
steps:
121+
- name: Download evolution plot
122+
uses: actions/download-artifact@v4
123+
with:
124+
name: evolution-plot-${{ github.run_number }}
125+
126+
- name: Create report with evolution plot
127+
env:
128+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129+
run: |
130+
echo "## ✅ COMPAS Build Successful!" >> report.md
131+
echo "" >> report.md
132+
echo "| Item | Value |" >> report.md
133+
echo "|------|-------|" >> report.md
134+
echo "| **Commit** | [\`${GITHUB_SHA:0:7}\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}) |" >> report.md
135+
echo "| **Logs** | [View workflow](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) |" >> report.md
136+
echo "" >> report.md
137+
138+
if [ -f "${{ env.ARTIFACT_NAME }}" ]; then
139+
echo "### 📊 Detailed Evolution Plot" >> report.md
140+
echo "<details><summary>Click to view evolution plot</summary>" >> report.md
141+
echo "" >> report.md
142+
echo "![](./${{ env.ARTIFACT_NAME }})" >> report.md
143+
echo "</details>" >> report.md
144+
else
145+
echo "### ⚠️ Evolution plot not found" >> report.md
146+
fi
147+
148+
echo "" >> report.md
149+
echo "---" >> report.md
150+
echo "<sub>Generated by COMPAS CI with CML</sub>" >> report.md
151+
152+
# Post the report using CML
153+
cml comment create report.md

.github/workflows/pr_artifact_url_commenter.yml

Lines changed: 0 additions & 254 deletions
This file was deleted.

0 commit comments

Comments
 (0)