Skip to content

Commit 5cd0c51

Browse files
authored
Fix watchFolders when building MacOS app on CI (#356)
* Run MacOS debug builds on CI * Upload node-addon-examples * Print watchFolders * Bundle, build and run app separately * Use project root instead of empty watch folders to detect macos
1 parent ea26287 commit 5cd0c51

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.github/workflows/check.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ jobs:
151151
- name: Run tests (iOS)
152152
run: npm run test:ios:allTests
153153
# TODO: Enable release mode when it works
154-
# run: npm run test:ios -- --mode Release
154+
# run: npm run test:ios:allTests -- --mode Release
155155
working-directory: apps/test-app
156156
test-macos:
157157
# Disabling this on main for now, as initializing the template takes a long time and
@@ -187,9 +187,17 @@ jobs:
187187
- run: npm run init-macos-test-app
188188
- run: pod install --project-directory=macos
189189
working-directory: apps/macos-test-app
190-
- name: Run MacOS test app
191-
run: npm run test:allTests -- --mode Release
190+
- name: Bundle test app
191+
run: npx react-native bundle --entry-file index.js --platform macos --dev false --minify false --bundle-output dist/main.macos.jsbundle --assets-dest dist/res
192192
working-directory: apps/macos-test-app
193+
- name: Build test app
194+
run: xcodebuild archive -workspace MacOSTestApp.xcworkspace -configuration Release -scheme MacOSTestApp-macOS -destination generic/platform="macOS" -archivePath ./build/macos-test-app.xcarchive | xcbeautify
195+
working-directory: apps/macos-test-app/macos
196+
- name: Run test app
197+
run: npx mocha-remote --exit-on-error -- macos/build/macos-test-app.xcarchive/Products/Applications/MacOSTestApp.app/Contents/MacOS/MacOSTestApp
198+
working-directory: apps/macos-test-app
199+
env:
200+
MOCHA_REMOTE_CONTEXT: allTests
193201
test-android:
194202
if: github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Android 🤖')
195203
name: Test app (Android)

apps/test-app/metro.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const config = makeMetroConfig({
1111
},
1212
});
1313

14-
if (config.watchFolders.length === 0) {
14+
if (config.projectRoot.endsWith("macos-test-app")) {
1515
// This patch is needed to locate packages in the monorepo from the MacOS app
1616
// which is intentionally kept outside of the workspaces configuration to prevent
1717
// duplicate react-native version and pollution of the package lock.

0 commit comments

Comments
 (0)