Merge pull request #98 from notpeelz/fix-report-test-results
Fix workflow not reporting test results when ran from a PR
This commit is contained in:
27
.github/workflows/report-test-results.yml
vendored
Normal file
27
.github/workflows/report-test-results.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
|
||||
name: Report test results
|
||||
|
||||
# HACK: the "on-push-pr" workflow gets run with read-only perms.
|
||||
# This workflow will run in our repo with write permissions after
|
||||
# the PR checks are done running.
|
||||
on:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- On push to master branch
|
||||
- On push to a secondary branch
|
||||
- On push to a PR
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
report-test-results:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Report test results
|
||||
uses: dorny/test-reporter@v1
|
||||
with:
|
||||
name: Test results
|
||||
artifact: test-results
|
||||
path: test-results.trx
|
||||
fail-on-error: false
|
||||
reporter: dotnet-trx
|
||||
14
.github/workflows/run-tests.yml
vendored
14
.github/workflows/run-tests.yml
vendored
@@ -33,7 +33,10 @@ jobs:
|
||||
|
||||
- name: Run tests
|
||||
continue-on-error: true
|
||||
run: dotnet test LinuxSolution.sln -clp:"ErrorsOnly;Summary" --logger "trx;LogFileName=$PWD/test-results.trx"
|
||||
run: |
|
||||
set +e
|
||||
dotnet test LinuxSolution.sln -clp:"ErrorsOnly;Summary" --logger "trx;LogFileName=$PWD/test-results.trx"
|
||||
echo "EXITCODE=$?" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
@@ -41,10 +44,5 @@ jobs:
|
||||
name: test-results
|
||||
path: test-results.trx
|
||||
|
||||
- name: Report test results
|
||||
uses: dorny/test-reporter@v1
|
||||
with:
|
||||
name: Test results
|
||||
path: test-results.trx
|
||||
fail-on-error: true
|
||||
reporter: dotnet-trx
|
||||
- name: Set exit code
|
||||
run: exit "$EXITCODE"
|
||||
|
||||
Reference in New Issue
Block a user