Skip to content

Commit 6e2b314

Browse files
authored
wip: ios ci (#167)
# Why adding ci tests for ios # How create an expo managed project and run launching test like android # Test Plan ci passed
1 parent 592efd0 commit 6e2b314

File tree

2 files changed

+91
-3
lines changed

2 files changed

+91
-3
lines changed

.github/workflows/android.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@ name: E2E tests for Android
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- "*-stable"
5+
branches: [main, '*-stable']
6+
paths:
7+
- .github/workflows/android.yml
8+
- android/**
9+
- src/v8runtime/**
10+
- package.json
11+
- yarn.lock
812
pull_request:
13+
paths:
14+
- .github/workflows/android.yml
15+
- android/**
16+
- src/v8runtime/**
17+
- package.json
18+
- yarn.lock
919

1020
jobs:
1121
e2e-test:

.github/workflows/ios.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: E2E tests for iOS
2+
3+
on:
4+
push:
5+
branches: [main, '*-stable']
6+
paths:
7+
- .github/workflows/ios.yml
8+
- src/iosexecutor/**
9+
- src/v8runtime/**
10+
- package.json
11+
- yarn.lock
12+
pull_request:
13+
paths:
14+
- .github/workflows/ios.yml
15+
- src/iosexecutor/**
16+
- src/v8runtime/**
17+
- package.json
18+
- yarn.lock
19+
20+
jobs:
21+
e2e-test:
22+
runs-on: macos-latest
23+
24+
steps:
25+
- uses: actions/checkout@v2
26+
27+
- name: Restore yarn caches
28+
uses: actions/cache@v2
29+
with:
30+
path: node_modules
31+
key: ${{ runner.os }}-workspace-modules-${{ hashFiles('yarn.lock') }}
32+
33+
- name: Yarn install
34+
run: yarn install --frozen-lockfile
35+
36+
- name: Generate TestApp
37+
run: |
38+
yarn create expo-app TestApp
39+
cd TestApp
40+
yarn add v8-ios
41+
yarn add file:../react-native-v8
42+
jq '.expo.ios.bundleIdentifier = "com.testapp" | .expo.plugins += ["react-native-v8"] | .expo.jsEngine = "jsc"' app.json > app.json.tmp && mv -f app.json.tmp app.json
43+
echo 'if (global._v8runtime) { console.log(`=== V8 version[${global._v8runtime().version}] ===`); }' >> App.js
44+
working-directory: ..
45+
46+
- name: Build TestApp
47+
working-directory: ../TestApp
48+
run: |
49+
npx expo prebuild -p ios
50+
cd ios
51+
xcodebuild -workspace ./TestApp.xcworkspace -scheme TestApp -configuration Release -derivedDataPath ./build -destination 'generic/platform=iOS Simulator' build | xcpretty
52+
53+
- name: Run TestApp
54+
working-directory: ../TestApp/ios
55+
run: |
56+
SIMUDID=$(xcrun simctl list devices available -j | jq -r '.devices."com.apple.CoreSimulator.SimRuntime.iOS-16-2"[] | select(.name=="iPhone 14 Pro") | .udid')
57+
echo "Using simulator udid[${SIMUDID}]"
58+
xcrun simctl boot ${SIMUDID}
59+
xcrun simctl install booted ./build/Build/Products/Release-iphonesimulator/TestApp.app
60+
xcrun simctl spawn booted log stream --predicate 'process == "TestApp"' --level=debug > sim.log &
61+
LOG_PID=$!
62+
xcrun simctl launch booted com.testapp
63+
sleep 5
64+
kill -SIGINT $LOG_PID
65+
grep -E "=== V8 version\[.+\] ===" sim.log > /dev/null
66+
67+
- name: Collect failure files
68+
if: failure()
69+
run: |
70+
cp ../TestApp/ios/sim.log .
71+
72+
- name: Upload failed artifacts
73+
if: failure()
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: artifacts-${{ matrix.rn-version }}-${{ matrix.v8-android-variant }}
77+
path: |
78+
sim.log

0 commit comments

Comments
 (0)