-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upload test report #5035
Upload test report #5035
Changes from 6 commits
4a3c1cf
9d55120
657b39d
fc66fdf
e9b082a
e76188e
d17935d
0851215
57df30e
147c068
7a4d186
7abd754
2ed1da1
d0ab66a
d19412d
b608318
2e81142
097847d
2cee895
4cd4210
d54cdb1
d642920
4d66ba7
ab9cdcb
79274e3
178390d
2b98179
bed78f6
fb93374
c3d58fd
808c55a
0c7c518
0dcb951
490a0d3
69e2408
7027254
737acd8
627ba9a
a154993
f5fd5ba
8bdd2f4
0fdd51f
e7b7a03
b38347f
3f9a937
52a612e
b9452aa
07034c2
d9dc36d
24a6260
07809e2
23a0223
4df70d1
5971d1e
ffb5a58
ff9d982
2aac566
7a8e42d
939f773
b831ba6
80ac2b4
40331a8
7a575e3
36a32c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Unit Test Results | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Unit Tests"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
unit-test-results: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is it necessary to separate this into a different workflow? Doing so requires all the juggling with artifact files. Can we not do all it at once directly in the unit test workflow, where we already call publish reports action? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It's a valid question, because one would think the action to execute the unit test and generate the results artifact is done as part of this repo's CI pipeline, so the relevant files should be easily accessible. In fact, we're trying to do that now (publish test results as a comment to this PR) because, I agree, it's a lot simpler than juggling artifact uploads and downloads; but it's failing with this error message (from example run):
I don't fully understand why, but from the log message, it almost sounds like a security measure to prevent PRs from another fork from writing to a PR owned by the "parent" repo, which seems to make sense. Can you see any other alternative? |
||
name: Unit Test Results | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
checks: write | ||
|
||
# Needed unless run with comment_mode: off. | ||
pull-requests: write | ||
|
||
# Required by download step to access artifacts API. | ||
actions: read | ||
|
||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | ||
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | ||
|
||
- name: Download and Extract Artifacts | ||
uses: dawidd6/action-download-artifact@v3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we know what's different about it? It's preferable to use official actions like https://github.com/actions/download-artifact There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not specifically, but I did spend a good number of hours trying out actions/download-artifact without any luck. Oddly, it wasn't able to discover the uploaded files, but there may have been a silly mistake on my part 🤷🏼 Happy to take suggestions! |
||
with: | ||
run_id: ${{ github.event.workflow_run.id }} | ||
path: artifacts | ||
|
||
- name: Publish Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
with: | ||
commit: ${{ github.event.workflow_run.head_sha }} | ||
event_file: artifacts/Event File/event.json | ||
event_name: ${{ github.event.workflow_run.event }} | ||
files: "artifacts/**/*.xml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file needs to be merged into
main
first before we can see the results of the test report summary in PRs, which is why we can't see it in this PR.