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:
Evil Factory
2022-08-12 06:15:20 -03:00
committed by GitHub
2 changed files with 33 additions and 8 deletions

View 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

View File

@@ -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"