Skip to content

Commit

Permalink
Using dedicted workflow step to make sure vallang PRs don't fail on t…
Browse files Browse the repository at this point in the history
…est results reports
  • Loading branch information
DavyLandman authored Sep 13, 2023
1 parent 4b3a800 commit a61914b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 17 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ env:


jobs:
event_file:
name: "Event File (for test results)"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}

test:
strategy:
matrix:
Expand All @@ -35,24 +45,8 @@ jobs:
if: always()
uses: actions/upload-artifact@v3
with:
name: Unit Test Results
name: Unit Test Results (${{ matrix.python-version }})
path: target/surefire-reports/**/*.xml

publish-test-results:
name: "Publish Unit Tests Results"
needs: test
runs-on: ubuntu-latest
if: success() || failure()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts

- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
with:
junit_files: artifacts/**/*.xml

checker-framework:
runs-on: ubuntu-latest
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/publish-test-results.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Test Results
# this separate workflow makes sure we can report test results, even for external PRs

on:
workflow_run:
workflows: ["Build and Deploy"]
types:
- completed
permissions: {}

jobs:
test-results:
name: Test Results
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'

permissions:
checks: write
pull-requests: write
actions: read

steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@v2
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts

- 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: "artifacts/**/*.xml"

0 comments on commit a61914b

Please sign in to comment.