Skip to content

Publish test results #1364

Publish test results

Publish test results #1364

name: Publish test results
on:
workflow_run:
workflows: ["Build and test"]
types:
- completed
jobs:
publish-test-results:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'
steps:
# https://github.com/LouisBrunner/checks-action/issues/22#issuecomment-885047551
- name: Recognize sha ref
id: sharef
run: |
if [ "$EVENT" == 'workflow_run' ]
then
echo "::set-output name=sha::$(echo ${{github.event.workflow_run.head_sha}})"
fi
env:
EVENT: ${{ github.event_name }}
REF: ${{ github.ref }}
# https://github.com/EnricoMi/publish-unit-test-result-action#support-fork-repositories-and-dependabot-branches
- name: Download and Extract Artifacts
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
mkdir -p artifacts && cd artifacts
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 TypeScript Test Report
uses: EnricoMi/publish-unit-test-result-action@v1.6
with:
check_name: "Tests: TypeScript"
comment_title: TypeScript Test Report
commit: ${{steps.sharef.outputs.sha}}
deduplicate_classes_by_file_name: false
files: artifacts/ts-test-results/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true
- name: Publish Android Unit Test Report
uses: EnricoMi/publish-unit-test-result-action@v1.6
with:
check_name: "Tests: Android - Unit"
comment_title: Android Unit Test Report
commit: ${{steps.sharef.outputs.sha}}
deduplicate_classes_by_file_name: false
files: artifacts/android-unit-test-results/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true
- name: Publish Android Instrumented Test Report
uses: EnricoMi/publish-unit-test-result-action@v1.6
with:
check_name: "Tests: Android - Instrumented"
comment_title: Android Instrumented Test Report
commit: ${{steps.sharef.outputs.sha}}
deduplicate_classes_by_file_name: false
files: artifacts/android-instrumented-test-results/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true
- name: Publish iOS Test Report
uses: EnricoMi/publish-unit-test-result-action@v1.6
with:
check_name: "Tests: iOS"
comment_title: iOS Test Report
commit: ${{steps.sharef.outputs.sha}}
deduplicate_classes_by_file_name: false
files: artifacts/ios-test-results/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true