forked from Shopify/react-native-skia
-
Notifications
You must be signed in to change notification settings - Fork 0
392 lines (329 loc) · 12.3 KB
/
ci.yml
File metadata and controls
392 lines (329 loc) · 12.3 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
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
name: CI
on:
push:
branches:
- main
- next
pull_request:
branches:
- main
- next
merge_group:
types:
- checks_requested
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.0
with:
submodules: recursive
- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- run: pip install cpplint
- run: cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=package/cpp/skia --exclude=package/apple --exclude=package/android/build --exclude=package/node_modules --recursive package
- name: Install clang-format
run: sudo apt-get update && sudo apt-get install -y clang-format-18
# - name: Clang Format Check
# working-directory: packages/skia
# run: |
# yarn clang-format
# if [[ `git status --porcelain` ]]; then
# echo "ERROR: clang-format would modify files. Please run 'yarn clang-format' and commit the changes."
# echo "Files that would be modified:"
# git status --porcelain
# echo "Diff of changes:"
# git diff
# exit 1
# fi
- name: Lint files
run: yarn lint
- name: Typecheck files
run: yarn tsc
test:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.0
with:
submodules: recursive
- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: yarn test
build-library:
runs-on: ubuntu-latest
outputs:
run_id: ${{ github.run_id }}
steps:
- name: Checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.0
with:
submodules: recursive
- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build package
run: yarn build
- name: Pack package
working-directory: packages/skia
run: yarn pack
- name: Upload package artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v6.0.0
with:
name: package-tgz
path: packages/skia/package.tgz
- name: Build dry run release
working-directory: packages/skia
run: |
npx semantic-release --dry-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
test-package-e2e:
needs: build-library
uses: ./.github/workflows/test-skia-package.yml
with:
skia_version: artifact:${{ needs.build-library.outputs.run_id }}
test_ios: true
test_android: true
test_web: true
build-windows-library:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.0
with:
submodules: recursive
- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build package
run: yarn build
build-android:
runs-on: ubuntu-latest
env:
TURBO_CACHE_DIR: .turbo/android
steps:
- name: Checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.0
with:
submodules: recursive
- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Free disk space
run: |
echo "Disk usage before cleanup:"
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune -af || true
sudo apt-get clean
echo "Disk usage after cleanup:"
df -h
- name: Cache turborepo for Android
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-android
- name: Install JDK
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: 'zulu'
java-version: '17'
- name: Install NDK
uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 # v1.5.0
id: setup-ndk
with:
ndk-version: r27d
- name: Set ANDROID_NDK
run: echo "ANDROID_NDK=$ANDROID_HOME/ndk-bundle" >> $GITHUB_ENV
- name: Finalize Android SDK
run: |
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
- name: Install Android SDK
run: |
echo "sdk.dir=$ANDROID_HOME" > $GITHUB_WORKSPACE/apps/example/android/local.properties
- name: Cache Gradle
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('./apps/example/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build example for Android
env:
JAVA_OPTS: "-XX:MaxHeapSize=6g"
run: |
yarn turbo run build:android --concurrency 1
- name: Cache apk
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
env:
cache-name: cache-apk
with:
path: apps/example/android/app/build/outputs/apk/debug/app-debug.apk
key: apk-${{ github.sha }}
- name: Upload Android APK artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v6.0.0
with:
name: android-example-apk
path: apps/example/android/app/build/outputs/apk/debug/app-debug.apk
test-android:
needs: build-android
runs-on: ubuntu-latest
timeout-minutes: 60
env:
TURBO_CACHE_DIR: .turbo/android
steps:
- name: checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.0
with:
submodules: recursive
- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Android SDK
uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1
- name: Install Android SDK tools
run: |
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> $GITHUB_PATH
echo "$ANDROID_HOME/platform-tools" >> $GITHUB_PATH
echo "$ANDROID_HOME/emulator" >> $GITHUB_PATH
- 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
- name: Restore APK
id: cache-apk
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
path: apps/example/android/app/build/outputs/apk/debug/app-debug.apk
key: apk-${{ github.sha }}
- name: Start Package Manager
working-directory: apps/example/
run: E2E=true yarn start &
- name: Run Android Emulator Tests
uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a # v2.37.0
with:
api-level: 30
arch: x86_64
profile: Nexus 5X
force-avd-creation: true
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
disable-animations: true
script: |
# Wait for Metro bundler
sleep 10
# Install and launch app
adb install -r apps/example/android/app/build/outputs/apk/debug/app-debug.apk
adb shell monkey -p com.microsoft.reacttestapp 1
# Run tests
cd packages/skia && CI=true yarn e2e --testPathIgnorePatterns Paragraphs
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v6.0.0
if: failure()
with:
path: packages/skia/src/__tests__/snapshots/
name: tests-snapshots-screenshots
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v6.0.0
if: failure()
with:
path: apps/docs/static/
name: tests-docs-screenshots
build-test-ios:
runs-on: macos-latest-xlarge
env:
TURBO_CACHE_DIR: .turbo/ios
steps:
- name: Checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.0
with:
submodules: recursive
- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache turborepo for iOS
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-ios-
- name: Check turborepo cache for iOS
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi
- name: Install CocoaPods
working-directory: apps/example/ios
run: pod install
- name: Start Package Manager
working-directory: apps/example
run: E2E=true yarn start &
- name: Build example for iOS
working-directory: apps/example
run: yarn ios --simulator 'iPhone 16 Pro'
- name: Run e2e tests
working-directory: packages/skia
run: CI=true yarn e2e
build-test-macos:
runs-on: macos-latest
env:
TURBO_CACHE_DIR: .turbo/macos
steps:
- name: Checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.0
with:
submodules: recursive
- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache turborepo for macOS
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-macos-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-macos-
- name: Build example for macOS
run: yarn turbo run build:macos --concurrency 1
# build-test-macos-catalyst:
# runs-on: macos-latest
# steps:
# - name: Checkout
# uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.0
# with:
# submodules: recursive
# - name: Setup
# uses: ./.github/actions/setup
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# - name: Install CocoaPods and enable Catalyst
# working-directory: apps/example
# run: yarn pod:install:catalyst
# - name: Build example for macOS Catalyst
# working-directory: apps/example/ios
# run: xcodebuild -workspace example.xcworkspace -scheme ReactTestApp -destination 'platform=macOS,arch=arm64,variant=Mac Catalyst' -configuration Debug build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO