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:
@@ -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
|
||||||
@@ -33,7 +33,10 @@ jobs:
|
|||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
continue-on-error: true
|
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
|
- name: Upload test results
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -41,10 +44,5 @@ jobs:
|
|||||||
name: test-results
|
name: test-results
|
||||||
path: test-results.trx
|
path: test-results.trx
|
||||||
|
|
||||||
- name: Report test results
|
- name: Set exit code
|
||||||
uses: dorny/test-reporter@v1
|
run: exit "$EXITCODE"
|
||||||
with:
|
|
||||||
name: Test results
|
|
||||||
path: test-results.trx
|
|
||||||
fail-on-error: true
|
|
||||||
reporter: dotnet-trx
|
|
||||||
|
|||||||
Reference in New Issue
Block a user