Skip to content

Commit 274cee7

Browse files
authored
chore: Update GitHub workflows (#265)
* chore: update workflows * fix: incorrect iOS example * chore: fail lint-cpp * chore: fail TS and eslint * fix: fail TS workflow if TS errors * fix: remove cpp, ts and lint errors * chore: improve Android workflow
1 parent 6397424 commit 274cee7

File tree

5 files changed

+111
-73
lines changed

5 files changed

+111
-73
lines changed

.github/workflows/build-android.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- "**/nitrogen/generated/android/**"
1212
- "package/cpp/**"
1313
- "package/android/**"
14-
- "bun.lockb"
14+
- "**/bun.lock"
1515
- "**/react-native.config.js"
1616
- "**/nitro.json"
1717
pull_request:
@@ -22,39 +22,55 @@ on:
2222
- "**/nitrogen/generated/android/**"
2323
- "package/cpp/**"
2424
- "package/android/**"
25-
- "bun.lockb"
25+
- "**/bun.lock"
2626
- "**/react-native.config.js"
2727
- "**/nitro.json"
2828

29+
env:
30+
# Build a single ABI in CI to reduce native compile time.
31+
TARGET_ANDROID_ARCH: x86_64
32+
2933
jobs:
3034
build:
3135
name: Build Android Example App
3236
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
min-sdk:
40+
- "24"
41+
- "26"
3342
steps:
34-
- uses: actions/checkout@v5
43+
- uses: actions/checkout@v6
3544
- uses: oven-sh/setup-bun@v2
3645

3746
- name: Install npm dependencies (bun)
3847
run: bun install
3948

49+
- name: Set minSdk in build.gradle
50+
run: sed -i "s/minSdkVersion = 24/minSdkVersion = ${{ matrix.min-sdk }}/g" example/android/build.gradle
51+
4052
- name: Setup JDK 17
4153
uses: actions/setup-java@v5
4254
with:
4355
distribution: "zulu"
4456
java-version: 17
4557
java-package: jdk
4658

47-
- name: Restore Gradle cache
48-
uses: actions/cache@v4
59+
- name: Restore Gradle/CMake cache
60+
uses: actions/cache@v5
4961
with:
5062
path: |
5163
~/.gradle/caches
52-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
64+
~/.gradle/wrapper
65+
example/android/.gradle
66+
example/android/app/.cxx
67+
key: ${{ runner.os }}-gradle-${{ matrix.min-sdk }}-${{ env.TARGET_ANDROID_ARCH }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/CMakeLists.txt', '**/*.cmake') }}
5368
restore-keys: |
69+
${{ runner.os }}-gradle-${{ matrix.min-sdk }}-${{ env.TARGET_ANDROID_ARCH }}-
5470
${{ runner.os }}-gradle-
5571
- name: Run Gradle Build for example/android/
5672
working-directory: example/android
57-
run: ./gradlew assembleDebug --no-daemon --build-cache
73+
run: ./gradlew :app:assembleDebug --no-daemon --build-cache -PreactNativeArchitectures=${{ env.TARGET_ANDROID_ARCH }}
5874

5975
# Gradle cache doesn't like daemons
6076
- name: Stop Gradle Daemon

.github/workflows/build-ios.yml

Lines changed: 55 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,37 @@ env:
3434
jobs:
3535
build:
3636
name: Build iOS Example App
37-
runs-on: macOS-15
37+
runs-on: macOS-26
38+
strategy:
39+
matrix:
40+
include:
41+
- name: static_frameworks
42+
use_frameworks: static
43+
- name: no_frameworks
44+
use_frameworks: "" # intentionally unset
3845
steps:
39-
- uses: actions/checkout@v4
46+
- uses: actions/checkout@v6
4047
- uses: oven-sh/setup-bun@v2
4148

49+
- name: Set USE_FRAMEWORKS
50+
if: matrix.use_frameworks != ''
51+
run: echo "USE_FRAMEWORKS=${{ matrix.use_frameworks }}" >> $GITHUB_ENV
52+
4253
- name: Install npm dependencies (bun)
4354
run: bun install
4455

45-
- name: Restore ccache
56+
- name: Install Ccache
4657
uses: hendrikmuhs/ccache-action@v1.2
58+
with:
59+
max-size: 1.5G
60+
key: ${{ runner.os }}-${{ matrix.use_frameworks }}-ccache-example-ios
61+
create-symlink: true
62+
- name: Setup ccache behavior
63+
run: |
64+
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
65+
echo "CCACHE_FILECLONE=true" >> $GITHUB_ENV
66+
echo "CCACHE_DEPEND=true" >> $GITHUB_ENV
67+
echo "CCACHE_INODECACHE=true" >> $GITHUB_ENV
4768
4869
- name: Setup Ruby (bundle)
4970
uses: ruby/setup-ruby@v1
@@ -52,26 +73,41 @@ jobs:
5273
bundler-cache: true
5374
working-directory: example
5475

76+
- name: Select Xcode 26.2
77+
run: sudo xcode-select -s "/Applications/Xcode_26.2.app/Contents/Developer"
78+
5579
- name: Restore Pods cache
56-
uses: actions/cache@v4
80+
uses: actions/cache@v5
5781
with:
5882
path: example/ios/Pods
59-
key: pods-${{ runner.os }}-${{ hashFiles('**/Podfile.lock', '**/Gemfile.lock') }}
83+
key: ${{ runner.os }}-${{ matrix.use_frameworks }}-pods-${{ hashFiles('**/Podfile.lock', '**/Gemfile.lock') }}
6084
restore-keys: |
61-
pods-${{ runner.os }}
62-
85+
${{ runner.os }}-${{ matrix.use_frameworks }}-pods-
6386
- name: Install Pods
64-
working-directory: example/ios
65-
run: pod install
87+
working-directory: example
88+
run: bun pods
89+
90+
- name: Restore DerivedData cache
91+
uses: actions/cache@v5
92+
with:
93+
path: example/ios/build
94+
key: ${{ runner.os }}-${{ matrix.use_frameworks }}-dd-${{ hashFiles('**/Podfile.lock', '**/Gemfile.lock', '**/package.json', '**/bun.lock') }}-xcode26.2
95+
restore-keys: |
96+
${{ runner.os }}-${{ matrix.use_frameworks }}-dd-
97+
6698
- name: Build App
6799
working-directory: example/ios
68-
run: "set -o pipefail && xcodebuild \
69-
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
70-
-derivedDataPath build -UseModernBuildSystem=YES \
71-
-workspace NitroSQLiteExample.xcworkspace \
72-
-scheme NitroSQLiteExample \
73-
-sdk iphonesimulator \
74-
-configuration Debug \
75-
-destination 'platform=iOS Simulator,name=iPhone 16' \
76-
build \
77-
CODE_SIGNING_ALLOWED=NO"
100+
run: |
101+
set -o pipefail
102+
xcodebuild \
103+
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
104+
-derivedDataPath build -UseModernBuildSystem=YES \
105+
-workspace NitroSQLiteExample.xcworkspace \
106+
-scheme NitroSQLiteExample \
107+
-sdk iphonesimulator \
108+
-configuration Debug \
109+
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' \
110+
-showBuildTimingSummary \
111+
ONLY_ACTIVE_ARCH=YES \
112+
build \
113+
CODE_SIGNING_ALLOWED=NO | xcbeautify --renderer github-actions

.github/workflows/lint-cpp.yml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Validate C++
1+
name: Lint C++
22

33
on:
44
push:
@@ -11,9 +11,6 @@ on:
1111
- "**/*.cpp"
1212
- "**/*.c"
1313
- "**/*.mm"
14-
paths-ignore:
15-
- "node_modules"
16-
- "**/node_modules"
1714
pull_request:
1815
paths:
1916
- ".github/workflows/lint-cpp.yml"
@@ -22,28 +19,17 @@ on:
2219
- "**/*.cpp"
2320
- "**/*.c"
2421
- "**/*.mm"
25-
paths-ignore:
26-
- "node_modules"
27-
- "**/node_modules"
2822

2923
jobs:
3024
lint:
31-
name: Check clang-format
25+
name: Format C++
3226
runs-on: ubuntu-latest
33-
strategy:
34-
matrix:
35-
path:
36-
- "package/android/src/main/cpp"
37-
- "package/cpp"
3827
steps:
39-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v6
4029
- uses: oven-sh/setup-bun@v2
4130

42-
- name: Install npm dependencies (bun)
43-
run: bun install
31+
- name: Run clang-format
32+
run: bun run lint-cpp
4433

45-
- name: Run clang-format style check
46-
uses: jidicula/clang-format-action@v4.13.0
47-
with:
48-
clang-format-version: "18"
49-
check-path: ${{ matrix.path }}
34+
- name: Verify no files have changed after format
35+
run: git diff --exit-code HEAD -- . ':(exclude)bun.lock'

.github/workflows/lint-typescript.yml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ on:
1717
- "**/*.js"
1818
- "**/*.jsx"
1919
- "**/*.json"
20-
- "**/*.lockb"
20+
- "**/bun.lock"
2121
- "**/package.json"
22-
- "**/tsconfig.json"
23-
- "**/eslintrc.js"
2422
pull_request:
2523
paths:
2624
- ".github/workflows/lint-typescript.yml"
@@ -30,42 +28,33 @@ on:
3028
- "**/*.js"
3129
- "**/*.jsx"
3230
- "**/*.json"
33-
- "**/*.lockb"
31+
- "**/bun.lock"
3432
- "**/package.json"
35-
- "**/tsconfig.json"
36-
- "**/eslintrc.js"
3733

3834
jobs:
3935
tsc:
4036
name: Compile TypeScript (tsc)
4137
runs-on: ubuntu-latest
4238
steps:
43-
- uses: actions/checkout@v5
39+
- uses: actions/checkout@v6
4440
- uses: oven-sh/setup-bun@v2
4541
- uses: reviewdog/action-setup@v1
4642

4743
- name: Install npm dependencies (bun)
4844
run: bun install
4945

50-
- name: Run TypeScript (tsc) in example
51-
working-directory: example
52-
run: |
53-
bun typecheck | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-level=any -tee
54-
env:
55-
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56-
57-
- name: Run TypeScript (tsc) in react-native-nitro-sqlite
58-
working-directory: package
46+
- name: Run TypeScript (tsc)
5947
run: |
60-
bun typecheck | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-level=any -tee
48+
set -o pipefail
49+
bun typecheck | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-level=error -tee
6150
env:
6251
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6352

6453
lint:
6554
name: Lint TypeScript (eslint, prettier)
6655
runs-on: ubuntu-latest
6756
steps:
68-
- uses: actions/checkout@v5
57+
- uses: actions/checkout@v6
6958
- uses: oven-sh/setup-bun@v2
7059

7160
- name: Install npm dependencies (bun)
@@ -79,4 +68,4 @@ jobs:
7968
run: bun lint
8069

8170
- name: Verify no files have changed after auto-fix
82-
run: git diff --exit-code HEAD -- . ':(exclude)bun.lockb'
71+
run: git diff --exit-code HEAD -- . ':(exclude)bun.lock'

.github/workflows/update-lockfiles.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Update Lockfiles (bun.lockb + Podfile.lock)"
1+
name: "Update Lockfiles (bun.lock + Podfile.lock)"
22

33
on:
44
push:
@@ -19,11 +19,11 @@ permissions:
1919

2020
jobs:
2121
update-lockfiles:
22-
name: "Update lockfiles (bun.lockb + Podfile.lock)"
22+
name: "Update lockfiles (Podfile.lock)"
2323
if: github.actor == 'dependabot[bot]'
24-
runs-on: macOS-latest
24+
runs-on: macOS-26
2525
steps:
26-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@v6
2727
with:
2828
fetch-depth: 0
2929
ref: ${{ github.event.pull_request.head.ref }}
@@ -37,13 +37,24 @@ jobs:
3737
bundler-cache: true
3838
working-directory: example/ios
3939

40+
- name: Select Xcode 26.2
41+
run: sudo xcode-select -s "/Applications/Xcode_26.2.app/Contents/Developer"
42+
4043
- run: |
4144
bun install
42-
git add bun.lockb
4345
44-
bun example bundle-install
45-
bun example pods
46+
cd example
47+
bundle install
48+
bun pods
49+
cd ..
50+
51+
cd docs
52+
bun install
53+
cd ..
54+
55+
git add bun.lock
4656
git add example/ios/Podfile.lock
57+
git add example/Gemfile.lock
4758
4859
git config --global user.name 'dependabot[bot]'
4960
git config --global user.email 'dependabot[bot]@users.noreply.github.com'

0 commit comments

Comments
 (0)