Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Build macOS

on:
push:
branches:
- main
paths:
- ".github/workflows/build-macos.yml"
- "example/macos/**"
- "example/src/**"
- "example/app.json"
- "example/index.js"
- "example/babel.config*.js"
- "packages/react-native-nitro-sqlite/**"
- "packages/react-native-nitro-sqlite-vec/**"
- "patches/**"
- "**/Podfile.lock"
- "**/Gemfile.lock"
- "**/bun.lock"
- "**/package.json"
- "**/react-native.config.js"
- "**/nitro.json"
pull_request:
paths:
- ".github/workflows/build-macos.yml"
- "example/macos/**"
- "example/src/**"
- "example/app.json"
- "example/index.js"
- "example/babel.config*.js"
- "packages/react-native-nitro-sqlite/**"
- "packages/react-native-nitro-sqlite-vec/**"
- "patches/**"
- "**/Podfile.lock"
- "**/Gemfile.lock"
- "**/bun.lock"
- "**/package.json"
- "**/react-native.config.js"
- "**/nitro.json"

env:
USE_CCACHE: 1

jobs:
build:
name: Build macOS Example App
runs-on: macos-26
steps:
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2

- name: Install npm dependencies (bun)
run: bun install

- name: Install Ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
max-size: 1.5G
key: ${{ runner.os }}-ccache-example-macos
create-symlink: true
- name: Setup ccache behavior
run: |
{
echo "CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros"
echo "CCACHE_FILECLONE=true"
echo "CCACHE_DEPEND=true"
echo "CCACHE_INODECACHE=true"
} >> "$GITHUB_ENV"

- name: Setup Ruby (bundle)
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.0
bundler-cache: true
working-directory: example

- name: Select Xcode 26.5
run: sudo xcode-select -s "/Applications/Xcode_26.5.app/Contents/Developer"

- name: Restore Pods cache
uses: actions/cache@v6
with:
path: example/macos/Pods
key: ${{ runner.os }}-pods-macos-${{ hashFiles('example/macos/Podfile.lock', 'example/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-macos-
- name: Clean generated macOS codegen
run: rm -rf example/macos/build/generated
- name: Install Pods
run: bun --cwd example pods:macos

- name: Restore DerivedData cache
uses: actions/cache@v6
with:
path: example/macos/build/DerivedData
key: ${{ runner.os }}-dd-macos-${{ hashFiles('example/macos/Podfile.lock', 'example/Gemfile.lock', '**/package.json', '**/bun.lock') }}-xcode26.5
restore-keys: |
${{ runner.os }}-dd-macos-${{ hashFiles('example/macos/Podfile.lock', 'example/Gemfile.lock', '**/package.json', '**/bun.lock') }}-xcode26.5

- name: Build App
working-directory: example/macos
run: |
set -o pipefail
xcodebuild \
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
-derivedDataPath build/DerivedData -UseModernBuildSystem=YES \
-workspace NitroSQLiteExample.xcworkspace \
-scheme NitroSQLiteExample-macOS \
-configuration Debug \
-destination 'platform=macOS,arch=arm64' \
-showBuildTimingSummary \
ONLY_ACTIVE_ARCH=YES \
build \
CODE_SIGNING_ALLOWED=NO | xcbeautify --renderer github-actions
68 changes: 68 additions & 0 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Test macOS

on:
workflow_dispatch:
pull_request:
paths:
- ".github/workflows/test-macos.yml"
- "example/macos/**"
- "example/src/**"
- "example/tests/**"
- "example/app.json"
- "example/index.js"
- "example/babel.config*.js"
- "packages/react-native-nitro-sqlite/**"
- "packages/react-native-nitro-sqlite-vec/**"
- "patches/**"
- "**/Podfile.lock"
- "**/Gemfile.lock"
- "**/bun.lock"
- "**/package.json"
- "**/react-native.config.js"
- "**/nitro.json"

jobs:
test:
name: macOS Integration Tests
runs-on: macos-26

steps:
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2

- name: Install dependencies (bun)
run: bun install

- name: Test desktop runner failure handling
run: node --test example/macos/scripts/test-macos.test.mjs

- name: Setup Ruby (bundle)
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.0
bundler-cache: true
working-directory: example

- name: Select Xcode 26.5
run: sudo xcode-select -s "/Applications/Xcode_26.5.app/Contents/Developer"

- name: Install Pods
run: bun --cwd example pods:macos

- name: Build debug app
working-directory: example/macos
run: |
set -euo pipefail
xcodebuild \
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
-derivedDataPath build -UseModernBuildSystem=YES \
-workspace NitroSQLiteExample.xcworkspace \
-scheme NitroSQLiteExample-macOS \
-configuration Debug \
-destination 'platform=macOS,arch=arm64' \
build \
CODE_SIGNING_ALLOWED=NO

- name: Run macOS integration tests
working-directory: example/macos
run: bun run test
12 changes: 11 additions & 1 deletion example/macos/NitroSQLiteExample-macOS/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ @implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
self.moduleName = @"NitroSQLiteExample";
self.initialProps = @{};
NSString *testReportURL = NSProcessInfo.processInfo.environment[@"NITRO_SQLITE_TEST_REPORT_URL"];
self.initialProps = testReportURL.length > 0 ? @{ @"macosTestReportUrl" : testReportURL } : @{};
self.dependencyProvider = [RCTAppDependencyProvider new];

return [super applicationDidFinishLaunching:notification];
Expand All @@ -22,6 +23,15 @@ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
- (NSURL *)bundleURL
{
#if DEBUG
NSString *testMetroPort = NSProcessInfo.processInfo.environment[@"NITRO_SQLITE_TEST_METRO_PORT"];
if (testMetroPort.length > 0) {
return [RCTBundleURLProvider jsBundleURLForBundleRoot:@"index"
packagerHost:[NSString stringWithFormat:@"127.0.0.1:%@", testMetroPort]
enableDev:YES
enableMinification:NO
inlineSourceMap:NO];
}

return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
Expand Down
4 changes: 2 additions & 2 deletions example/macos/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '../src/initGlobals.macos'
import { AppRegistry } from 'react-native'
import App from '../src/App'
import MacOSApp from '../src/MacOSApp'
import { name as appName } from '../app.json'

AppRegistry.registerComponent(appName, () => App)
AppRegistry.registerComponent(appName, () => MacOSApp)
3 changes: 2 additions & 1 deletion example/macos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"private": true,
"scripts": {
"macos": "node scripts/react-native-macos.js run-macos --project-path .",
"start": "node scripts/react-native-macos.js start"
"start": "node scripts/react-native-macos.js start",
"test": "node scripts/test-macos.mjs"
},
"dependencies": {
"@react-native-clipboard/clipboard": "^1.16.3",
Expand Down
Loading
Loading