forked from chipsalliance/Cores-VeeR-EL2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish unit test logs to GitHub Pages
Signed-off-by: Rafal Kolucki <[email protected]>
- Loading branch information
1 parent
a82cfc1
commit 452d597
Showing
3 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Deploy PR preview | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["VeeR-EL2 verification"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy PR preview | ||
runs-on: ubuntu-22.04 | ||
concurrency: | ||
group: gh-pages | ||
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | ||
|
||
steps: | ||
- name: Download current deployment | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: gh-pages | ||
path: ./public | ||
|
||
- name: Download artifacts | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
var artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{ github.event.workflow_run.id }}, | ||
}); | ||
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "pr_deployment" | ||
})[0]; | ||
var download = await github.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
console.log("::set-output name=artifact_id::" + matchArtifact.id); | ||
var fs = require('fs'); | ||
fs.writeFileSync('${{github.workspace}}/pr_deployment.zip', Buffer.from(download.data)); | ||
- name: Unpack artifacts | ||
run: | | ||
unzip -o pr_deployment.zip -d ./public/verification/preview | ||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./public |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Remove closed PR preview | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed # this should trigger the CI both for merge and close | ||
|
||
jobs: | ||
remove: | ||
name: Remove PR preview | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: gh-pages | ||
|
||
steps: | ||
- name: Download current deployment | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: gh-pages | ||
path: ./public | ||
|
||
- name: Remove Preview for the PR that was just closed | ||
run: | | ||
rm -rf ./public/verification/preview/${{ github.event.number }} | ||
- name: Redeploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{ github.base_ref == 'main' }} | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./public | ||
commit_message: "Remove the preview of #${{ github.event.number }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,7 @@ jobs: | |
$RV_ROOT/configs/veer.config | ||
pytest verification/test.py -v --timeout=480 --html=test.html --html=$GITHUB_STEP_SUMMARY | ||
- name: Pack artifacts | ||
- name: Upload artifacts | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
|
@@ -111,3 +111,58 @@ jobs: | |
test.html | ||
assets/ | ||
sim_build/ | ||
preview: | ||
name: Preview results on GitHub Actions | ||
runs-on: ubuntu-latest | ||
needs: tests | ||
concurrency: | ||
group: gh-pages | ||
|
||
steps: | ||
- name: Get PR metadata | ||
uses: 8BitJonny/[email protected] | ||
if: github.event_name == 'pull_request' | ||
with: | ||
sha: ${{ github.event.pull_request.head.sha }} | ||
id: PR | ||
|
||
- name: Downloads results artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: results | ||
path: ./results | ||
|
||
- name: Download current release | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: gh-pages | ||
path: ./public | ||
|
||
- name: Prepare results for publishing | ||
run: | | ||
rm -r ./results/sim_build | ||
mv ./results/test.html ./results/index.html | ||
mkdir -p ./public/verification | ||
mv ./results/* ./public/verification | ||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./public | ||
|
||
# prepare metadata and upload artifacts for multi branch deployment | ||
- name: Move deployment to the correct preview directory | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
mkdir ./preview | ||
mv ./public/verification ./preview/${{ steps.PR.outputs.number }} | ||
- name: Upload preview artifacts | ||
uses: actions/upload-artifact@v3 | ||
if: github.event_name == 'pull_request' | ||
with: | ||
name: pr_deployment | ||
path: ./preview/ |