Skip to content

Commit 0064149

Browse files
committed
Bundle, build and run iOS test app in separate steps in production
1 parent bfd07ee commit 0064149

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

0 commit comments

Comments
 (0)