Test Results #2292
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: Test Results | |
# This workflow runs after the CI 'Build and Test' workflow has completed, | |
# to collect test results in JUnit format and post a comment on test test status to a PR. | |
# This split setup is required to correctly work on forks and dependabot PRs, as described here: | |
# https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#support-fork-repositories-and-dependabot-branches | |
on: | |
workflow_run: | |
workflows: [ "Build and Test" ] | |
types: | |
- completed | |
env: | |
ARTIFACT_PATH: "artifacts" | |
jobs: | |
unit-test-results: | |
name: Unit Test Results | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: write | |
if: github.event.workflow_run.conclusion != 'skipped' | |
steps: | |
- name: Get Artifacts of Build Action | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: | | |
mkdir -p ${{ env.ARTIFACT_PATH }} && cd ${{ env.ARTIFACT_PATH }} | |
artifacts_url=${{ github.event.workflow_run.artifacts_url }} | |
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact | |
do | |
IFS=$'\t' read name url <<< "$artifact" | |
gh api $url > "$name.zip" | |
unzip -d "$name" "$name.zip" | |
done | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b #v2.18.0 | |
with: | |
check_name: "Unit Test Results" | |
commit: ${{ github.event.workflow_run.head_sha }} | |
event_file: ${{ env.ARTIFACT_PATH }}/event_file/event.json | |
event_name: ${{ github.event.workflow_run.event }} | |
files: ${{ env.ARTIFACT_PATH }}/**/*.xml |