File tree Expand file tree Collapse file tree 3 files changed +69
-6
lines changed Expand file tree Collapse file tree 3 files changed +69
-6
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ concurrency:
11
11
group : ${{ github.ref }}
12
12
cancel-in-progress : true
13
13
14
+ # Sets permissions of the GITHUB_TOKEN to allow publishing of workflow checks
15
+ permissions :
16
+ contents : read
17
+ id-token : write
18
+ checks : write
19
+
14
20
jobs :
15
21
build :
16
22
runs-on : ubuntu-latest
@@ -96,9 +102,10 @@ jobs:
96
102
run : mvn --batch-mode -e clean install
97
103
98
104
- name : Publish Test Report
99
- uses : scacap/action-surefire-report@v1
105
+ if : success() || failure()
106
+ uses : EnricoMi/publish-unit-test-result-action@v2
100
107
with :
101
- fail_if_no_tests : false
108
+ junit_files : " target/surefire-reports/*.xml "
102
109
103
110
- name : Build site
104
111
run : mvn --batch-mode -e -DskipTests site
Original file line number Diff line number Diff line change
1
+ name : Test Reports (PR)
2
+
3
+ on :
4
+ workflow_run :
5
+ workflows : ["Pull Request"]
6
+ types :
7
+ - completed
8
+
9
+ permissions : {}
10
+
11
+ jobs :
12
+ test-results :
13
+ name : Test Results
14
+ runs-on : ubuntu-latest
15
+ if : github.event.workflow_run.conclusion != 'skipped'
16
+
17
+ permissions :
18
+ checks : write
19
+ pull-requests : write
20
+ actions : read
21
+
22
+ steps :
23
+ - name : Download and Extract Artifacts
24
+ env :
25
+ GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
26
+ run : |
27
+ mkdir -p artifacts && cd artifacts
28
+
29
+ artifacts_url=${{ github.event.workflow_run.artifacts_url }}
30
+
31
+ gh api --paginate "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
32
+ do
33
+ IFS=$'\t' read name url <<< "$artifact"
34
+ gh api $url > "$name.zip"
35
+ unzip -d "$name" "$name.zip"
36
+ done
37
+
38
+ - name : Publish Test Results
39
+ uses : EnricoMi/publish-unit-test-result-action@v2
40
+ with :
41
+ commit : ${{ github.event.workflow_run.head_sha }}
42
+ event_file : artifacts/Event File/event.json
43
+ event_name : ${{ github.event.workflow_run.event }}
44
+ junit_files : " artifacts/Test Results/**/*.xml"
Original file line number Diff line number Diff line change 1
- name : CI
1
+ name : Pull Request
2
2
3
3
on :
4
4
pull_request :
@@ -79,11 +79,13 @@ jobs:
79
79
- name : Build with Maven
80
80
run : mvn --batch-mode -e clean install
81
81
82
- - name : Publish Test Report
83
- uses : scacap/action-surefire-report@v1
82
+ - name : Upload Test Results
84
83
if : success() || failure()
84
+ uses : actions/upload-artifact@v3
85
85
with :
86
- fail_if_no_tests : false
86
+ name : Test Results
87
+ path : |
88
+ target/surefire-reports/*.xml
87
89
88
90
- name : Build site
89
91
run : mvn --batch-mode -e -DskipTests site
95
97
if : always()
96
98
run : |
97
99
find ~/.m2/repository -name \*-SNAPSHOT -type d -exec rm -rf {} \+ || :
100
+
101
+ event_file :
102
+ name : " Event File"
103
+ runs-on : ubuntu-latest
104
+ steps :
105
+ - name : Upload
106
+ uses : actions/upload-artifact@v3
107
+ with :
108
+ name : Event File
109
+ path : ${{ github.event_path }}
You can’t perform that action at this time.
0 commit comments