diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 2fee2f5..e57b114 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -11,7 +11,7 @@ on: - "**/nitrogen/generated/android/**" - "package/cpp/**" - "package/android/**" - - "bun.lockb" + - "**/bun.lock" - "**/react-native.config.js" - "**/nitro.json" pull_request: @@ -22,21 +22,33 @@ on: - "**/nitrogen/generated/android/**" - "package/cpp/**" - "package/android/**" - - "bun.lockb" + - "**/bun.lock" - "**/react-native.config.js" - "**/nitro.json" +env: + # Build a single ABI in CI to reduce native compile time. + TARGET_ANDROID_ARCH: x86_64 + jobs: build: name: Build Android Example App runs-on: ubuntu-latest + strategy: + matrix: + min-sdk: + - "24" + - "26" steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: oven-sh/setup-bun@v2 - name: Install npm dependencies (bun) run: bun install + - name: Set minSdk in build.gradle + run: sed -i "s/minSdkVersion = 24/minSdkVersion = ${{ matrix.min-sdk }}/g" example/android/build.gradle + - name: Setup JDK 17 uses: actions/setup-java@v5 with: @@ -44,17 +56,21 @@ jobs: java-version: 17 java-package: jdk - - name: Restore Gradle cache - uses: actions/cache@v4 + - name: Restore Gradle/CMake cache + uses: actions/cache@v5 with: path: | ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + ~/.gradle/wrapper + example/android/.gradle + example/android/app/.cxx + key: ${{ runner.os }}-gradle-${{ matrix.min-sdk }}-${{ env.TARGET_ANDROID_ARCH }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/CMakeLists.txt', '**/*.cmake') }} restore-keys: | + ${{ runner.os }}-gradle-${{ matrix.min-sdk }}-${{ env.TARGET_ANDROID_ARCH }}- ${{ runner.os }}-gradle- - name: Run Gradle Build for example/android/ working-directory: example/android - run: ./gradlew assembleDebug --no-daemon --build-cache + run: ./gradlew :app:assembleDebug --no-daemon --build-cache -PreactNativeArchitectures=${{ env.TARGET_ANDROID_ARCH }} # Gradle cache doesn't like daemons - name: Stop Gradle Daemon diff --git a/.github/workflows/build-ios.yml b/.github/workflows/build-ios.yml index 0eecdad..0aedf89 100644 --- a/.github/workflows/build-ios.yml +++ b/.github/workflows/build-ios.yml @@ -34,16 +34,37 @@ env: jobs: build: name: Build iOS Example App - runs-on: macOS-15 + runs-on: macOS-26 + strategy: + matrix: + include: + - name: static_frameworks + use_frameworks: static + - name: no_frameworks + use_frameworks: "" # intentionally unset steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: oven-sh/setup-bun@v2 + - name: Set USE_FRAMEWORKS + if: matrix.use_frameworks != '' + run: echo "USE_FRAMEWORKS=${{ matrix.use_frameworks }}" >> $GITHUB_ENV + - name: Install npm dependencies (bun) run: bun install - - name: Restore ccache + - name: Install Ccache uses: hendrikmuhs/ccache-action@v1.2 + with: + max-size: 1.5G + key: ${{ runner.os }}-${{ matrix.use_frameworks }}-ccache-example-ios + 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" >> $GITHUB_ENV + echo "CCACHE_FILECLONE=true" >> $GITHUB_ENV + echo "CCACHE_DEPEND=true" >> $GITHUB_ENV + echo "CCACHE_INODECACHE=true" >> $GITHUB_ENV - name: Setup Ruby (bundle) uses: ruby/setup-ruby@v1 @@ -52,26 +73,41 @@ jobs: bundler-cache: true working-directory: example + - name: Select Xcode 26.2 + run: sudo xcode-select -s "/Applications/Xcode_26.2.app/Contents/Developer" + - name: Restore Pods cache - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: example/ios/Pods - key: pods-${{ runner.os }}-${{ hashFiles('**/Podfile.lock', '**/Gemfile.lock') }} + key: ${{ runner.os }}-${{ matrix.use_frameworks }}-pods-${{ hashFiles('**/Podfile.lock', '**/Gemfile.lock') }} restore-keys: | - pods-${{ runner.os }} - + ${{ runner.os }}-${{ matrix.use_frameworks }}-pods- - name: Install Pods - working-directory: example/ios - run: pod install + working-directory: example + run: bun pods + + - name: Restore DerivedData cache + uses: actions/cache@v5 + with: + path: example/ios/build + key: ${{ runner.os }}-${{ matrix.use_frameworks }}-dd-${{ hashFiles('**/Podfile.lock', '**/Gemfile.lock', '**/package.json', '**/bun.lock') }}-xcode26.2 + restore-keys: | + ${{ runner.os }}-${{ matrix.use_frameworks }}-dd- + - name: Build App working-directory: example/ios - run: "set -o pipefail && xcodebuild \ - CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \ - -derivedDataPath build -UseModernBuildSystem=YES \ - -workspace NitroSQLiteExample.xcworkspace \ - -scheme NitroSQLiteExample \ - -sdk iphonesimulator \ - -configuration Debug \ - -destination 'platform=iOS Simulator,name=iPhone 16' \ - build \ - CODE_SIGNING_ALLOWED=NO" + run: | + set -o pipefail + xcodebuild \ + CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \ + -derivedDataPath build -UseModernBuildSystem=YES \ + -workspace NitroSQLiteExample.xcworkspace \ + -scheme NitroSQLiteExample \ + -sdk iphonesimulator \ + -configuration Debug \ + -destination 'platform=iOS Simulator,name=iPhone 17 Pro' \ + -showBuildTimingSummary \ + ONLY_ACTIVE_ARCH=YES \ + build \ + CODE_SIGNING_ALLOWED=NO | xcbeautify --renderer github-actions diff --git a/.github/workflows/lint-cpp.yml b/.github/workflows/lint-cpp.yml index 48f5c23..b9eb97f 100644 --- a/.github/workflows/lint-cpp.yml +++ b/.github/workflows/lint-cpp.yml @@ -1,4 +1,4 @@ -name: Validate C++ +name: Lint C++ on: push: @@ -11,9 +11,6 @@ on: - "**/*.cpp" - "**/*.c" - "**/*.mm" - paths-ignore: - - "node_modules" - - "**/node_modules" pull_request: paths: - ".github/workflows/lint-cpp.yml" @@ -22,28 +19,17 @@ on: - "**/*.cpp" - "**/*.c" - "**/*.mm" - paths-ignore: - - "node_modules" - - "**/node_modules" jobs: lint: - name: Check clang-format + name: Format C++ runs-on: ubuntu-latest - strategy: - matrix: - path: - - "package/android/src/main/cpp" - - "package/cpp" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: oven-sh/setup-bun@v2 - - name: Install npm dependencies (bun) - run: bun install + - name: Run clang-format + run: bun run lint-cpp - - name: Run clang-format style check - uses: jidicula/clang-format-action@v4.13.0 - with: - clang-format-version: "18" - check-path: ${{ matrix.path }} + - name: Verify no files have changed after format + run: git diff --exit-code HEAD -- . ':(exclude)bun.lock' diff --git a/.github/workflows/lint-typescript.yml b/.github/workflows/lint-typescript.yml index fc667d5..9f0d40e 100644 --- a/.github/workflows/lint-typescript.yml +++ b/.github/workflows/lint-typescript.yml @@ -17,10 +17,8 @@ on: - "**/*.js" - "**/*.jsx" - "**/*.json" - - "**/*.lockb" + - "**/bun.lock" - "**/package.json" - - "**/tsconfig.json" - - "**/eslintrc.js" pull_request: paths: - ".github/workflows/lint-typescript.yml" @@ -30,34 +28,25 @@ on: - "**/*.js" - "**/*.jsx" - "**/*.json" - - "**/*.lockb" + - "**/bun.lock" - "**/package.json" - - "**/tsconfig.json" - - "**/eslintrc.js" jobs: tsc: name: Compile TypeScript (tsc) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: oven-sh/setup-bun@v2 - uses: reviewdog/action-setup@v1 - name: Install npm dependencies (bun) run: bun install - - name: Run TypeScript (tsc) in example - working-directory: example - run: | - bun typecheck | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-level=any -tee - env: - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Run TypeScript (tsc) in react-native-nitro-sqlite - working-directory: package + - name: Run TypeScript (tsc) run: | - bun typecheck | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-level=any -tee + set -o pipefail + bun typecheck | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-level=error -tee env: REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -65,7 +54,7 @@ jobs: name: Lint TypeScript (eslint, prettier) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: oven-sh/setup-bun@v2 - name: Install npm dependencies (bun) @@ -79,4 +68,4 @@ jobs: run: bun lint - name: Verify no files have changed after auto-fix - run: git diff --exit-code HEAD -- . ':(exclude)bun.lockb' + run: git diff --exit-code HEAD -- . ':(exclude)bun.lock' diff --git a/.github/workflows/update-lockfiles.yml b/.github/workflows/update-lockfiles.yml index addf04a..6d0d845 100644 --- a/.github/workflows/update-lockfiles.yml +++ b/.github/workflows/update-lockfiles.yml @@ -1,4 +1,4 @@ -name: "Update Lockfiles (bun.lockb + Podfile.lock)" +name: "Update Lockfiles (bun.lock + Podfile.lock)" on: push: @@ -19,11 +19,11 @@ permissions: jobs: update-lockfiles: - name: "Update lockfiles (bun.lockb + Podfile.lock)" + name: "Update lockfiles (Podfile.lock)" if: github.actor == 'dependabot[bot]' - runs-on: macOS-latest + runs-on: macOS-26 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} @@ -37,13 +37,24 @@ jobs: bundler-cache: true working-directory: example/ios + - name: Select Xcode 26.2 + run: sudo xcode-select -s "/Applications/Xcode_26.2.app/Contents/Developer" + - run: | bun install - git add bun.lockb - bun example bundle-install - bun example pods + cd example + bundle install + bun pods + cd .. + + cd docs + bun install + cd .. + + git add bun.lock git add example/ios/Podfile.lock + git add example/Gemfile.lock git config --global user.name 'dependabot[bot]' git config --global user.email 'dependabot[bot]@users.noreply.github.com'