13
13
workflow_dispatch :
14
14
15
15
env :
16
- JAVA_VERSION : 17
16
+ _JAVA_VERSION : 17
17
+ _GITHUB_ACTION_RUN_URL : ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}
18
+
17
19
18
20
jobs :
19
21
test :
20
22
name : Test
21
23
runs-on : ubuntu-24.04
22
24
permissions :
23
- contents : read
24
- issues : write
25
25
packages : read
26
- pull-requests : write
27
26
28
27
steps :
29
28
- name : Check out repo
60
59
uses : actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
61
60
with :
62
61
distribution : " temurin"
63
- java-version : ${{ env.JAVA_VERSION }}
62
+ java-version : ${{ env._JAVA_VERSION }}
64
63
65
64
- name : Install Fastlane
66
65
run : |
@@ -69,17 +68,56 @@ jobs:
69
68
bundle install --jobs 4 --retry 3
70
69
71
70
- name : Build and test
71
+ env :
72
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Used in settings.gradle.kts to download the SDK from GitHub Maven Packages
72
73
run : |
73
74
bundle exec fastlane check
74
75
75
- - name : Upload test reports on failure
76
+ - name : Upload test reports
76
77
uses : actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
77
- if : failure()
78
+ if : always()
79
+ with :
80
+ name : test-reports
81
+ path : |
82
+ app/build/reports/tests/
83
+ app/build/reports/kover/reportStandardDebug.xml
84
+
85
+ report :
86
+ name : Process Test Reports
87
+ needs : test
88
+ runs-on : ubuntu-24.04
89
+ permissions :
90
+ contents : read
91
+ issues : write
92
+ pull-requests : write
93
+ if : always()
94
+
95
+ steps :
96
+ - name : Download test artifacts
97
+ uses : actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
78
98
with :
79
99
name : test-reports
80
- path : app/build/reports/tests/
81
100
82
101
- name : Upload to codecov.io
102
+ id : upload-to-codecov
83
103
uses : codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
104
+ continue-on-error : true
84
105
with :
85
- files : app/build/reports/kover/reportStandardDebug.xml
106
+ os : linux
107
+ files : kover/reportStandardDebug.xml
108
+ fail_ci_if_error : true
109
+
110
+ - name : Comment PR if tests failed
111
+ if : steps.upload-to-codecov.outcome == 'failure'
112
+ env :
113
+ PR_NUMBER : ${{ github.event.number }}
114
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
115
+ RUN_ACTOR : ${{ github.triggering_actor }}
116
+ run : |
117
+ echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
118
+ echo "> Uploading code coverage report failed. Please check the \"Upload to codecov.io\" step of \"Process Test Reports\" job for more details." >> $GITHUB_STEP_SUMMARY
119
+
120
+ if [ ! -z "$PR_NUMBER" ]; then
121
+ message=$'> [!WARNING]\n> @'$RUN_ACTOR' Uploading code coverage report failed. Please check the "Upload to codecov.io" step of [Process Test Reports job]('$_GITHUB_ACTION_RUN_URL') for more details.'
122
+ gh pr comment --repo $GITHUB_REPOSITORY $PR_NUMBER --body "$message"
123
+ fi
0 commit comments