1010 types :
1111 - checks_requested
1212 workflow_dispatch :
13- inputs :
14- build_android :
15- description : ' Build for Android'
16- type : boolean
17- default : false
18- build_ios :
19- description : ' Build for iOS'
20- type : boolean
21- default : false
22- build_macos :
23- description : ' Build for macOS'
24- type : boolean
25- default : false
26- run_reference_tests :
27- description : ' Run reference tests'
28- type : boolean
29- default : false
3013
3114concurrency :
32- group : ${{ github.ref }}
15+ group : ci- ${{ github.event.pull_request.number || github.ref }}
3316 cancel-in-progress : true
3417
3518jobs :
3619 build :
37- runs-on : ubuntu-latest
20+ runs-on : self-hosted
3821 steps :
3922 - name : Checkout
4023 uses : actions/checkout@v4
@@ -44,290 +27,44 @@ jobs:
4427 with :
4528 github_token : ${{ secrets.GITHUB_TOKEN }}
4629
47- - name : Clang Format
48- working-directory : packages/webgpu
49- run : yarn clang-format
50-
5130 - name : Lint files
5231 run : yarn lint
5332
5433 - name : Typecheck files
5534 run : yarn tsc
5635
57- - name : Build
58- working-directory : packages/webgpu
59- run : yarn build
60-
61- - name : Package
62- working-directory : packages/webgpu
63- run : yarn pack
64-
65- - name : Upload package artifact
66- uses : actions/upload-artifact@v4
67- with :
68- name : package
69- path : packages/webgpu/package.tgz
70- compression-level : 0
71-
72- reference-tests :
73- if : github.event_name == 'workflow_dispatch' && github.event.inputs.run_reference_tests == 'true'
74- runs-on : macos-latest
75- steps :
76- - name : Checkout
77- uses : actions/checkout@v4
78-
79- - name : Setup
80- uses : ./.github/actions/setup
81- with :
82- github_token : ${{ secrets.GITHUB_TOKEN }}
83-
84- - name : Install Chrome
85- run : npx puppeteer browsers install chrome
86-
87- - name : Run reference test suite
88- working-directory : packages/webgpu
89- run : yarn test:ref
90-
91- build-android :
92- if : github.event_name == 'workflow_dispatch' && github.event.inputs.build_android == 'true'
93- runs-on : ubuntu-latest
94- env :
95- TURBO_CACHE_DIR : .turbo/android
96- steps :
97- - name : Checkout
98- uses : actions/checkout@v4
99-
100- - name : Setup
101- uses : ./.github/actions/setup
102- with :
103- github_token : ${{ secrets.GITHUB_TOKEN }}
104-
105- - name : Free disk space
106- uses : jlumbroso/free-disk-space@main
107- with :
108- tool-cache : false
109- android : false
110- dotnet : true
111- haskell : true
112- large-packages : true
113- docker-images : true
114- swap-storage : true
115-
116- - name : Cache turborepo for Android
117- uses : actions/cache@v4
118- with :
119- path : ${{ env.TURBO_CACHE_DIR }}
120- key : ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
121- restore-keys : |
122- ${{ runner.os }}-turborepo-android
123-
124- - name : Install JDK
125- uses : actions/setup-java@v3
126- with :
127- distribution : ' zulu'
128- java-version : ' 17'
129-
130- - name : Install NDK
131- uses : nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 # v1.5.0
132- id : setup-ndk
133- with :
134- ndk-version : r27d
135-
136- - name : Set ANDROID_NDK
137- run : echo "ANDROID_NDK=$ANDROID_HOME/ndk-bundle" >> $GITHUB_ENV
138-
139- - name : Finalize Android SDK
140- run : |
141- /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
142-
143- - name : Install Android SDK
144- run : echo "sdk.dir=$ANDROID_HOME" > $GITHUB_WORKSPACE/apps/example/android/local.properties
145-
146- - name : Cache Gradle
147- uses : actions/cache@v4
148- with :
149- path : |
150- ~/.gradle/wrapper
151- ~/.gradle/caches
152- key : ${{ runner.os }}-gradle-${{ hashFiles('./apps/example/android/gradle/wrapper/gradle-wrapper.properties') }}
153- restore-keys : |
154- ${{ runner.os }}-gradle-
155-
156- - name : Build example for Android
157- env :
158- JAVA_OPTS : " -XX:MaxHeapSize=6g"
159- run : |
160- yarn turbo run build:android --concurrency 1
161-
162- - name : Cache apk
163- uses : actions/cache/save@v4
164- env :
165- cache-name : cache-apk
166- with :
167- path : apps/example/android/app/build/outputs/apk/debug/app-debug.apk
168- key : apk-${{ github.sha }}
169-
170- - name : Upload Android APK artifact
171- uses : actions/upload-artifact@v4
172- with :
173- name : android-example-apk
174- path : apps/example/android/app/build/outputs/apk/debug/app-debug.apk
175-
176- test-android :
177- if : github.event_name == 'workflow_dispatch' && github.event.inputs.build_android == 'true'
178- needs : build-android
179- runs-on : ubuntu-latest
180- timeout-minutes : 60
181- env :
182- TURBO_CACHE_DIR : .turbo/android
183- steps :
184- - name : Checkout
185- uses : actions/checkout@v4
186-
187- - name : Setup
188- uses : ./.github/actions/setup
189- with :
190- github_token : ${{ secrets.GITHUB_TOKEN }}
191-
192- - name : Setup Android SDK
193- uses : android-actions/setup-android@v3
194-
195- - name : Install Android SDK tools
196- run : |
197- echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV
198- echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> $GITHUB_PATH
199- echo "$ANDROID_HOME/platform-tools" >> $GITHUB_PATH
200- echo "$ANDROID_HOME/emulator" >> $GITHUB_PATH
201-
202- - name : Enable KVM group perms
203- run : |
204- echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
205- sudo udevadm control --reload-rules
206- sudo udevadm trigger --name-match=kvm
207-
208- - name : Restore APK
209- id : cache-apk
210- uses : actions/cache/restore@v4
211- with :
212- path : apps/example/android/app/build/outputs/apk/debug/app-debug.apk
213- key : apk-${{ github.sha }}
214-
215- - name : Start Package Manager
216- working-directory : apps/example
217- run : E2E=true yarn start &
218-
219- - name : Run Android Emulator Tests
220- uses : reactivecircus/android-emulator-runner@v2
221- with :
222- api-level : 30
223- arch : x86_64
224- profile : Nexus 5X
225- force-avd-creation : true
226- emulator-options : -no-snapshot-save -no-window -gpu swangle_indirect -noaudio -no-boot-anim
227- disable-animations : true
228- script : |
229- # Wait for Metro bundler
230- sleep 10
231-
232- # Install and launch app
233- adb install -r apps/example/android/app/build/outputs/apk/debug/app-debug.apk
234- adb shell monkey -p com.microsoft.reacttestapp 1
235-
236- # Run tests
237- cd packages/webgpu && CI=true yarn test
238-
239- - name : Upload test snapshots on failure
240- uses : actions/upload-artifact@v4
241- if : failure()
242- with :
243- path : packages/webgpu/src/__tests__/snapshots/
244- name : tests-snapshots-android
245-
246- build-test-ios :
247- if : github.event_name == 'workflow_dispatch' && github.event.inputs.build_ios == 'true'
248- runs-on : macos-latest
249- env :
250- TURBO_CACHE_DIR : .turbo/ios
251- steps :
252- - name : Checkout
253- uses : actions/checkout@v4
254-
255- - name : Setup
256- uses : ./.github/actions/setup
257- with :
258- github_token : ${{ secrets.GITHUB_TOKEN }}
259-
260- - name : Cache turborepo for iOS
261- uses : actions/cache@v4
262- with :
263- path : ${{ env.TURBO_CACHE_DIR }}
264- key : ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
265- restore-keys : |
266- ${{ runner.os }}-turborepo-ios-
267-
268- - name : Check turborepo cache for iOS
269- run : |
270- 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")
271-
272- if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
273- echo "turbo_cache_hit=1" >> $GITHUB_ENV
274- fi
275-
27636 - name : Install CocoaPods
27737 working-directory : apps/example/ios
27838 run : pod install
27939
40+ - name : Ensure Metro port is free
41+ run : |
42+ lsof -ti :8081 | xargs -r kill -9 || true
43+
28044 - name : Start Package Manager
28145 working-directory : apps/example
282- run : E2E =true yarn start &
46+ run : CI =true yarn start &
28347
28448 - name : Build example for iOS
285- working-directory : apps/example
286- run : yarn ios --simulator 'iPhone 16 Pro'
49+ working-directory : apps/example/ios
50+ run : |
51+ set -o pipefail && xcodebuild \
52+ -workspace example.xcworkspace \
53+ -scheme Example \
54+ -configuration Debug \
55+ -sdk iphonesimulator \
56+ -destination "generic/platform=iOS Simulator" \
57+ -derivedDataPath build \
58+ COMPILER_INDEX_STORE_ENABLE=NO \
59+ DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING=YES \
60+ -disableAutomaticPackageResolution \
61+ build | xcpretty
62+
63+ - name : Install and launch app on Simulator
64+ run : |
65+ xcrun simctl install booted apps/example/ios/build/Build/Products/Debug-iphonesimulator/ReactTestApp.app
66+ xcrun simctl launch booted com.microsoft.ReactTestApp
28767
28868 - name : Run e2e tests
28969 working-directory : packages/webgpu
290- run : CI=true E2E=true yarn test
291-
292- - name : Upload test snapshots on failure
293- uses : actions/upload-artifact@v4
294- if : failure()
295- with :
296- path : packages/webgpu/src/__tests__/snapshots/
297- name : tests-snapshots-ios
298-
299- # Note: This job is disabled by default until RNTA supports 0.81
300- # Enable it manually via workflow_dispatch when needed
301- build-macos :
302- if : github.event_name == 'workflow_dispatch' && github.event.inputs.build_macos == 'true'
303- runs-on : macos-latest
304- env :
305- TURBO_CACHE_DIR : .turbo/macos
306- steps :
307- - name : Checkout
308- uses : actions/checkout@v4
309-
310- - name : Setup
311- uses : ./.github/actions/setup
312- with :
313- github_token : ${{ secrets.GITHUB_TOKEN }}
314-
315- - name : Cache turborepo for macOS
316- uses : actions/cache@v4
317- with :
318- path : ${{ env.TURBO_CACHE_DIR }}
319- key : ${{ runner.os }}-turborepo-macos-${{ hashFiles('yarn.lock') }}
320- restore-keys : |
321- ${{ runner.os }}-turborepo-macos-
322-
323- - name : Check turborepo cache for macOS
324- run : |
325- TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:macos --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:macos').cache.status")
326-
327- if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
328- echo "turbo_cache_hit=1" >> $GITHUB_ENV
329- fi
330-
331- - name : Build example for macOS
332- run : |
333- yarn turbo run build:macos --cache-dir="${{ env.TURBO_CACHE_DIR }}"
70+ run : yarn test
0 commit comments