@@ -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,47 @@ 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
154+ # The following makes subsequent "open -a Simulator" calls work
155+ - name : Invoke the simulator
156+ run : open -a ${{ env.DEVELOPER_DIR }}/Contents/Developer/Applications/Simulator.app
157+ - name : Boot the simulator
158+ run : |
159+ xcrun simctl boot '${{ env.IOS_DEVICE_NAME }}'
160+ SIMULATOR_UDID=`xcrun simctl list devices booted --json | jq -r '.devices[][] | select(.name == "${{ env.IOS_DEVICE_NAME }}").udid'`
161+ echo "Simulator booted with UDID = $SIMULATOR_UDID"
162+ echo "SIMULATOR_UDID=$SIMULATOR_UDID" >> $GITHUB_ENV
160163 - run : npm ci
161164 - run : npm run bootstrap
162165 env :
163166 CMAKE_RN_TRIPLETS : arm64;x86_64-apple-ios-sim
164167 FERRIC_TARGETS : aarch64-apple-ios-sim
168+ # Because the Xcode project injects its own CCACHE_CONFIGPATH,
169+ # the configuration set by the ccache action doesn't propagate.
170+ - name : Expose Ccache config to Xcode
171+ run : |
172+ echo "CCACHE_DIR=`ccache --get-config cache_dir`" >> $GITHUB_ENV
173+ echo "CCACHE_MAXSIZE=`ccache --get-config max_size`" >> $GITHUB_ENV
174+ echo "CCACHE_COMPILERCHECK=`ccache --get-config compiler_check`" >> $GITHUB_ENV
165175 - run : npm run pod-install
166176 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
177+ env :
178+ USE_CCACHE : 1
179+ - name : Bundle test app
180+ run : npx react-native bundle --entry-file index.js --platform ios --dev false --minify false --bundle-output dist/main.ios.jsbundle --assets-dest dist/res
181+ working-directory : apps/test-app
182+ - name : Build test app
183+ run : xcodebuild archive -workspace ReactTestApp.xcworkspace -configuration Release -scheme ReactTestApp -destination generic/platform="iOS" -archivePath ./build/test-app.xcarchive | xcbeautify
184+ working-directory : apps/test-app/ios
185+ - name : Run test app
186+ run : |
187+ # Install the app
188+ xcrun simctl install $SIMULATOR_UDID ./ios/build/test-app.xcarchive/Products/Applications/ReactTestApp.app
189+ # Run Mocha Remote wrapping the launch of the app
190+ npx mocha-remote --exit-on-error -- xcrun simctl launch --terminate-running-process --console-pty $SIMULATOR_UDID com.microsoft.ReactTestApp
171191 working-directory : apps/test-app
192+ env :
193+ MOCHA_REMOTE_CONTEXT : allTests
172194 test-macos :
173195 # Disabling this on main for now, as initializing the template takes a long time and
174196 # we don't have macOS-specific code yet
0 commit comments