Skip to content

Commit bbcf372

Browse files
committed
Bundle, build and run iOS test app in separate steps in production
1 parent 81e91b9 commit bbcf372

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

.github/workflows/check.yml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ jobs:
133133
if: github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Apple 🍎')
134134
name: Test app (iOS)
135135
runs-on: macos-latest
136+
env:
137+
DEVELOPER_DIR: /Applications/Xcode_26.2.app
138+
IOS_DEVICE_NAME: iPhone 16
136139
steps:
137140
- uses: actions/checkout@v4
138141
- uses: actions/setup-node@v6
@@ -146,28 +149,38 @@ jobs:
146149
uses: hendrikmuhs/ccache-action@v1.2
147150
with:
148151
key: ${{ github.job }}-${{ runner.os }}
149-
- name: Set up JDK 17
150-
uses: actions/setup-java@v3
151-
with:
152-
java-version: "17"
153-
distribution: "temurin"
154-
- name: Setup Android SDK
155-
uses: android-actions/setup-android@v3
156-
with:
157-
packages: tools platform-tools ndk;${{ env.NDK_VERSION }}
158-
- run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android aarch64-apple-ios-sim
152+
- run: rustup target add aarch64-apple-ios-sim
159153
- run: npm ci
160154
- run: npm run bootstrap
161155
env:
162156
CMAKE_RN_TRIPLETS: arm64;x86_64-apple-ios-sim
163157
FERRIC_TARGETS: aarch64-apple-ios-sim
158+
# Because the Xcode project injects its own CCACHE_CONFIGPATH,
159+
# the configuration set by the ccache action doesn't propagate.
160+
- name: Expose Ccache config to Xcode
161+
run: |
162+
echo "CCACHE_DIR=`ccache --get-config cache_dir`" >> $GITHUB_ENV
163+
echo "CCACHE_MAXSIZE=`ccache --get-config max_size`" >> $GITHUB_ENV
164+
echo "CCACHE_COMPILERCHECK=`ccache --get-config compiler_check`" >> $GITHUB_ENV
164165
- run: npm run pod-install
165166
working-directory: apps/test-app
166-
- name: Run tests (iOS)
167-
run: npm run test:ios:allTests
168-
# TODO: Enable release mode when it works
169-
# run: npm run test:ios:allTests -- --mode Release
167+
env:
168+
USE_CCACHE: 1
169+
- name: Bundle test app
170+
run: npx react-native bundle --entry-file index.ts --platform ios --dev false --minify false --bundle-output dist/main.ios.jsbundle --assets-dest dist/res
170171
working-directory: apps/test-app
172+
- name: Build test app
173+
run: xcodebuild archive -workspace ReactTestApp.xcworkspace -configuration Release -scheme ReactTestApp -destination generic/platform="iOS" -archivePath ./build/test-app.xcarchive | xcbeautify
174+
working-directory: apps/test-app/ios
175+
- name: Run test app
176+
run: |
177+
# Install the app
178+
xcrun simctl install booted ./ios/build/test-app.xcarchive/Products/Applications/ReactTestApp.app
179+
# Run Mocha Remote wrapping the launch of the app
180+
npx mocha-remote --exit-on-error -- xcrun simctl launch --terminate-running-process --console-pty booted com.microsoft.ReactTestApp
181+
working-directory: apps/test-app
182+
env:
183+
MOCHA_REMOTE_CONTEXT: allTests
171184
test-macos:
172185
# Disabling this on main for now, as initializing the template takes a long time and
173186
# we don't have macOS-specific code yet

0 commit comments

Comments
 (0)