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 <rkolucki@antmicro.com>
- Loading branch information
1 parent
2a8937c
commit 57b4d20
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/github-script@v3.1.0 | ||
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