-
Notifications
You must be signed in to change notification settings - Fork 60
142 lines (124 loc) · 4.42 KB
/
ci.yml
File metadata and controls
142 lines (124 loc) · 4.42 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
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: false
- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Lint files
run: yarn lint
- name: Typecheck files
run: yarn tsc
- name: Install CocoaPods
working-directory: apps/example/ios
run: |
HASH_FILE="/tmp/.podfile-lock-hash"
CURRENT_HASH=$(shasum Podfile.lock | cut -d' ' -f1)
if [ -f "$HASH_FILE" ] && [ "$(cat "$HASH_FILE")" = "$CURRENT_HASH" ] && [ -d "Pods" ]; then
echo "Podfile.lock unchanged and Pods exists — skipping pod install"
else
pod install
echo "$CURRENT_HASH" > "$HASH_FILE"
fi
- name: Ensure Metro port is free
run: |
lsof -ti :8081 | xargs -r kill -9 || true
- name: Start Package Manager
working-directory: apps/example
run: CI=true yarn start &
- 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: |
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