Skip to content

Commit

Permalink
Publish test results after PR run (java-native-access#179)
Browse files Browse the repository at this point in the history
Motivation:

To make it easier to understand why a build failed let us publish the rest results

Modifications:

Use a new workflow to be able to publish the test reports

Result:

Easier to understand why a PR did fail
  • Loading branch information
normanmaurer authored Feb 6, 2021
1 parent 3b28440 commit ed893ba
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci-pr-reports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: PR Reports
on:
workflow_run:
workflows: [ "Build PR" ]
types:
- completed
jobs:
tests-linux-x86_64:
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: dawidd6/action-download-artifact@v2.11.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: ${{ github.event.workflow_run.workflow_id }}
commit: ${{ github.event.workflow_run.head_commit.id }}
# File location set in ci-pr.yml and must be coordinated.
name: test-results-pr-linux-x86_64
- name: Publish Test Report
uses: scacap/action-surefire-report@v1.0.7
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
report_paths: '**/target/surefire-reports/TEST-*.xml'
commit: ${{ github.event.workflow_run.head_commit.id }}
check_name: linux-x86_64 test results

tests-windows-x86_64:
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: dawidd6/action-download-artifact@v2.11.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: ${{ github.event.workflow_run.workflow_id }}
commit: ${{ github.event.workflow_run.head_commit.id }}
# File location set in ci-pr.yml and must be coordinated.
name: test-results-pr-windows-x86_64
- name: Publish Test Report
uses: scacap/action-surefire-report@v1.0.7
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
report_paths: '**/target/surefire-reports/TEST-*.xml'
commit: ${{ github.event.workflow_run.head_commit.id }}
check_name: windows-x86_64 test results
18 changes: 16 additions & 2 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
build-linux-x86_64:
runs-on: ubuntu-latest
name: linux-x86_64
name: linux-x86_64 build
steps:
- uses: actions/checkout@v2

Expand All @@ -34,6 +34,13 @@ jobs:
- name: Checking for detected leak
run: ./.github/scripts/check_leak.sh build-leak.output

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results-pr-linux-x86_64
path: '**/target/surefire-reports/TEST-*.xml'

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
Expand All @@ -42,7 +49,7 @@ jobs:

build-pr-windows:
runs-on: windows-2016
name: windows-x86_64
name: windows-x86_64 build
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -86,6 +93,13 @@ jobs:
- name: Build project
run: mvn --file pom.xml clean package

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results-pr-windows-x86_64
path: '**/target/surefire-reports/TEST-*.xml'

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
Expand Down

0 comments on commit ed893ba

Please sign in to comment.