ci: reduce the complex of CI config (#1628)
This commit is contained in:
parent
fb22a5ae07
commit
53cf696cf8
27 changed files with 338 additions and 612 deletions
|
@ -57,8 +57,6 @@ rules:
|
|||
|
||||
'@typescript-eslint/adjacent-overload-signatures': 2
|
||||
|
||||
'@typescript-eslint/await-thenable': 2
|
||||
|
||||
'@typescript-eslint/consistent-type-assertions': 2
|
||||
|
||||
'@typescript-eslint/ban-types':
|
||||
|
@ -94,46 +92,6 @@ rules:
|
|||
|
||||
'@typescript-eslint/method-signature-style': 2
|
||||
|
||||
'@typescript-eslint/no-floating-promises': 2
|
||||
|
||||
'@typescript-eslint/no-implied-eval': 2
|
||||
|
||||
'@typescript-eslint/no-for-in-array': 2
|
||||
|
||||
'@typescript-eslint/no-inferrable-types': 2
|
||||
|
||||
'@typescript-eslint/no-invalid-void-type': 2
|
||||
|
||||
'@typescript-eslint/no-misused-new': 2
|
||||
|
||||
'@typescript-eslint/no-misused-promises': 2
|
||||
|
||||
'@typescript-eslint/no-namespace': 2
|
||||
|
||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 2
|
||||
|
||||
'@typescript-eslint/no-throw-literal': 2
|
||||
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 2
|
||||
|
||||
'@typescript-eslint/prefer-for-of': 2
|
||||
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 2
|
||||
|
||||
'@typescript-eslint/switch-exhaustiveness-check': 2
|
||||
|
||||
'@typescript-eslint/prefer-optional-chain': 2
|
||||
|
||||
'@typescript-eslint/prefer-readonly': 2
|
||||
|
||||
'@typescript-eslint/prefer-string-starts-ends-with': 0
|
||||
|
||||
'@typescript-eslint/no-array-constructor': 2
|
||||
|
||||
'@typescript-eslint/require-await': 2
|
||||
|
||||
'@typescript-eslint/return-await': 2
|
||||
|
||||
'@typescript-eslint/ban-ts-comment':
|
||||
[
|
||||
2,
|
||||
|
@ -197,6 +155,48 @@ overrides:
|
|||
- '@typescript-eslint'
|
||||
parserOptions:
|
||||
project: ./tsconfig.json
|
||||
rules:
|
||||
'@typescript-eslint/await-thenable': 2
|
||||
|
||||
'@typescript-eslint/no-floating-promises': 2
|
||||
|
||||
'@typescript-eslint/no-implied-eval': 2
|
||||
|
||||
'@typescript-eslint/no-for-in-array': 2
|
||||
|
||||
'@typescript-eslint/no-inferrable-types': 2
|
||||
|
||||
'@typescript-eslint/no-invalid-void-type': 2
|
||||
|
||||
'@typescript-eslint/no-misused-new': 2
|
||||
|
||||
'@typescript-eslint/no-misused-promises': 2
|
||||
|
||||
'@typescript-eslint/no-namespace': 2
|
||||
|
||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 2
|
||||
|
||||
'@typescript-eslint/no-throw-literal': 2
|
||||
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 2
|
||||
|
||||
'@typescript-eslint/prefer-for-of': 2
|
||||
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 2
|
||||
|
||||
'@typescript-eslint/switch-exhaustiveness-check': 2
|
||||
|
||||
'@typescript-eslint/prefer-optional-chain': 2
|
||||
|
||||
'@typescript-eslint/prefer-readonly': 2
|
||||
|
||||
'@typescript-eslint/prefer-string-starts-ends-with': 0
|
||||
|
||||
'@typescript-eslint/no-array-constructor': 2
|
||||
|
||||
'@typescript-eslint/require-await': 2
|
||||
|
||||
'@typescript-eslint/return-await': 2
|
||||
- files:
|
||||
- ./examples/**/*.{ts,js}
|
||||
plugins:
|
||||
|
|
56
.github/workflows/android-armv7.yml
vendored
56
.github/workflows/android-armv7.yml
vendored
|
@ -1,56 +0,0 @@
|
|||
name: Android-armv7
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
||||
jobs:
|
||||
build-android-armv7:
|
||||
name: Build - Android - armv7
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: List NDK Home
|
||||
run: ls -R "${ANDROID_NDK_LATEST_HOME}"
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: armv7-linux-androideabi
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: stable-linux-android-armv7-node@18-cargo-cache
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: Cross build
|
||||
run: |
|
||||
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
|
||||
yarn build:test -- --target armv7-linux-androideabi
|
||||
du -sh examples/napi/index.node
|
||||
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip examples/napi/index.node
|
||||
du -sh examples/napi/index.node
|
53
.github/workflows/android.yml
vendored
53
.github/workflows/android.yml
vendored
|
@ -1,53 +0,0 @@
|
|||
name: Android-aarch64
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-android-aarch64:
|
||||
name: Build - Android - aarch64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: List NDK Home
|
||||
run: ls -R "${ANDROID_NDK_LATEST_HOME}"
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: aarch64-linux-android
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: stable-linux-android-node@16-cargo-cache
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: Cross build native tests
|
||||
run: |
|
||||
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
|
||||
yarn build:test -- --target aarch64-linux-android
|
1
.github/workflows/bench.yaml
vendored
1
.github/workflows/bench.yaml
vendored
|
@ -16,7 +16,6 @@ concurrency:
|
|||
jobs:
|
||||
bench:
|
||||
name: Bench
|
||||
if: "!contains(github.event.head_commit.message, 'bump')"
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
|
8
.github/workflows/check-all-features.yml
vendored
8
.github/workflows/check-all-features.yml
vendored
|
@ -31,13 +31,5 @@ jobs:
|
|||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: stable-check-ubuntu-latest-cargo-cache-features-${{ matrix.settings.package }}-${{ matrix.features }}
|
||||
|
||||
- name: Check build
|
||||
run: cargo check -p ${{ matrix.settings.package }} -F ${{ matrix.settings.features }}
|
||||
|
|
54
.github/workflows/linux-aarch64-musl.yaml
vendored
54
.github/workflows/linux-aarch64-musl.yaml
vendored
|
@ -1,54 +0,0 @@
|
|||
name: Linux-aarch64-musl
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: stable - aarch64-unknown-linux-gnu - node@18
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
yarn config set --json supportedArchitectures.cpu '["current", "arm64"]'
|
||||
yarn config set --json supportedArchitectures.libc '["current", "musl"]'
|
||||
yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: Cross build native tests
|
||||
uses: addnab/docker-run-action@v3
|
||||
with:
|
||||
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
||||
options: -v ${{ github.workspace }}:/napi-rs -w /napi-rs
|
||||
run: |
|
||||
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-musl-gcc
|
||||
yarn build:test -- --target aarch64-unknown-linux-musl
|
||||
|
||||
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
|
||||
- name: Setup and run tests
|
||||
uses: addnab/docker-run-action@v3
|
||||
with:
|
||||
image: node:lts-alpine
|
||||
options: --platform linux/arm64 -v ${{ github.workspace }}:/build -w /build
|
||||
run: |
|
||||
set -e
|
||||
yarn test
|
65
.github/workflows/linux-aarch64.yaml
vendored
65
.github/workflows/linux-aarch64.yaml
vendored
|
@ -1,65 +0,0 @@
|
|||
name: Linux-aarch64
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: stable - aarch64-unknown-linux-gnu - node@18
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: aarch64-unknown-linux-gnu
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: stable-linux-aarch64-gnu-node@18-cargo-cache
|
||||
|
||||
- name: Install ziglang
|
||||
uses: goto-bus-stop/setup-zig@v2
|
||||
with:
|
||||
version: 0.10.1
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
yarn config set --json supportedArchitectures.cpu '["current", "arm64"]'
|
||||
yarn config set supportedArchitectures.libc "glibc"
|
||||
yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: Cross build native tests
|
||||
run: yarn build:test -- --target aarch64-unknown-linux-gnu --cross-compile
|
||||
|
||||
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
|
||||
- name: Setup and run tests
|
||||
uses: addnab/docker-run-action@v3
|
||||
with:
|
||||
image: node:lts-slim
|
||||
options: --platform linux/arm64 -v ${{ github.workspace }}:/build -w /build
|
||||
run: yarn test
|
43
.github/workflows/linux-musl.yaml
vendored
43
.github/workflows/linux-musl.yaml
vendored
|
@ -1,43 +0,0 @@
|
|||
name: Linux musl
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: stable - x86_64-unknown-linux-musl - node@18
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: |
|
||||
yarn config set --json supportedArchitectures.libc '["current", "musl"]'
|
||||
yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: Setup and run tests
|
||||
uses: addnab/docker-run-action@v3
|
||||
with:
|
||||
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
||||
options: -v ${{ github.workspace }}:/napi-rs -w /napi-rs
|
||||
run: |
|
||||
cargo check -vvv
|
||||
yarn build:test -- --target x86_64-unknown-linux-musl
|
||||
yarn test
|
53
.github/workflows/linux-riscv64.yaml
vendored
53
.github/workflows/linux-riscv64.yaml
vendored
|
@ -1,53 +0,0 @@
|
|||
name: Linux-riscv64
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: stable - riscv64-unknown-linux-gnu - node@18
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: riscv64gc-unknown-linux-gnu
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: stable-linux-riscv64-gnu-node@18-cargo-cache
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-riscv64-linux-gnu
|
||||
yarn config set --json supportedArchitectures.cpu '["current", "riscv64"]'
|
||||
yarn config set supportedArchitectures.libc "glibc"
|
||||
yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: Cross build native tests
|
||||
run: yarn build:test -- --target riscv64gc-unknown-linux-gnu
|
54
.github/workflows/msrv.yml
vendored
54
.github/workflows/msrv.yml
vendored
|
@ -1,54 +0,0 @@
|
|||
name: Test MSRV Rust
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test-msrv-rust:
|
||||
name: 1.57.0 - ubuntu-latest - node@18
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: 1.57.0
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: stable-ubuntu-latest-node@16-cargo-cache
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --mode=skip-build --immutable
|
||||
|
||||
- name: Check build
|
||||
run: cargo check --all --bins --examples --tests -vvv
|
||||
|
||||
- name: Unit tests
|
||||
run: |
|
||||
yarn build:test
|
||||
yarn test --verbose
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
278
.github/workflows/test.yaml
vendored
278
.github/workflows/test.yaml
vendored
|
@ -1,8 +1,9 @@
|
|||
name: macOS/Windows/Linux x64
|
||||
name: Test
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
RUST_BACKTRACE: 1
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
@ -19,11 +20,69 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: ['16', '18']
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
|
||||
name: stable - ${{ matrix.os }} - node@${{ matrix.node }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
node: ['16', '18', '20']
|
||||
settings:
|
||||
- host: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
build: yarn build:test
|
||||
test: |
|
||||
yarn test:cli
|
||||
yarn test --verbose
|
||||
yarn tsc -p examples/napi/tsconfig.json --noEmit
|
||||
yarn test:macro
|
||||
toolchain: stable
|
||||
- host: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
build: yarn build:test
|
||||
test: |
|
||||
yarn test:cli
|
||||
yarn test --verbose
|
||||
yarn tsc -p examples/napi/tsconfig.json --noEmit
|
||||
yarn test:macro
|
||||
toolchain: 1.57.0
|
||||
- host: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
build: yarn build:test
|
||||
test: |
|
||||
yarn test:cli
|
||||
yarn test --verbose
|
||||
yarn tsc -p examples/napi/tsconfig.json --noEmit
|
||||
yarn test:macro
|
||||
toolchain: stable
|
||||
- host: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
build: yarn build:test
|
||||
test: |
|
||||
yarn test:cli
|
||||
yarn test --verbose
|
||||
yarn tsc -p examples/napi/tsconfig.json --noEmit
|
||||
yarn test:macro
|
||||
toolchain: stable
|
||||
- host: windows-latest
|
||||
target: i686-pc-windows-msvc
|
||||
build: |
|
||||
yarn workspace @examples/napi build --target i686-pc-windows-msvc --release
|
||||
yarn workspace @examples/compat-mode build --target i686-pc-windows-msvc --release
|
||||
test: |
|
||||
yarn test --verbose
|
||||
node ./node_modules/electron/install.js
|
||||
yarn test:electron
|
||||
toolchain: stable
|
||||
exclude:
|
||||
- settings:
|
||||
toolchain: 1.57.0
|
||||
node: 18
|
||||
- settings:
|
||||
toolchain: 1.57.0
|
||||
node: 20
|
||||
- settings:
|
||||
target: i686-pc-windows-msvc
|
||||
node: 16
|
||||
- settings:
|
||||
target: i686-pc-windows-msvc
|
||||
node: 18
|
||||
name: stable - ${{ matrix.settings.host }} - node@${{ matrix.node }}
|
||||
runs-on: ${{ matrix.settings.host }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -37,7 +96,8 @@ jobs:
|
|||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
toolchain: ${{ matrix.settings.toolchain }}
|
||||
targets: ${{ matrix.settings.target }}
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
|
@ -46,33 +106,217 @@ jobs:
|
|||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: stable-${{ matrix.os }}-node@${{ matrix.node }}-cargo-cache
|
||||
key: ${{ matrix.settings.host }}-${{ matrix.settings.toolchain }}-${{ matrix.settings.target }}-cargo-cache
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --mode=skip-build --immutable
|
||||
|
||||
- name: Check build
|
||||
run: cargo check --all --bins --examples --tests -vvv
|
||||
run: cargo check --target ${{ matrix.settings.target }} --all --bins --examples --tests -vvv
|
||||
|
||||
- name: Build tests
|
||||
if: matrix.settings.build
|
||||
run: ${{ matrix.settings.build }}
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
if: matrix.settings.target == 'i686-pc-windows-msvc'
|
||||
with:
|
||||
node-version: 18
|
||||
architecture: 'x86'
|
||||
|
||||
- name: Unit tests
|
||||
run: |
|
||||
yarn test:cli
|
||||
yarn build:test
|
||||
yarn test --verbose
|
||||
yarn tsc -p examples/napi/tsconfig.json --noEmit
|
||||
yarn test:macro
|
||||
if: matrix.settings.test
|
||||
run: ${{ matrix.settings.test }}
|
||||
|
||||
- name: Electron tests
|
||||
if: matrix.os != 'ubuntu-latest'
|
||||
if: matrix.settings.target == 'x86_64-apple-darwin' || matrix.settings.target == 'x86_64-pc-windows-msvc'
|
||||
run: |
|
||||
node ./node_modules/electron/install.js
|
||||
yarn test:electron
|
||||
|
||||
- name: Electron tests
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
if: matrix.settings.target == 'x86_64-unknown-linux-gnu'
|
||||
run: |
|
||||
node ./node_modules/electron/install.js
|
||||
xvfb-run --auto-servernum yarn test:electron
|
||||
|
||||
- name: Test build with profile
|
||||
run: yarn workspace @examples/napi build --profile napi-rs-custom
|
||||
|
||||
build_only:
|
||||
name: Build only test - ${{ matrix.settings.target }}
|
||||
runs-on: ${{ matrix.settings.host }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
settings:
|
||||
- host: ubuntu-latest
|
||||
target: aarch64-linux-android
|
||||
- host: ubuntu-latest
|
||||
target: armv7-linux-androideabi
|
||||
- host: ubuntu-latest
|
||||
target: riscv64gc-unknown-linux-gnu
|
||||
setup: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-riscv64-linux-gnu
|
||||
- host: windows-latest
|
||||
target: aarch64-pc-windows-msvc
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: ${{ matrix.settings.target }}
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: stable-${{ matrix.settings.host }}-${{ matrix.settings.target }}-cargo-cache
|
||||
|
||||
- name: Setup toolchain
|
||||
if: matrix.settings.setup
|
||||
run: ${{ matrix.settings.setup }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: Cross build native tests
|
||||
run: yarn build:test -- --target ${{ matrix.settings.target }} --release
|
||||
shell: bash
|
||||
|
||||
build_in_docker:
|
||||
name: build - ${{ matrix.settings.target }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
settings:
|
||||
- image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
||||
target: x86_64-unknown-linux-musl
|
||||
libc: 'musl'
|
||||
arch: 'x64'
|
||||
- image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
||||
target: aarch64-unknown-linux-musl
|
||||
- image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
|
||||
target: aarch64-unknown-linux-gnu
|
||||
arch: 'arm64'
|
||||
libc: 'gnu'
|
||||
- image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
|
||||
target: x86_64-unknown-linux-gnu
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
.cargo-cache/registry
|
||||
.cargo-cache/git
|
||||
target
|
||||
key: stable-${{ matrix.settings.target }}-cargo-cache
|
||||
|
||||
- name: Cross build native tests
|
||||
uses: addnab/docker-run-action@v3
|
||||
with:
|
||||
image: ${{ matrix.settings.image }}
|
||||
options: -v ${{ github.workspace }}/.cargo-cache/registry:/usr/local/cargo/registry -v ${{ github.workspace }}/.cargo-cache/git:/usr/local/cargo/git -v ${{ github.workspace }}:/napi-rs -w /napi-rs
|
||||
run: |
|
||||
yarn build:test -- --target ${{ matrix.settings.target }}
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.settings.target }}-example
|
||||
path: examples/napi/index.node
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.settings.target }}-example-compat
|
||||
path: examples/napi-compat-mode/index.node
|
||||
|
||||
test_in_docker:
|
||||
name: Test - ${{ matrix.settings.target }} - ${{ matrix.node }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build_in_docker
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: [16, 18, 20]
|
||||
settings:
|
||||
- image: 'node:{:version}-slim'
|
||||
target: x86_64-unknown-linux-gnu
|
||||
args: ''
|
||||
arch: 'x64'
|
||||
libc: 'gnu'
|
||||
- image: 'node:{:version}-slim'
|
||||
target: aarch64-unknown-linux-gnu
|
||||
args: '--platform linux/arm64'
|
||||
arch: 'arm64'
|
||||
libc: 'gnu'
|
||||
- image: 'node:{:version}-alpine'
|
||||
target: x86_64-unknown-linux-musl
|
||||
args: ''
|
||||
arch: 'x64'
|
||||
libc: 'musl'
|
||||
- image: 'node:{:version}-alpine'
|
||||
target: aarch64-unknown-linux-musl
|
||||
args: '--platform linux/arm64'
|
||||
arch: 'arm64'
|
||||
libc: 'musl'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.settings.target }}-example
|
||||
path: examples/napi/index.node
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.settings.target }}-example-compat
|
||||
path: examples/napi-compat-mode/index.node
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
yarn config set --json supportedArchitectures.cpu '["current", "${{ matrix.settings.arch }}"]'
|
||||
yarn config set --json supportedArchitectures.libc '["current", "${{ matrix.settings.libc }}"]'
|
||||
yarn install --immutable --mode=skip-build
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
with:
|
||||
platforms: all
|
||||
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
- name: Setup image name
|
||||
id: image-name
|
||||
run: |
|
||||
node -e "console.info('docker-image=${{ matrix.settings.image }}'.replace('{:version}', ${{ matrix.node }}))" >> "$GITHUB_OUTPUT"
|
||||
- name: Setup and run tests
|
||||
uses: addnab/docker-run-action@v3
|
||||
with:
|
||||
image: ${{ steps.image-name.outputs.docker-image }}
|
||||
options: ${{ matrix.settings.args }} -v ${{ github.workspace }}:/build -w /build
|
||||
run: yarn test
|
||||
|
|
59
.github/workflows/windows-arm.yml
vendored
59
.github/workflows/windows-arm.yml
vendored
|
@ -1,59 +0,0 @@
|
|||
name: Windows arm64
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
name: stable - windows-latest - arm64 - node@18
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --mode=skip-build --immutable
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: aarch64-pc-windows-msvc
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: stable-windows-arm64-node@16-cargo-cache
|
||||
|
||||
- name: Check build
|
||||
run: cargo check --all --bins --examples --tests --target aarch64-pc-windows-msvc -vvv
|
||||
|
||||
- name: Build release target
|
||||
run: |
|
||||
yarn workspace @examples/napi build --target aarch64-pc-windows-msvc --release
|
||||
yarn workspace @examples/compat-mode build --target aarch64-pc-windows-msvc --release
|
||||
|
||||
- name: Clear the cargo caches
|
||||
run: |
|
||||
cargo install cargo-cache --no-default-features --features ci-autoclean
|
||||
cargo-cache
|
69
.github/workflows/windows-i686.yml
vendored
69
.github/workflows/windows-i686.yml
vendored
|
@ -1,69 +0,0 @@
|
|||
name: Windows i686
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
name: stable - windows-latest - i686 - node@18
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: |
|
||||
yarn install --mode=skip-build --immutable
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: i686-pc-windows-msvc
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: stable-windows-i686-node@18-cargo-cache
|
||||
|
||||
- name: Check build
|
||||
run: cargo check --all --bins --examples --tests --target i686-pc-windows-msvc -vvv
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
yarn workspace @examples/napi build --target i686-pc-windows-msvc --release
|
||||
yarn workspace @examples/compat-mode build --target i686-pc-windows-msvc --release
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
architecture: 'x86'
|
||||
|
||||
- name: Build Tests
|
||||
run: |
|
||||
yarn test --verbose
|
||||
node ./node_modules/electron/install.js
|
||||
yarn test:electron
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
6
cli/ava.config.js
Normal file
6
cli/ava.config.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
export default {
|
||||
extensions: {
|
||||
ts: 'module',
|
||||
},
|
||||
files: ['**/__tests__/**/*.spec.ts'],
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
export default {
|
||||
extensions: {
|
||||
ts: 'module',
|
||||
},
|
||||
files: ['**/__tests__/**/*.spec.ts'],
|
||||
nodeArguments: ['--loader=ts-node/esm/transpile-only'],
|
||||
environmentVariables: {
|
||||
TS_NODE_PROJECT: './tsconfig.json',
|
||||
},
|
||||
}
|
|
@ -84,7 +84,7 @@
|
|||
"esbuild": "^0.18.0",
|
||||
"prettier": "^2.8.7",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.0.4"
|
||||
"typescript": "^5.1.3"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
|
@ -94,6 +94,6 @@
|
|||
"codegen": "node --loader ts-node/esm/transpile-only ./codegen/index.ts",
|
||||
"build": "tsc && yarn build:cjs",
|
||||
"build:cjs": "node ./esbuild.mjs",
|
||||
"test": "ava"
|
||||
"test": "node --loader ts-node/esm/transpile-only ../node_modules/ava/entrypoints/cli.mjs"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "nodenext",
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
|
@ -12,5 +12,9 @@
|
|||
"outDir": "dist",
|
||||
"allowJs": false
|
||||
},
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"ts-node": {
|
||||
"esm": true,
|
||||
"experimentalSpecifierResolution": "node"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import test from 'ava'
|
||||
|
||||
import { receiveString } from '../index'
|
||||
import { receiveString } from '..'
|
||||
|
||||
test('Function message', (t) => {
|
||||
// @ts-expect-error
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import test from 'ava'
|
||||
|
||||
import { Fib, Fib2, Fib3 } from '../index'
|
||||
import { Fib, Fib2, Fib3 } from '..'
|
||||
|
||||
for (const [index, factory] of [
|
||||
() => new Fib(),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import test from 'ava'
|
||||
|
||||
import { NotWritableClass } from '../index'
|
||||
import { NotWritableClass } from '..'
|
||||
|
||||
test('Not Writable Class', (t) => {
|
||||
const obj = new NotWritableClass('1')
|
||||
|
|
|
@ -20,7 +20,7 @@ import {
|
|||
returnUndefinedIfInvalid,
|
||||
returnUndefinedIfInvalidPromise,
|
||||
validateOptional,
|
||||
} from '../index'
|
||||
} from '..'
|
||||
|
||||
test('should validate array', (t) => {
|
||||
t.is(validateArray([1, 2, 3]), 3)
|
||||
|
|
|
@ -132,7 +132,7 @@ import {
|
|||
returnFromSharedCrate,
|
||||
chronoNativeDateTime,
|
||||
chronoNativeDateTimeReturn,
|
||||
} from '../'
|
||||
} from '..'
|
||||
|
||||
test('export const', (t) => {
|
||||
t.is(DEFAULT_COST, 12)
|
||||
|
@ -804,11 +804,7 @@ Napi4Test('throw error from thread safe function fatal mode', (t) => {
|
|||
return new Promise<void>((resolve) => {
|
||||
p.on('exit', (code) => {
|
||||
t.is(code, 1)
|
||||
t.true(
|
||||
stderr
|
||||
.toString('utf8')
|
||||
.includes(`[Error: Generic tsfn error] { code: 'GenericFailure' }`),
|
||||
)
|
||||
t.true(stderr.toString('utf8').includes(`[Error: Generic tsfn error]`))
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Worker } from 'worker_threads'
|
|||
|
||||
import test from 'ava'
|
||||
|
||||
import { Animal, Kind, DEFAULT_COST } from '../index'
|
||||
import { Animal, Kind, DEFAULT_COST } from '..'
|
||||
|
||||
// aarch64-unknown-linux-gnu is extremely slow in CI, skip it or it will timeout
|
||||
const t =
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { parentPort } = require('worker_threads')
|
||||
|
||||
const native = require('../index')
|
||||
const native = require('../index.node')
|
||||
|
||||
parentPort.on('message', ({ type }) => {
|
||||
switch (type) {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
"outDir": "./dist",
|
||||
"rootDir": "__tests__",
|
||||
"target": "ES2018",
|
||||
"skipLibCheck": false
|
||||
"skipLibCheck": false,
|
||||
"noEmit": true
|
||||
},
|
||||
"exclude": ["dist", "electron.js", "electron-renderer"]
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
"source-map-support": "^0.5.21",
|
||||
"ts-node": "^10.9.1",
|
||||
"tslib": "^2.5.0",
|
||||
"typescript": "^5.0.4"
|
||||
"typescript": "^5.1.3"
|
||||
},
|
||||
"packageManager": "yarn@3.6.0"
|
||||
}
|
||||
|
|
20
yarn.lock
20
yarn.lock
|
@ -581,7 +581,7 @@ __metadata:
|
|||
prettier: ^2.8.7
|
||||
ts-node: ^10.9.1
|
||||
typanion: ^3.12.1
|
||||
typescript: ^5.0.4
|
||||
typescript: ^5.1.3
|
||||
bin:
|
||||
napi: ./dist/cli.js
|
||||
napi-raw: ./cli.mjs
|
||||
|
@ -6933,7 +6933,7 @@ __metadata:
|
|||
source-map-support: ^0.5.21
|
||||
ts-node: ^10.9.1
|
||||
tslib: ^2.5.0
|
||||
typescript: ^5.0.4
|
||||
typescript: ^5.1.3
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
|
@ -9728,13 +9728,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@npm:^5.0.4":
|
||||
version: 5.0.4
|
||||
resolution: "typescript@npm:5.0.4"
|
||||
"typescript@npm:^5.0.4, typescript@npm:^5.1.3":
|
||||
version: 5.1.3
|
||||
resolution: "typescript@npm:5.1.3"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 82b94da3f4604a8946da585f7d6c3025fff8410779e5bde2855ab130d05e4fd08938b9e593b6ebed165bda6ad9292b230984f10952cf82f0a0ca07bbeaa08172
|
||||
checksum: d9d51862d98efa46534f2800a1071a613751b1585dc78884807d0c179bcd93d6e9d4012a508e276742f5f33c480adefc52ffcafaf9e0e00ab641a14cde9a31c7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
@ -9748,13 +9748,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@patch:typescript@^5.0.4#~builtin<compat/typescript>":
|
||||
version: 5.0.4
|
||||
resolution: "typescript@patch:typescript@npm%3A5.0.4#~builtin<compat/typescript>::version=5.0.4&hash=b5f058"
|
||||
"typescript@patch:typescript@^5.0.4#~builtin<compat/typescript>, typescript@patch:typescript@^5.1.3#~builtin<compat/typescript>":
|
||||
version: 5.1.3
|
||||
resolution: "typescript@patch:typescript@npm%3A5.1.3#~builtin<compat/typescript>::version=5.1.3&hash=5da071"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: d26b6ba97b6d163c55dbdffd9bbb4c211667ebebc743accfeb2c8c0154aace7afd097b51165a72a5bad2cf65a4612259344ff60f8e642362aa1695c760d303ac
|
||||
checksum: 6f0a9dca6bf4ce9dcaf4e282aade55ef4c56ecb5fb98d0a4a5c0113398815aea66d871b5611e83353e5953a19ed9ef103cf5a76ac0f276d550d1e7cd5344f61e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
|
Loading…
Reference in a new issue