CI Results #629
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
name: CI Results | |
on: | |
workflow_run: | |
workflows: ["CI"] | |
types: | |
- completed | |
jobs: | |
publish: | |
name: "Process CI Results" | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
checks: write | |
pull-requests: write | |
if: always() | |
steps: | |
- name: Download Artifacts | |
uses: actions/[email protected] | |
with: | |
script: | | |
var fs = require('fs'); | |
var path = require('path'); | |
var artifacts_path = path.join('${{github.workspace}}', 'artifacts') | |
fs.mkdirSync(artifacts_path, { recursive: true }) | |
var artifacts = await github.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: ${{ github.event.workflow_run.id }}, | |
}); | |
for (const artifact of artifacts.data.artifacts) { | |
var download = await github.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: artifact.id, | |
archive_format: 'zip', | |
}); | |
var artifact_path = path.join(artifacts_path, `${artifact.name}.zip`) | |
fs.writeFileSync(artifact_path, Buffer.from(download.data)); | |
console.log(`Downloaded ${artifact_path}`); | |
} | |
- name: Extract Artifacts | |
run: | | |
for file in artifacts/*.zip | |
do | |
if [ -f "$file" ] | |
then | |
dir="${file/%.zip/}" | |
mkdir -p "$dir" | |
unzip -d "$dir" "$file" | |
fi | |
done | |
- name: Show Artifacts | |
run: find artifacts -ls | |
- name: Publish Results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
with: | |
check_name: View Test Results | |
commit: ${{ github.event.workflow_run.head_sha }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
files: "artifacts/test_results/junit.xml" | |
# Disabled pending the outcome of https://github.com/yuzutech/annotations-action/issues/23 | |
# - name: Publish Docstring Annotations | |
# uses: yuzutech/[email protected] | |
# with: | |
# repo-token: "${{ secrets.GITHUB_TOKEN }}" | |
# title: "Docstrings linter" | |
# input: "annotations.json/annotations.json" | |