Skip to content

Commit 978405f

Browse files
committed
chore(ci): improve build and test workflows
1 parent 1d2b103 commit 978405f

File tree

2 files changed

+35
-20
lines changed

2 files changed

+35
-20
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# This workflow will build a Java project with Gradle
22

3-
name: Build
3+
name: Build and unit test
44

5-
on: [push]
5+
on: [ push ]
66

77
jobs:
88
build:
@@ -13,6 +13,12 @@ jobs:
1313
with:
1414
java-version: '21'
1515
distribution: 'adopt'
16+
- name: Cache Gradle packages
17+
uses: actions/cache@v4
18+
with:
19+
path: ~/.gradle/caches
20+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
21+
restore-keys: ${{ runner.os }}-gradle
1622
- name: Grant execute permission for gradlew
1723
run: chmod +x gradlew
1824
- name: Assemble
@@ -24,3 +30,30 @@ jobs:
2430
path: |
2531
demos/**/build/outputs/apk/debug/*.apk
2632
33+
unit-tests:
34+
needs: build
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-java@v4
39+
with:
40+
java-version: '21'
41+
distribution: 'adopt'
42+
- name: Cache Gradle packages
43+
uses: actions/cache@v4
44+
with:
45+
path: ~/.gradle/caches
46+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
47+
restore-keys: ${{ runner.os }}-gradle
48+
- name: Make gradlew executable
49+
working-directory: .
50+
run: chmod +x ./gradlew
51+
- name: Run unit tests
52+
working-directory: .
53+
run: ./gradlew test
54+
- name: Upload test reports
55+
if: ${{ !cancelled() }}
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: test-reports
59+
path: '**/build/reports/tests'

.github/workflows/test.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,6 @@ name: Run tests
66
on: [ push ]
77

88
jobs:
9-
unit-tests:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@v4
13-
- uses: actions/setup-java@v4
14-
with:
15-
java-version: '21'
16-
distribution: 'adopt'
17-
- name: Make gradlew executable
18-
run: chmod +x ./gradlew
19-
- name: Run unit test
20-
run: ./gradlew test
21-
- name: Upload test reports
22-
if: ${{ !cancelled() }}
23-
uses: actions/upload-artifact@v4
24-
with:
25-
name: test-reports-${{ matrix.api-level }}
26-
path: '**/build/reports/tests'
279
instrumented-tests:
2810
runs-on: ubuntu-latest
2911
timeout-minutes: 55

0 commit comments

Comments
 (0)