Skip to content

develop - Collect JUnit Results #119

develop - Collect JUnit Results

develop - Collect JUnit Results #119

name: "Collect JUnit Results"
# we have multiple workflows - this helps to distinguish for them
run-name: "${{ github.event.pull_request.title && github.event.pull_request.title || github.ref_name }} - Collect JUnit Results"
on:
workflow_run:
workflows: ["Build & Test"] # runs after build and test workflow
types:
- completed
permissions:
contents: read
actions: read
checks: write
#
# see https://github.com/dorny/test-reporter?tab=readme-ov-file#recommended-setup-for-public-repositories
#
jobs:
#
# Collect Junit reports generated by build_and_test
#
collect-junit-reports:
runs-on: ubuntu-latest
steps:
# checkout because dorny/test-reporter needs to read tracked files
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
# Download report separately because the dorny/test-reporter is not compatible with
# actions/[upload/download]-artifact@v4 https://github.com/dorny/test-reporter/issues/363
- name: Download - Unit Reports
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.BOT_ACCESS_TOKEN }}
run-id: ${{ github.event.workflow_run.id }} # download artifacts from build and test workflow
pattern: junit-test-results # uses artifact of build and test workflow
merge-multiple: true
path: ./
- name: Collect - JUnit Reports
uses: dorny/test-reporter@v1
# Dependabot has not enough rights to add the report to the run.
if: ${{ github.actor != 'dependabot[bot]' }}
with:
name: Unit Tests
path: '**/target/surefire-reports/*.xml'
reporter: java-junit
fail-on-error: 'true'
fail-on-empty: 'true'