Skip to content

Commit d6a5f5b

Browse files
committed
Restructure test workflow with parallel job execution (Tier 1)
Major changes: - Split single test job into 5 parallel jobs: 1. lint-and-static-analysis: Run detekt and lint checks 2. test-libraries: Test core, data, network, ui, authenticatorbridge, cxf 3. test-app: Test app module (5,447 tests) 4. test-authenticator: Test authenticator module (281 tests) 5. aggregate-coverage: Merge coverage reports and upload to codecov Benefits: - 40-55% expected reduction in CI runtime - Early failure detection (lint and library tests complete quickly) - Better resource utilization across 5 concurrent jobs - Maintains existing coverage reporting behavior Technical details: - Each test job uploads test reports and coverage data as artifacts - Coverage aggregation job downloads all coverage artifacts - Uses Fastlane's koverXmlReportMergedCoverage for merging - Preserves all existing codecov.io integration
1 parent facfec1 commit d6a5f5b

File tree

1 file changed

+252
-20
lines changed

1 file changed

+252
-20
lines changed

.github/workflows/test.yml

Lines changed: 252 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ env:
1717
_GITHUB_ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}
1818

1919
jobs:
20-
test:
21-
name: Test
20+
lint-and-static-analysis:
21+
name: Lint & Static Analysis
2222
runs-on: ubuntu-24.04
2323
permissions:
2424
packages: read
25-
pull-requests: write
2625

2726
steps:
2827
- name: Check out repo
@@ -52,6 +51,240 @@ jobs:
5251
restore-keys: |
5352
${{ runner.os }}-build-
5453
54+
- name: Configure JDK
55+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
56+
with:
57+
distribution: "temurin"
58+
java-version: ${{ env._JAVA_VERSION }}
59+
60+
- name: Run detekt
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
run: ./gradlew detekt
64+
65+
- name: Run lint checks
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
run: ./gradlew lintStandardDebug lintDebug
69+
70+
test-libraries:
71+
name: Test Library Modules
72+
runs-on: ubuntu-24.04
73+
permissions:
74+
packages: read
75+
76+
steps:
77+
- name: Check out repo
78+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
79+
with:
80+
persist-credentials: false
81+
82+
- name: Validate Gradle wrapper
83+
uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
84+
85+
- name: Cache Gradle files
86+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
87+
with:
88+
path: |
89+
~/.gradle/caches
90+
~/.gradle/wrapper
91+
key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }}
92+
restore-keys: |
93+
${{ runner.os }}-gradle-v2-
94+
95+
- name: Cache build output
96+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
97+
with:
98+
path: |
99+
${{ github.workspace }}/build-cache
100+
key: ${{ runner.os }}-build-cache-${{ github.sha }}
101+
restore-keys: |
102+
${{ runner.os }}-build-
103+
104+
- name: Configure JDK
105+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
106+
with:
107+
distribution: "temurin"
108+
java-version: ${{ env._JAVA_VERSION }}
109+
110+
- name: Test library modules
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
run: |
114+
./gradlew :core:testDebug :data:testDebug :network:testDebug :ui:testDebug :authenticatorbridge:testDebug :cxf:testDebug
115+
116+
- name: Upload library test reports
117+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
118+
if: always()
119+
with:
120+
name: test-reports-libraries
121+
path: |
122+
core/build/reports/tests/
123+
data/build/reports/tests/
124+
network/build/reports/tests/
125+
ui/build/reports/tests/
126+
authenticatorbridge/build/reports/tests/
127+
cxf/build/reports/tests/
128+
129+
- name: Upload library coverage data
130+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
131+
if: always()
132+
with:
133+
name: coverage-libraries
134+
path: |
135+
core/build/reports/kover/
136+
data/build/reports/kover/
137+
network/build/reports/kover/
138+
ui/build/reports/kover/
139+
authenticatorbridge/build/reports/kover/
140+
cxf/build/reports/kover/
141+
142+
test-app:
143+
name: Test App Module
144+
runs-on: ubuntu-24.04
145+
permissions:
146+
packages: read
147+
148+
steps:
149+
- name: Check out repo
150+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
151+
with:
152+
persist-credentials: false
153+
154+
- name: Validate Gradle wrapper
155+
uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
156+
157+
- name: Cache Gradle files
158+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
159+
with:
160+
path: |
161+
~/.gradle/caches
162+
~/.gradle/wrapper
163+
key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }}
164+
restore-keys: |
165+
${{ runner.os }}-gradle-v2-
166+
167+
- name: Cache build output
168+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
169+
with:
170+
path: |
171+
${{ github.workspace }}/build-cache
172+
key: ${{ runner.os }}-build-cache-${{ github.sha }}
173+
restore-keys: |
174+
${{ runner.os }}-build-
175+
176+
- name: Configure JDK
177+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
178+
with:
179+
distribution: "temurin"
180+
java-version: ${{ env._JAVA_VERSION }}
181+
182+
- name: Test app module
183+
env:
184+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185+
run: ./gradlew :app:testStandardDebug
186+
187+
- name: Upload app test reports
188+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
189+
if: always()
190+
with:
191+
name: test-reports-app
192+
path: app/build/reports/tests/
193+
194+
- name: Upload app coverage data
195+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
196+
if: always()
197+
with:
198+
name: coverage-app
199+
path: app/build/reports/kover/
200+
201+
test-authenticator:
202+
name: Test Authenticator Module
203+
runs-on: ubuntu-24.04
204+
permissions:
205+
packages: read
206+
207+
steps:
208+
- name: Check out repo
209+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
210+
with:
211+
persist-credentials: false
212+
213+
- name: Validate Gradle wrapper
214+
uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
215+
216+
- name: Cache Gradle files
217+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
218+
with:
219+
path: |
220+
~/.gradle/caches
221+
~/.gradle/wrapper
222+
key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }}
223+
restore-keys: |
224+
${{ runner.os }}-gradle-v2-
225+
226+
- name: Cache build output
227+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
228+
with:
229+
path: |
230+
${{ github.workspace }}/build-cache
231+
key: ${{ runner.os }}-build-cache-${{ github.sha }}
232+
restore-keys: |
233+
${{ runner.os }}-build-
234+
235+
- name: Configure JDK
236+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
237+
with:
238+
distribution: "temurin"
239+
java-version: ${{ env._JAVA_VERSION }}
240+
241+
- name: Test authenticator module
242+
env:
243+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
244+
run: ./gradlew :authenticator:testDebug
245+
246+
- name: Upload authenticator test reports
247+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
248+
if: always()
249+
with:
250+
name: test-reports-authenticator
251+
path: authenticator/build/reports/tests/
252+
253+
- name: Upload authenticator coverage data
254+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
255+
if: always()
256+
with:
257+
name: coverage-authenticator
258+
path: authenticator/build/reports/kover/
259+
260+
aggregate-coverage:
261+
name: Aggregate Coverage & Upload
262+
runs-on: ubuntu-24.04
263+
needs: [test-libraries, test-app, test-authenticator]
264+
if: always()
265+
permissions:
266+
packages: read
267+
pull-requests: write
268+
269+
steps:
270+
- name: Check out repo
271+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
272+
with:
273+
persist-credentials: false
274+
275+
- name: Validate Gradle wrapper
276+
uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
277+
278+
- name: Cache Gradle files
279+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
280+
with:
281+
path: |
282+
~/.gradle/caches
283+
~/.gradle/wrapper
284+
key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }}
285+
restore-keys: |
286+
${{ runner.os }}-gradle-v2-
287+
55288
- name: Configure Ruby
56289
uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0
57290
with:
@@ -69,26 +302,25 @@ jobs:
69302
bundle config path vendor/bundle
70303
bundle install --jobs 4 --retry 3
71304
72-
- name: Build and test
305+
- name: Download all coverage artifacts
306+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
307+
with:
308+
pattern: coverage-*
309+
merge-multiple: true
310+
path: coverage-data/
311+
312+
- name: Generate merged coverage report
73313
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Used in settings.gradle.kts to download the SDK from GitHub Maven Packages
314+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75315
run: |
76-
bundle exec fastlane check
316+
bundle exec fastlane koverXmlReportMergedCoverage
77317
78-
- name: Upload test reports
318+
- name: Upload merged coverage report
79319
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
80320
if: always()
81321
with:
82-
name: test-reports
83-
path: |
84-
build/reports/kover/reportMergedCoverage.xml
85-
app/build/reports/tests/
86-
authenticator/build/reports/tests/
87-
authenticatorbridge/build/reports/tests/
88-
core/build/reports/tests/
89-
data/build/reports/tests/
90-
network/build/reports/tests/
91-
ui/build/reports/tests/
322+
name: merged-coverage-report
323+
path: build/reports/kover/reportMergedCoverage.xml
92324

93325
- name: Upload to codecov.io
94326
id: upload-to-codecov
@@ -101,17 +333,17 @@ jobs:
101333
fail_ci_if_error: true
102334
disable_search: true
103335

104-
- name: Comment PR if tests failed
336+
- name: Comment PR if coverage upload failed
105337
if: steps.upload-to-codecov.outcome == 'failure' && (github.event_name == 'push' || github.event_name == 'pull_request')
106338
env:
107339
PR_NUMBER: ${{ github.event.number }}
108340
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109341
RUN_ACTOR: ${{ github.triggering_actor }}
110342
run: |
111343
echo "> [!WARNING]" >> "$GITHUB_STEP_SUMMARY"
112-
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"
344+
echo "> Uploading code coverage report failed. Please check the \"Upload to codecov.io\" step of \"Aggregate Coverage & Upload\" job for more details." >> "$GITHUB_STEP_SUMMARY"
113345
114346
if [ -n "$PR_NUMBER" ]; then
115-
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.'
347+
message=$'> [!WARNING]\n> @'$RUN_ACTOR' Uploading code coverage report failed. Please check the "Upload to codecov.io" step of ['$_GITHUB_ACTION_RUN_URL'] for more details.'
116348
gh pr comment --repo "$GITHUB_REPOSITORY" "$PR_NUMBER" --body "$message"
117349
fi

0 commit comments

Comments
 (0)