-
Notifications
You must be signed in to change notification settings - Fork 64
154 lines (135 loc) · 5.27 KB
/
Copy pathci.yml
File metadata and controls
154 lines (135 loc) · 5.27 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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
types:
- checks_requested
workflow_dispatch:
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
with:
clean: true
- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# `git clean` (checkout clean: true) wipes node_modules/Pods/build so the
# native side rebuilds fresh, but Metro's Haste/transform cache lives
# outside the repo (in $TMPDIR) and survives between runs. After a
# reanimated/worklets bump that stale cache serves JS built by the old
# Babel transform, which shows up as "mismatch between native worklet
# version and JS one". Clear it so the freshly-installed worklets aren't
# shadowed by stale transforms.
- name: Reset React Native caches
run: |
watchman watch-del-all 2>/dev/null || true
TMP="$(node -e 'console.log(require("os").tmpdir())')"
rm -rf "$TMP"/metro-* "$TMP"/haste-map-* 2>/dev/null || true
rm -rf /tmp/metro-* /tmp/haste-map-* 2>/dev/null || true
- name: Lint files
run: yarn lint
- name: Typecheck files
run: yarn tsc
- name: Install CocoaPods
working-directory: apps/example/ios
run: pod install
- name: Ensure Metro port is free
run: |
lsof -ti :8081 | xargs -r kill -9 || true
- name: Start Package Manager
working-directory: apps/example
# --reset-cache: force Metro to re-transform from the freshly-installed
# node_modules instead of reusing the cache that survives `git clean`.
# This is the key guard against the native/JS worklet version mismatch.
run: CI=true yarn start --reset-cache &
- name: Build example for iOS
working-directory: apps/example/ios
run: |
set -o pipefail && xcodebuild \
-workspace example.xcworkspace \
-scheme Example \
-configuration Debug \
-sdk iphonesimulator \
-destination "generic/platform=iOS Simulator" \
-derivedDataPath build \
COMPILER_INDEX_STORE_ENABLE=NO \
DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING=YES \
-disableAutomaticPackageResolution \
build | xcpretty
- name: Boot iPhone Simulator
run: |
if xcrun simctl list devices booted | grep -q "iPhone"; then
echo "Simulator already booted"
else
DEVICE_UDID=$(xcrun simctl list devices available -j | python3 -c "
import json, sys
data = json.load(sys.stdin)
for runtime, devices in data['devices'].items():
if 'iOS' in runtime:
for d in devices:
if 'iPhone' in d['name'] and d['isAvailable']:
print(d['udid'])
sys.exit(0)
sys.exit(1)
")
echo "Booting simulator $DEVICE_UDID"
xcrun simctl boot "$DEVICE_UDID"
xcrun simctl bootstatus "$DEVICE_UDID" -b
fi
- name: Install and launch app on Simulator
run: |
# Remove any previous build so a stale binary never lingers on the
# persistent self-hosted simulator.
xcrun simctl uninstall booted com.microsoft.ReactTestApp || true
xcrun simctl install booted apps/example/ios/build/Build/Products/Debug-iphonesimulator/ReactTestApp.app
xcrun simctl launch booted com.microsoft.ReactTestApp
- name: Run e2e tests
working-directory: packages/webgpu
run: yarn test
- name: Detect ANDROID_HOME
run: |
if [ -n "$ANDROID_HOME" ] && [ -d "$ANDROID_HOME" ]; then
echo "ANDROID_HOME already set: $ANDROID_HOME"
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV
else
for candidate in \
"$HOME/android-sdk" \
"$HOME/Library/Android/sdk" \
"/usr/local/share/android-commandlinetools" \
"/opt/android/sdk"; do
if [ -d "$candidate" ]; then
echo "ANDROID_HOME=$candidate" >> $GITHUB_ENV
echo "Found ANDROID_HOME: $candidate"
break
fi
done
fi
- 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=${{ steps.setup-ndk.outputs.ndk-path }}" >> $GITHUB_ENV
- name: Finalize Android SDK
run: |
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: Build example for Android
working-directory: apps/example/android
env:
JAVA_OPTS: "-XX:MaxHeapSize=6g"
run: ./gradlew assembleDebug --build-cache --warning-mode all