Skip to content

Commit d168ec6

Browse files
authored
Cross platform unit testing (#121)
* Run everything on all platforms * Fix cross-platform issue when copying examples * Explicit package type * Use default triplets when building examples * Fix getting the WeakNodeApi path * Build ferric-example when bootstrapping * Add names to workflow * Install Rust targets * Ensure right order between bootstraps * Upgrade napi-rs * Fix getting path for weak-node-api on Windows * No need to fail tests fast
1 parent 48ac294 commit d168ec6

File tree

11 files changed

+122
-153
lines changed

11 files changed

+122
-153
lines changed

.github/workflows/check.yml

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Check
2+
13
on:
24
push:
35
branches:
@@ -10,6 +12,7 @@ concurrency:
1012

1113
jobs:
1214
lint:
15+
name: Lint
1316
runs-on: ubuntu-latest
1417
steps:
1518
- uses: actions/checkout@v4
@@ -18,32 +21,13 @@ jobs:
1821
node-version: lts/jod
1922
- run: npm ci
2023
- run: npm run lint
21-
test-simple:
22-
name: Run tests which doesn't require MacOS
23-
runs-on: ubuntu-latest
24-
steps:
25-
- uses: actions/checkout@v4
26-
- uses: actions/setup-node@v4
27-
with:
28-
node-version: lts/jod
29-
- run: npm ci
30-
- run: npm run build
31-
- run: npm test --workspace gyp-to-cmake --workspace cmake-rn --workspace react-native-node-api
32-
test-windows:
33-
name: Run tests on Windows
34-
runs-on: windows-latest
35-
steps:
36-
- uses: actions/checkout@v4
37-
- uses: actions/setup-node@v4
38-
with:
39-
node-version: lts/jod
40-
- run: npm ci
41-
- run: npm run build
42-
- run: npm test --workspace gyp-to-cmake --workspace cmake-rn --workspace react-native-node-api
43-
44-
test-macos:
45-
name: Run tests which requires MacOS
46-
runs-on: macos-latest
24+
test:
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
runner: [ubuntu-latest, windows-latest, macos-latest]
29+
name: Test (${{ matrix.runner }})
30+
runs-on: ${{ matrix.runner }}
4731
steps:
4832
- uses: actions/checkout@v4
4933
- uses: actions/setup-node@v4
@@ -58,9 +42,7 @@ jobs:
5842
uses: android-actions/setup-android@v3
5943
# Version here should match the one in React Native template and packages/cmake-rn/src/cli.ts
6044
- run: sdkmanager --install "ndk;27.1.12297006"
45+
- run: rustup target add x86_64-linux-android aarch64-linux-android aarch64-apple-ios-sim
6146
- run: npm ci
62-
- run: npm run build
63-
- run: npm run copy-node-api-headers --workspace react-native-node-api
64-
- run: npm run build-weak-node-api --workspace react-native-node-api
65-
- run: npm run generate-weak-node-api-injector --workspace react-native-node-api
66-
- run: npm test --workspace @react-native-node-api/node-addon-examples
47+
- run: npm run bootstrap
48+
- run: npm test

package-lock.json

Lines changed: 80 additions & 105 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)