-
Notifications
You must be signed in to change notification settings - Fork 77
249 lines (204 loc) · 7.84 KB
/
ci.yml
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: CI
on:
# Only run push on main
push:
branches:
- main
paths-ignore:
- '**/*.md'
# Always run on PRs
pull_request:
branches:
- main
- 'releases*'
- 'compose-1.7.x'
merge_group:
concurrency:
group: 'ci-${{ github.event.merge_group.head_ref || github.head_ref }}-${{ github.workflow }}'
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
env:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: 'true'
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '22'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
# Only save Gradle User Home state for builds on the 'main' branch.
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
# Don't reuse cache entries from any other Job.
gradle-home-cache-strict-match: true
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
# Limit the size of the cache entry.
# These directories contain instrumented/transformed dependency jars which can be reconstructed relatively quickly.
gradle-home-cache-excludes: |
caches/jars-9
caches/transforms-3
- name: Build and run checks
id: gradle-build
run: |
./gradlew --quiet --continue --no-configuration-cache \
check \
:samples:star:apk:assembleDebug \
detektMain \
detektTest \
assembleAndroidTest
- name: Verify STAR desktop builds
id: gradle-build-star-desktop
run: |
./gradlew :samples:star:jvmJar -Pcircuit.buildDesktop --quiet
# Defer these until after the above run, no need to waste resources running them if there are other failures first
- name: Run instrumentation tests via emulator.wtf (main repo only)
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
id: gradle-instrumentation
env:
EW_API_TOKEN: ${{ secrets.EMULATOR_WTF_TOKEN }}
run: ./gradlew testReleaseWithEmulatorWtf --quiet
- name: Enable KVM group perms
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
# Forks cannot run emulator.wtf tests due to not being able to use repo secrets, so for them
# we run the tests via the android-emulator-runner action instead
- name: Run instrumentation tests via local emulator (from forks only)
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
id: gradle-instrumentation-fork
uses: reactivecircus/android-emulator-runner@v2
with:
# Use API 28 for star samples
api-level: 28
arch: x86_64
disable-animations: true
disk-size: 6000M
heap-size: 600M
script: |
# Disable benchmark tests as they do not work on emulators
./gradlew ciConnectedCheck --quiet -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=none
- name: (Fail-only) Upload reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: reports-build
path: |
**/build/reports/**
build-ios:
runs-on: macos-14
env:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: 'true'
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '22'
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '3.2.2'
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.2'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
# Only save Gradle User Home state for builds on the 'main' branch.
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
# Don't reuse cache entries from any other Job.
gradle-home-cache-strict-match: true
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
# Limit the size of the cache entry.
# These directories contain instrumented/transformed dependency jars which can be reconstructed relatively quickly.
gradle-home-cache-excludes: |
caches/jars-9
caches/transforms-3
- run: brew install swiftlint
# TODO re-enable once fastlane fixes it https://github.com/fastlane/fastlane/issues/22191
# - name: Run lint on iOS samples
# run: bundle exec fastlane ios lint
- name: Run iOS Simulator tests
id: gradle-ios-tests
run: |
./gradlew --quiet --continue --no-configuration-cache \
iosSimulatorArm64Test
- name: Build iOS samples
run: bundle exec fastlane ios build
snapshots:
runs-on: ubuntu-latest
env:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: 'true'
- name: Check LFS files
uses: actionsdesk/[email protected]
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '22'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
# Only save Gradle User Home state for builds on the 'main' branch.
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
# Don't reuse cache entries from any other Job.
gradle-home-cache-strict-match: true
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
# Limit the size of the cache entry.
# These directories contain instrumented/transformed dependency jars which can be reconstructed relatively quickly.
gradle-home-cache-excludes: |
caches/jars-9
caches/transforms-3
- name: Verify Snapshots
id: gradle-snapshots
run: ./gradlew verifyRoborazzi --quiet
- name: (Fail-only) Upload reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: reports-snapshots
path: |
**/build/reports/**
**/src/test/snapshots/**/*_compare.png
publish:
runs-on: ubuntu-latest
needs: [build, build-ios, snapshots]
if: github.repository == 'slackhq/circuit' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '22'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Publish snapshot (main branch only)
run: ./gradlew publish -PmavenCentralUsername=${{ secrets.SONATYPEUSERNAME }} -PmavenCentralPassword=${{ secrets.SONATYPEPASSWORD }} --no-configuration-cache --quiet