From 91f33c670e62d33c59191b7614c6e0dcde3e55e0 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 12 Jan 2024 19:20:00 -0800 Subject: [PATCH] Fix post-build test reporting and report summary --- .github/actions/test/action.yml | 18 ++++++++---------- .github/workflows/publish-test-results.yml | 18 ++++++++++++++---- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 4dc7afe30..65e928bb0 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -77,22 +77,20 @@ runs: - name: Run tests shell: bash - run: dotnet test ./_tests/Sonarr.*.Test.dll --filter "${{ inputs.filter }}" --logger trx --results-directory "${{ env.RESULTS_NAME }}" + run: dotnet test ./_tests/Sonarr.*.Test.dll --filter "${{ inputs.filter }}" --logger "trx;LogFileName=${{ env.RESULTS_NAME }}.trx" - name: Upload Test Results if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 with: name: results-${{ env.RESULTS_NAME }} - path: ${{ env.RESULTS_NAME }}/*.trx + path: TestResults/*.trx - name: Publish Test Results - if: ${{ !cancelled() }} - uses: EnricoMi/publish-unit-test-result-action/composite@v2 + uses: phoenix-actions/test-reporting@v12 with: - check_run: false - check_run_annotations: none - comment_mode: off - comment_title: ${{ env.RESULTS_NAME }} Test Results - large_files: true - files: ${{ env.RESULTS_NAME }}/*.trx + name: Test Results + output-to: step-summary + path: '*.trx' + reporter: dotnet-trx + working-directory: TestResults diff --git a/.github/workflows/publish-test-results.yml b/.github/workflows/publish-test-results.yml index d10a92364..5e6012559 100644 --- a/.github/workflows/publish-test-results.yml +++ b/.github/workflows/publish-test-results.yml @@ -13,19 +13,29 @@ permissions: jobs: report: - if: github.event.workflow_run.conclusion != 'skipped' + if: ${{ github.event.workflow_run.conclusion != 'skipped' && github.event.workflow_run.conclusion != 'cancelled' }} runs-on: ubuntu-latest steps: + - name: Check out + uses: actions/checkout@v3 + - name: Download Test Reports uses: actions/download-artifact@v4 with: - name: results-* path: test-results + pattern: results-* merge-multiple: true + repository: ${{ github.event.repository.owner.login }}/${{ github.event.repository.name }} + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Publish Test Results uses: phoenix-actions/test-reporting@v12 with: - name: 'Test Results' - path: 'test-results/*.trx' + list-suites: failed + list-tests: failed + name: Test Results + only-summary: true + path: '*.trx' reporter: dotnet-trx + working-directory: test-results