@@ -197,19 +197,21 @@ jobs:
197197 xcrun simctl shutdown "$IOS_SIMULATOR_UDID" || true
198198 fi
199199
200- # Decides whether build-spm-ios runs. That job only proves that
200+ # Decides whether the SwiftPM and native macOS builds run. SwiftPM proves that
201201 # packages/webgpu/Package.swift resolves and compiles, so a pull request
202202 # pays for it only when its diff touches what can change the outcome: the
203203 # manifest and the autolinking config, the Apple and C++ sources it
204204 # compiles, the scripts behind the Dawn check, the dependencies that pin
205205 # react-native-webgpu-dawn, the example that links it, or CI itself. Pushes
206- # to main, the merge queue and manual runs build unconditionally, so a
207- # change this list misses still shows up on main.
208- spm-changes :
206+ # to main, the merge queue and manual runs always build SwiftPM. macOS builds
207+ # on main, manual runs and relevant PRs; shared JavaScript is checked by
208+ # bundle-macos on every PR.
209+ changes :
209210 runs-on : ubuntu-latest
210211 timeout-minutes : 5
211212 outputs :
212- run : ${{ steps.diff.outputs.run }}
213+ spm : ${{ steps.diff.outputs.spm }}
214+ macos : ${{ steps.diff.outputs.macos }}
213215 steps :
214216 - name : Checkout
215217 if : github.event_name == 'pull_request'
@@ -225,24 +227,68 @@ jobs:
225227 BASE : ${{ github.event.pull_request.base.sha }}
226228 run : |
227229 if [ "$EVENT" != "pull_request" ]; then
228- echo "run=true" >> "$GITHUB_OUTPUT"
230+ echo "spm=true" >> "$GITHUB_OUTPUT"
231+ echo "macos=true" >> "$GITHUB_OUTPUT"
229232 exit 0
230233 fi
231234 git fetch --depth=1 origin "$BASE"
232235 changed=$(git diff --name-only "$BASE" HEAD)
233- run=false
236+ spm=false
237+ macos=false
234238 while IFS= read -r file; do
235239 case "$file" in
236240 packages/webgpu/Package.swift|packages/webgpu/package.json|packages/webgpu/react-native.config.js|\
237241 packages/webgpu/apple/*|packages/webgpu/cpp/*|packages/webgpu/scripts/*|\
238242 spm-example/*|package.json|yarn.lock|\
239243 .github/workflows/ci.yml|.github/actions/setup/*)
240244 echo "$file"
241- run=true
245+ spm=true
246+ ;;
247+ esac
248+ case "$file" in
249+ apps/example-macos/*|packages/webgpu/*.podspec|packages/webgpu/package.json|\
250+ packages/webgpu/react-native.config.js|packages/webgpu/apple/*|packages/webgpu/cpp/*|\
251+ packages/webgpu/scripts/*|package.json|yarn.lock|.yarn/patches/*|turbo.json|\
252+ .github/workflows/ci.yml|.github/actions/setup/*)
253+ echo "macos: $file"
254+ macos=true
242255 ;;
243256 esac
244257 done <<< "$changed"
245- echo "run=$run" >> "$GITHUB_OUTPUT"
258+ echo "spm=$spm" >> "$GITHUB_OUTPUT"
259+ echo "macos=$macos" >> "$GITHUB_OUTPUT"
260+
261+ # Bundle shared sources on every PR without reserving a Mac. Native builds
262+ # alone do not exercise Metro or the desktop Worklets/Babel configuration.
263+ bundle-macos :
264+ runs-on : ubuntu-latest
265+ timeout-minutes : 15
266+ steps :
267+ - name : Checkout
268+ uses : actions/checkout@v4
269+ - name : Setup
270+ uses : ./.github/actions/setup
271+ with :
272+ github_token : ${{ secrets.GITHUB_TOKEN }}
273+ - name : Bundle macOS example
274+ run : yarn workspace example-macos bundle:macos
275+
276+ # Match Skia's macOS check: shared JS is bundled above; relevant native,
277+ # dependency or runner changes also build the CocoaPods app on a hosted Mac.
278+ build-test-macos :
279+ needs : changes
280+ if : needs.changes.outputs.macos == 'true' && (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main'))
281+ runs-on : macos-latest
282+ timeout-minutes : 60
283+ steps :
284+ - name : Checkout
285+ uses : actions/checkout@v4
286+ - name : Setup
287+ uses : ./.github/actions/setup
288+ with :
289+ github_token : ${{ secrets.GITHUB_TOKEN }}
290+ - name : Build macOS example
291+ run : yarn turbo run build:macos --concurrency 1
246292
247293 # The SwiftPM example gets its own job on a GitHub-hosted Mac. It needs no
248294 # Metro, simulator or CocoaPods, so nothing ties it to the self-hosted
@@ -251,8 +297,8 @@ jobs:
251297 # It used to be a step of `build`: a hung xcodebuild there blocked the iOS
252298 # e2e result and held the self-hosted runner, which has no slack for that.
253299 build-spm-ios :
254- needs : spm- changes
255- if : needs.spm- changes.outputs.run == 'true'
300+ needs : changes
301+ if : needs.changes.outputs.spm == 'true'
256302 runs-on : macos-latest
257303 # Cold run: yarn install, Dawn download, RN artifacts, then one xcodebuild.
258304 timeout-minutes : 25
0 commit comments