Skip to content
Open
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
131 changes: 129 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

env:
BUN_VERSION: 1.3.14

jobs:
quality:
name: Lint, Typecheck and Tests
Expand All @@ -21,10 +24,10 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: ${{ env.BUN_VERSION }}

- name: Install dependencies
run: bun install
run: bun install --frozen-lockfile

- name: Lint
run: cd package && bun run lint
Expand All @@ -34,3 +37,127 @@ jobs:

- name: Tests
run: cd package && bun run test:ci

- name: Check generated Nitro code is up to date
run: |
cd package
bun run specs
if [ -n "$(git status --porcelain -- nitrogen)" ]; then
echo "::error::nitrogen/generated is out of date. Run 'cd package && bun run specs' and commit the result."
git status --short -- nitrogen
git diff -- nitrogen
exit 1
fi

package:
name: Package contents
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Check npm pack contents
run: cd package && bun run check:pack

# Installing the package must not run anything in the app (#9). npm 11
# fails on install scripts with --strict-allow-scripts; older npm runs
# them, and a `tsc` install script would then emit index.js here.
- name: Install the tarball into an app
run: |
tarball="$RUNNER_TEMP/$(cd package && npm pack --silent --pack-destination "$RUNNER_TEMP")"
app="$RUNNER_TEMP/app"
mkdir "$app" && cd "$app"
npm init -y > /dev/null
npm install --no-audit --no-fund typescript
echo '{ "compilerOptions": { "skipLibCheck": true } }' > tsconfig.json
echo 'export const answer: number = 42' > index.ts
list() { find . -mindepth 1 -maxdepth 1 -not -name node_modules | sort; }
list > "$RUNNER_TEMP/before.txt"
npm install --no-audit --no-fund --legacy-peer-deps --foreground-scripts --strict-allow-scripts "$tarball"
list > "$RUNNER_TEMP/after.txt"
if ! diff "$RUNNER_TEMP/before.txt" "$RUNNER_TEMP/after.txt"; then
echo "::error::Installing the package changed files outside node_modules."
exit 1
fi

android:
name: Android build and unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Generate the example Android project
run: cd example && bunx expo prebuild --platform android --no-install

- name: Build and test the library
working-directory: example/android
run: >-
./gradlew
:gmisoftware_react-native-pay:assembleDebug
:gmisoftware_react-native-pay:testDebugUnitTest
-PreactNativeArchitectures=x86_64

- name: Upload test reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: android-test-reports
path: package/android/build/reports/tests
if-no-files-found: ignore

ios:
name: iOS build and unit tests
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}

- name: Install dependencies
run: bun install --frozen-lockfile

# Also runs `pod install`. The example links the NitroPay test spec
# through `expo-build-properties` (see example/app.json).
- name: Generate the example iOS project
run: cd example && bunx expo prebuild --platform ios

- name: Build and test the library
working-directory: example/ios
run: |
udid=$(xcrun simctl list devices available --json \
| jq -r '[.devices | to_entries[] | select(.key | contains("iOS")) | .value[] | select(.name | startswith("iPhone"))][0].udid')
xcodebuild test \
-workspace example.xcworkspace \
-scheme NitroPay-Unit-Tests \
-destination "id=$udid" \
CODE_SIGNING_ALLOWED=NO
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: 1.3.14

- name: Install dependencies
run: bun install
Expand Down
7 changes: 6 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ cd example && bun install

- Generate Nitro bindings: `cd package && bun run specs`
- Typecheck: `cd package && bun run typecheck`
- Lint: `cd package && bun run lint`
- Lint: `cd package && bun run lint` (fails on warnings). Fix: `cd package && bun run lint:fix`
- Test (all): `cd package && bun run test`
- Test (single file): `cd package && bun run test -- src/hooks/__tests__/usePaymentCheckout.integration.test.ts`
- Package contents: `cd package && bun run check:pack` (builds `lib/`, then checks what `npm pack` would publish)
- Android unit tests (JDK 17): `cd example && npx expo prebuild --platform android`, then `cd android && ./gradlew :gmisoftware_react-native-pay:testDebugUnitTest`
- iOS unit tests: `cd example && npx expo prebuild --platform ios`, then `cd ios && xcodebuild test -workspace example.xcworkspace -scheme NitroPay-Unit-Tests -destination 'platform=iOS Simulator,name=<iPhone>'`, with a name from `xcrun simctl list devices available`. Tests live in `package/ios/Tests`; the example links them through `expo-build-properties` in `app.json`.
- Run example: `cd example && npx expo prebuild && npx expo run:ios` or `npx expo run:android`
- Docs (dev): `bun run docs:start`. Docs (build): `bun run docs:build`

Expand Down Expand Up @@ -60,6 +63,8 @@ Example template:
- [ ] `cd package && bun run typecheck` (not run)
- [ ] `cd package && bun run lint` (not run)
- [ ] `cd package && bun run test:ci` (not run)
- [ ] `./gradlew :gmisoftware_react-native-pay:testDebugUnitTest` in `example/android` (if you changed Kotlin; not run)
- [ ] `xcodebuild test ... -scheme NitroPay-Unit-Tests` in `example/ios` (if you changed Swift; not run)
- [ ] `cd example && bunx expo run:ios` (not run)
- [ ] `cd example && bunx expo run:android` (not run)
- [ ] `bun run docs:build` (if you changed `docs/` or public API/setup; not run)
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ All notable changes to this project are documented in this file.
config that emits, it also wrote `.js` files next to the app's sources. The published package now
has no install scripts. The contributor build of `lib/` moved to the private monorepo root, so
`bun install` in this repository still builds it.
- **The published package no longer includes the library's tests.** 0.0.17 shipped
`src/**/__tests__` and their compiled copies under `lib/**/__tests__` (21 files).

## 0.0.17 — 2026-09-16

Expand Down
15 changes: 13 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@
"merchantIdentifier": "merchant.pl.sfd.sklep",
"enableGooglePay": true
}
],
[
"expo-build-properties",
{
"ios": {
"extraPods": [
{
"name": "NitroPay",
"path": "../../package",
"testspecs": ["Tests"]
}
]
}
}
]
],
"experiments": {
Expand Down
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@gmisoftware/react-native-pay": "*",
"@react-navigation/native": "^7.1.8",
"expo": "~57.0.0",
"expo-build-properties": "~57.0.22",
"expo-constants": "~57.0.3",
"expo-dev-client": "~57.0.5",
"expo-font": "~57.0.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"version": "1.0.0",
"scripts": {
"postinstall": "cd package && tsc || exit 0",
"postinstall": "cd package && tsc -p tsconfig.build.json || exit 0",
"android": "expo run:android",
"ios": "expo run:ios",
"docs:start": "cd docs && bun run start",
Expand Down
6 changes: 6 additions & 0 deletions package/NitroPay.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ Pod::Spec.new do |s|
# Implementation (C++ objects)
"cpp/**/*.{hpp,cpp}",
]
s.exclude_files = "ios/Tests/**"

# Unit tests. Add `:testspecs => ["Tests"]` to the NitroPay pod to build them.
s.test_spec "Tests" do |test_spec|
test_spec.source_files = "ios/Tests/**/*.swift"
end

# FOLLY_NO_CONFIG conflicts with RN >= 0.80's generated folly-config.h.
# Fail hard if React Native cannot be resolved — a silent fallback would apply
Expand Down
Loading
Loading