Skip to content

Commit

Permalink
workflows: add test reporting
Browse files Browse the repository at this point in the history
This patch adds test reporting action to all workflows that executed
testing. Reporiting is using existing action from marketplace:
https://github.com/EnricoMi/publish-unit-test-result-action
The action uses JUNIT formatted XML files as a base for the test
results. PRs that trigger testing will also receive a comment with test
result summary.

Signed-off-by: Milosz Wasilewski <[email protected]>
  • Loading branch information
mwasilew authored and ricardosalveti committed Jan 23, 2025
1 parent 79dad80 commit e81fbe6
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ on:
pull_request:

jobs:
event-file:
name: "Upload event file"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
build-pr:
uses: ./.github/workflows/build-yocto.yml

30 changes: 30 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,33 @@ jobs:
with:
url: ${{ needs.retrieve-build-url.outputs.url }}

publish-test-results:
name: "Publish Tests Results"
needs: test
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Download event file
uses: actions/download-artifact@v4
with:
run-id: ${{ github.event.workflow_run.id }}
path: artifacts
github-token: ${{ github.token }}

- name: "List files"
run: |
echo $GITHUB_WORKSPACE
ls -R $GITHUB_WORKSPACE
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "${{ github.workspace }}/artifacts/**/*.xml"

24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,27 @@ jobs:
wait_for_job: true
fail_action_on_failure: true
save_result_as_artifact: true

publish-test-results:
name: "Publish Tests Results"
needs: submit-job
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write

steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: "List files"
run: |
echo $GITHUB_WORKSPACE
ls -R $GITHUB_WORKSPACE
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "${{ github.workspace }}/artifacts/**/*.xml"

0 comments on commit e81fbe6

Please sign in to comment.