diff --git a/.github/workflows/ci-reports.yaml b/.github/workflows/ci-reports.yaml index 0b14d642..df61b009 100644 --- a/.github/workflows/ci-reports.yaml +++ b/.github/workflows/ci-reports.yaml @@ -29,6 +29,7 @@ jobs: GH_TOKEN: ${{ github.token }} run: | head_branch=$(echo '${{ steps.find-run.outputs.data }}' | jq -r '.head_branch') + head_sha=$(echo '${{ steps.find-run.outputs.data }}' | jq -r '.head_sha') head_repo=$(echo '${{ steps.find-run.outputs.data }}' | jq -r '.head_repository.full_name') if [[ "${head_branch}" != "" && "${head_repo}" != "" ]]; then @@ -44,6 +45,9 @@ jobs: fi echo "pr_number=${pr_number}" >> "$GITHUB_OUTPUT" + echo "head_branch=${head_branch}" >> "$GITHUB_OUTPUT" + echo "head_sha=${head_sha}" >> "$GITHUB_OUTPUT" + echo "head_repo=${head_repo}" >> "$GITHUB_OUTPUT" - name: Download code coverage reports if: steps.get-pr.outputs.pr_number != '' @@ -63,11 +67,43 @@ jobs: run-id: ${{ github.event.workflow_run.id }} path: reports/ + - name: Download test results + if: steps.get-pr.outputs.pr_number != '' + uses: actions/download-artifact@v4 + with: + name: test-reports + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + path: reports/ + - name: Show published reports if: steps.get-pr.outputs.pr_number != '' run: | ls -lR reports/ + - name: "Synthesize event file" + run: | + echo \ + '{ \ + "pull_request": { \ + "head": { \ + "sha": "${{ steps.get-pr.outputs.head_sha }}", \ + "repo": { \ + "full_name": "${{ steps.get-pr.outputs.head_repo }}" \ + } \ + } \ + } \ + }' >event-file.json + + - name: "Publish test results" + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + commit: ${{ github.event.workflow_run.head_sha }} + event_file: event-file.json + event_name: ${{ github.event.workflow_run.event }} + files: reports/test-results-*.xml + - name: "Publish available .md reports to PR" uses: marocchino/sticky-pull-request-comment@v2 if: steps.get-pr.outputs.pr_number != '' diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 53e4f2d3..92ff0142 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -97,12 +97,11 @@ jobs: exit ${result} - # - name: "Publish test results" - # uses: EnricoMi/publish-unit-test-result-action@v2 - # if: always() - # with: - # files: | - # test-results-*.xml + - name: "Upload test results" + uses: actions/upload-artifact@v4 + with: + name: test-reports + path: test-results-*.xml - name: "Generate code coverage report" uses: clearlyip/code-coverage-report-action@v4