Skip to content

Commit c4faa43

Browse files
authored
fix(🐙): enhance CI workflow with cache reset steps (#373)
1 parent 4a8ab72 commit c4faa43

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ jobs:
2929
with:
3030
github_token: ${{ secrets.GITHUB_TOKEN }}
3131

32+
# `git clean` (checkout clean: true) wipes node_modules/Pods/build so the
33+
# native side rebuilds fresh, but Metro's Haste/transform cache lives
34+
# outside the repo (in $TMPDIR) and survives between runs. After a
35+
# reanimated/worklets bump that stale cache serves JS built by the old
36+
# Babel transform, which shows up as "mismatch between native worklet
37+
# version and JS one". Clear it so the freshly-installed worklets aren't
38+
# shadowed by stale transforms.
39+
- name: Reset React Native caches
40+
run: |
41+
watchman watch-del-all 2>/dev/null || true
42+
TMP="$(node -e 'console.log(require("os").tmpdir())')"
43+
rm -rf "$TMP"/metro-* "$TMP"/haste-map-* 2>/dev/null || true
44+
rm -rf /tmp/metro-* /tmp/haste-map-* 2>/dev/null || true
45+
3246
- name: Lint files
3347
run: yarn lint
3448

@@ -45,7 +59,10 @@ jobs:
4559
4660
- name: Start Package Manager
4761
working-directory: apps/example
48-
run: CI=true yarn start &
62+
# --reset-cache: force Metro to re-transform from the freshly-installed
63+
# node_modules instead of reusing the cache that survives `git clean`.
64+
# This is the key guard against the native/JS worklet version mismatch.
65+
run: CI=true yarn start --reset-cache &
4966

5067
- name: Build example for iOS
5168
working-directory: apps/example/ios
@@ -85,6 +102,9 @@ jobs:
85102
86103
- name: Install and launch app on Simulator
87104
run: |
105+
# Remove any previous build so a stale binary never lingers on the
106+
# persistent self-hosted simulator.
107+
xcrun simctl uninstall booted com.microsoft.ReactTestApp || true
88108
xcrun simctl install booted apps/example/ios/build/Build/Products/Debug-iphonesimulator/ReactTestApp.app
89109
xcrun simctl launch booted com.microsoft.ReactTestApp
90110

0 commit comments

Comments
 (0)