Skip to content

Commit

Permalink
Publish more test results
Browse files Browse the repository at this point in the history
  • Loading branch information
reubeno committed May 12, 2024
1 parent bea5321 commit d0f2fda
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci-reports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 != ''
Expand All @@ -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 != ''
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d0f2fda

Please sign in to comment.