-
Notifications
You must be signed in to change notification settings - Fork 2
152 lines (125 loc) · 4.36 KB
/
Copy pathci.yml
File metadata and controls
152 lines (125 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Checks
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
# One step per gate, so a red run says which gate failed without opening the log.
#
# These are the same tasks `./gradlew ciCheck` depends on. Adding a task there means
# adding a step here, or the local gate and the CI gate drift apart.
#
# Each step runs even if an earlier one failed, so a single push reports every
# problem at once instead of one per round trip. The cost is that a compile error
# turns several steps red at the same time.
- name: Formatting
run: ./gradlew ktlintCheck --no-daemon --stacktrace
- name: Static analysis
if: ${{ !cancelled() }}
run: ./gradlew detekt --no-daemon --stacktrace
- name: Android Lint
if: ${{ !cancelled() }}
run: ./gradlew :composeApp:lintDebug --no-daemon --stacktrace
- name: Unit tests (shared)
if: ${{ !cancelled() }}
run: ./gradlew :shared:testAndroid --no-daemon --stacktrace
- name: Unit tests (app)
if: ${{ !cancelled() }}
run: ./gradlew :composeApp:testDebugUnitTest --no-daemon --stacktrace
- name: Debug build
if: ${{ !cancelled() }}
run: ./gradlew :composeApp:assembleDebug --no-daemon --stacktrace
# Reports are far more useful than the log when something fails, and they are the
# only artefact of a red run worth keeping.
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: reports
path: |
**/build/reports/ktlint/**
**/build/reports/detekt/**
**/build/reports/lint-results-*.html
**/build/reports/tests/**
retention-days: 7
if-no-files-found: ignore
e2e:
name: End-to-end tests
runs-on: ubuntu-latest
timeout-minutes: 45
needs: check
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
# KVM has to be enabled explicitly or the emulator falls back to software rendering
# and the suite times out rather than failing honestly.
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Instrumented tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
disable-animations: true
script: ./gradlew :composeApp:connectedDebugAndroidTest --no-daemon
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-reports
path: composeApp/build/reports/androidTests/**
retention-days: 7
if-no-files-found: ignore
bundle:
name: Release bundle
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [check, e2e]
# Only on master: this proves the release variant still assembles, which is what
# actually ships to Play. It is unsigned here, the upload keystore never enters CI.
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Bundle release
run: ./gradlew :composeApp:bundleRelease --no-daemon
- name: Upload bundle
uses: actions/upload-artifact@v4
with:
name: aab
path: composeApp/build/outputs/bundle/release/*.aab
retention-days: 14