2023-07-18 11:38:53 +09:00
|
|
|
name: Test & Release
|
2020-02-18 22:09:17 +09:00
|
|
|
|
2020-10-15 17:14:11 +09:00
|
|
|
env:
|
|
|
|
DEBUG: 'napi:*'
|
2022-05-10 18:29:43 +09:00
|
|
|
RUST_BACKTRACE: 1
|
2023-06-17 18:03:57 +09:00
|
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
|
2020-10-15 17:14:11 +09:00
|
|
|
|
2023-03-12 19:31:13 +09:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2023-07-18 11:38:53 +09:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
id-token: write
|
|
|
|
|
2020-08-17 23:36:09 +09:00
|
|
|
on:
|
|
|
|
push:
|
2020-12-03 17:30:14 +09:00
|
|
|
branches:
|
|
|
|
- main
|
2020-08-17 23:36:09 +09:00
|
|
|
pull_request:
|
2020-02-18 22:09:17 +09:00
|
|
|
|
|
|
|
jobs:
|
2023-07-18 11:38:53 +09:00
|
|
|
lint:
|
|
|
|
name: Lint SourceCode
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-09-04 23:34:40 +09:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-18 11:38:53 +09:00
|
|
|
|
|
|
|
- name: Setup node
|
2023-10-24 12:03:35 +09:00
|
|
|
uses: actions/setup-node@v4
|
2023-07-18 11:38:53 +09:00
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
cache: 'yarn'
|
|
|
|
|
|
|
|
- name: Install
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
components: rustfmt, clippy
|
|
|
|
|
|
|
|
- name: Cache cargo
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
key: lint-cargo-cache
|
|
|
|
|
|
|
|
- name: 'Install dependencies'
|
|
|
|
run: yarn install --immutable --mode=skip-build
|
|
|
|
|
|
|
|
- name: 'Lint JS/TS'
|
|
|
|
run: yarn lint
|
|
|
|
|
|
|
|
- name: Cargo fmt
|
|
|
|
run: cargo fmt -- --check
|
|
|
|
|
|
|
|
- name: Clippy
|
|
|
|
run: cargo clippy
|
|
|
|
|
2020-02-18 22:09:17 +09:00
|
|
|
build_and_test:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-11-02 13:57:11 +09:00
|
|
|
node: ['18', '20']
|
2023-06-17 18:03:57 +09:00
|
|
|
settings:
|
|
|
|
- host: ubuntu-latest
|
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
build: yarn build:test
|
|
|
|
test: |
|
|
|
|
yarn test:cli
|
|
|
|
yarn test --verbose
|
2023-11-02 13:57:11 +09:00
|
|
|
yarn tsc -p examples/napi/tsconfig.json --noEmit --skipLibCheck
|
2023-06-17 18:03:57 +09:00
|
|
|
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
|
2023-11-02 13:57:11 +09:00
|
|
|
yarn tsc -p examples/napi/tsconfig.json --noEmit --skipLibCheck
|
2023-06-17 18:03:57 +09:00
|
|
|
yarn test:macro
|
2023-10-17 21:18:29 +09:00
|
|
|
toolchain: 1.65.0
|
2023-06-17 18:03:57 +09:00
|
|
|
- host: macos-latest
|
|
|
|
target: x86_64-apple-darwin
|
|
|
|
build: yarn build:test
|
|
|
|
test: |
|
|
|
|
yarn test:cli
|
|
|
|
yarn test --verbose
|
2023-11-02 13:57:11 +09:00
|
|
|
yarn tsc -p examples/napi/tsconfig.json --noEmit --skipLibCheck
|
2023-06-17 18:03:57 +09:00
|
|
|
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
|
2023-11-02 13:57:11 +09:00
|
|
|
yarn tsc -p examples/napi/tsconfig.json --noEmit --skipLibCheck
|
2023-06-17 18:03:57 +09:00
|
|
|
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:
|
2023-10-17 21:18:29 +09:00
|
|
|
toolchain: 1.65.0
|
2023-06-17 18:03:57 +09:00
|
|
|
node: 18
|
|
|
|
- settings:
|
2023-10-17 21:18:29 +09:00
|
|
|
toolchain: 1.65.0
|
2023-06-17 18:03:57 +09:00
|
|
|
node: 20
|
|
|
|
- settings:
|
|
|
|
target: i686-pc-windows-msvc
|
|
|
|
node: 18
|
2023-07-24 01:36:24 +09:00
|
|
|
name: ${{ matrix.settings.host }} - node@${{ matrix.node }} - toolchain@ ${{ matrix.settings.toolchain }}
|
2023-06-17 18:03:57 +09:00
|
|
|
runs-on: ${{ matrix.settings.host }}
|
2020-02-18 22:09:17 +09:00
|
|
|
|
|
|
|
steps:
|
2023-09-04 23:34:40 +09:00
|
|
|
- uses: actions/checkout@v4
|
2020-05-06 00:13:23 +09:00
|
|
|
|
2020-02-18 22:09:17 +09:00
|
|
|
- name: Setup node
|
2023-10-24 12:03:35 +09:00
|
|
|
uses: actions/setup-node@v4
|
2020-02-18 22:09:17 +09:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node }}
|
2021-11-19 15:58:21 +09:00
|
|
|
cache: 'yarn'
|
2020-07-29 23:04:47 +09:00
|
|
|
|
|
|
|
- name: Install
|
2023-03-12 19:24:48 +09:00
|
|
|
uses: dtolnay/rust-toolchain@stable
|
2020-07-29 23:04:47 +09:00
|
|
|
with:
|
2023-06-17 18:03:57 +09:00
|
|
|
toolchain: ${{ matrix.settings.toolchain }}
|
|
|
|
targets: ${{ matrix.settings.target }}
|
2020-07-29 23:04:47 +09:00
|
|
|
|
2022-04-01 15:29:51 +09:00
|
|
|
- name: Cache cargo
|
|
|
|
uses: actions/cache@v3
|
2020-02-18 22:09:17 +09:00
|
|
|
with:
|
2022-04-01 15:29:51 +09:00
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
2022-04-15 22:22:04 +09:00
|
|
|
target
|
2023-06-17 18:03:57 +09:00
|
|
|
key: ${{ matrix.settings.host }}-${{ matrix.settings.toolchain }}-${{ matrix.settings.target }}-cargo-cache
|
2020-07-29 23:04:47 +09:00
|
|
|
|
|
|
|
- name: 'Install dependencies'
|
2023-07-17 15:56:02 +09:00
|
|
|
shell: bash
|
2022-04-01 15:29:51 +09:00
|
|
|
run: yarn install --mode=skip-build --immutable
|
2020-07-29 23:04:47 +09:00
|
|
|
|
2020-05-12 14:59:20 +09:00
|
|
|
- name: Check build
|
2023-06-17 18:03:57 +09:00
|
|
|
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
|
2023-10-24 12:03:35 +09:00
|
|
|
uses: actions/setup-node@v4
|
2023-06-17 18:03:57 +09:00
|
|
|
if: matrix.settings.target == 'i686-pc-windows-msvc'
|
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
architecture: 'x86'
|
2020-02-18 22:09:17 +09:00
|
|
|
|
2020-06-17 21:33:28 +09:00
|
|
|
- name: Unit tests
|
2023-06-17 18:03:57 +09:00
|
|
|
if: matrix.settings.test
|
|
|
|
run: ${{ matrix.settings.test }}
|
2022-05-10 18:29:43 +09:00
|
|
|
|
|
|
|
- name: Electron tests
|
2023-06-17 18:03:57 +09:00
|
|
|
if: matrix.settings.target == 'x86_64-apple-darwin' || matrix.settings.target == 'x86_64-pc-windows-msvc'
|
2022-05-10 18:29:43 +09:00
|
|
|
run: |
|
|
|
|
node ./node_modules/electron/install.js
|
|
|
|
yarn test:electron
|
|
|
|
|
|
|
|
- name: Electron tests
|
2023-06-17 18:03:57 +09:00
|
|
|
if: matrix.settings.target == 'x86_64-unknown-linux-gnu'
|
2022-05-10 18:29:43 +09:00
|
|
|
run: |
|
|
|
|
node ./node_modules/electron/install.js
|
|
|
|
xvfb-run --auto-servernum yarn test:electron
|
2023-05-27 13:00:43 +09:00
|
|
|
|
|
|
|
- name: Test build with profile
|
|
|
|
run: yarn workspace @examples/napi build --profile napi-rs-custom
|
2023-06-17 18:03:57 +09:00
|
|
|
|
|
|
|
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:
|
2023-09-04 23:34:40 +09:00
|
|
|
- uses: actions/checkout@v4
|
2023-06-17 18:03:57 +09:00
|
|
|
|
|
|
|
- name: Setup node
|
2023-10-24 12:03:35 +09:00
|
|
|
uses: actions/setup-node@v4
|
2023-06-17 18:03:57 +09:00
|
|
|
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:
|
2023-09-04 23:34:40 +09:00
|
|
|
- uses: actions/checkout@v4
|
2023-06-17 18:03:57 +09:00
|
|
|
|
|
|
|
- name: Setup node
|
2023-10-24 12:03:35 +09:00
|
|
|
uses: actions/setup-node@v4
|
2023-06-17 18:03:57 +09:00
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
cache: 'yarn'
|
|
|
|
|
|
|
|
- name: Install dependencies
|
2023-07-17 15:56:02 +09:00
|
|
|
run: |
|
|
|
|
yarn config set supportedArchitectures.cpu --json '["x64", "arm64"]'
|
|
|
|
yarn config set supportedArchitectures.libc --json '["musl", "glibc"]'
|
|
|
|
yarn install --immutable --mode=skip-build
|
2023-06-17 18:03:57 +09:00
|
|
|
|
|
|
|
- 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 }}
|
2023-07-24 01:36:24 +09:00
|
|
|
chmod 777 -R .cargo-cache
|
|
|
|
chmod 777 -R target
|
2023-06-17 18:03:57 +09:00
|
|
|
|
|
|
|
- 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:
|
2023-11-02 13:57:11 +09:00
|
|
|
node: [18, 20]
|
2023-06-17 18:03:57 +09:00
|
|
|
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:
|
2023-09-04 23:34:40 +09:00
|
|
|
- uses: actions/checkout@v4
|
2023-06-17 18:03:57 +09:00
|
|
|
|
|
|
|
- name: Setup node
|
2023-10-24 12:03:35 +09:00
|
|
|
uses: actions/setup-node@v4
|
2023-06-17 18:03:57 +09:00
|
|
|
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
|
2023-09-14 06:15:18 +09:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2023-06-17 18:03:57 +09:00
|
|
|
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 }}
|
2023-07-24 01:36:24 +09:00
|
|
|
options: ${{ matrix.settings.args }} -v ${{ github.workspace }}/cores:/cores -v ${{ github.workspace }}:/build -w /build
|
|
|
|
run: >-
|
|
|
|
ulimit -c &&
|
|
|
|
ulimit -c unlimited &&
|
|
|
|
ulimit -c &&
|
|
|
|
yarn test
|
|
|
|
- name: List files
|
|
|
|
run: |
|
|
|
|
ls -la .
|
|
|
|
ls -la ./cores
|
2023-07-18 11:38:53 +09:00
|
|
|
|
|
|
|
build-and-test-linux-armv7:
|
|
|
|
name: stable - armv7-unknown-linux-gnu - node@18
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-09-04 23:34:40 +09:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-18 11:38:53 +09:00
|
|
|
|
|
|
|
- name: Setup node
|
2023-10-24 12:03:35 +09:00
|
|
|
uses: actions/setup-node@v4
|
2023-07-18 11:38:53 +09:00
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
cache: 'yarn'
|
|
|
|
|
|
|
|
- name: Install
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
targets: armv7-unknown-linux-gnueabihf
|
|
|
|
|
|
|
|
- name: Install ziglang
|
|
|
|
uses: goto-bus-stop/setup-zig@v2
|
|
|
|
with:
|
2023-09-20 17:18:01 +09:00
|
|
|
version: 0.11.0
|
2023-07-18 11:38:53 +09:00
|
|
|
|
|
|
|
- name: Cache cargo
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: stable-linux-armv7-gnu-node@18-cargo-cache
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
yarn config set --json supportedArchitectures.cpu '["arm", "current"]'
|
|
|
|
yarn install --immutable --mode=skip-build
|
|
|
|
|
|
|
|
- name: Cross build native tests
|
|
|
|
run: yarn build:test -- --target armv7-unknown-linux-gnueabihf --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-bullseye-slim
|
|
|
|
options: --platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build
|
|
|
|
run: yarn test
|
|
|
|
|
|
|
|
build_binary_crate:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Test cli build binary
|
|
|
|
steps:
|
2023-09-04 23:34:40 +09:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-18 11:38:53 +09:00
|
|
|
|
|
|
|
- name: Setup node
|
2023-10-24 12:03:35 +09:00
|
|
|
uses: actions/setup-node@v4
|
2023-07-18 11:38:53 +09:00
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
cache: 'yarn'
|
|
|
|
|
|
|
|
- name: Install
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
|
|
|
|
- name: Cache cargo
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: stable-cargo-cache-build-binary
|
|
|
|
|
|
|
|
- name: 'Install dependencies'
|
|
|
|
run: yarn install --mode=skip-build --immutable
|
|
|
|
|
|
|
|
- name: Build and run binary
|
|
|
|
run: |
|
|
|
|
yarn workspace binary build
|
|
|
|
./examples/binary/napi-examples-binary
|
|
|
|
yarn workspace binary build --profile napi-rs-custom
|
|
|
|
|
|
|
|
check-all-features:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
settings:
|
|
|
|
- features: 'napi1,napi2,napi3,napi4,napi5,napi6,napi7,napi8,experimental,async,chrono_date,latin1,full'
|
|
|
|
package: 'napi'
|
|
|
|
- features: 'compat-mode,strict,type-def,noop,full,default'
|
|
|
|
package: 'napi-derive'
|
|
|
|
name: stable - ubuntu-latest
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-09-04 23:34:40 +09:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-18 11:38:53 +09:00
|
|
|
|
|
|
|
- name: Install
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
|
|
|
|
- name: Check build
|
|
|
|
run: cargo check -p ${{ matrix.settings.package }} -F ${{ matrix.settings.features }}
|
|
|
|
|
2023-11-02 13:57:11 +09:00
|
|
|
test-node-wasi:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Test node wasi target
|
|
|
|
timeout-minutes: 10
|
|
|
|
continue-on-error: true
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup node
|
2023-11-02 22:57:29 +09:00
|
|
|
uses: actions/setup-node@v4
|
2023-11-02 13:57:11 +09:00
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
cache: 'yarn'
|
|
|
|
- name: Install
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
targets: wasm32-wasi-preview1-threads
|
|
|
|
- name: Cache cargo
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: stable-wasm32-wasi-preview1-threads-node@18-cargo-cache
|
|
|
|
- name: Install dependencies
|
|
|
|
run: yarn install --immutable --mode=skip-build
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
yarn build
|
2023-11-07 02:46:43 +09:00
|
|
|
yarn workspace @examples/napi build --target wasm32-wasi-preview1-threads --release
|
2023-11-02 13:57:11 +09:00
|
|
|
- name: Test
|
|
|
|
run: yarn workspace @examples/napi test -s
|
|
|
|
env:
|
|
|
|
WASI_TEST: 'true'
|
2023-11-07 02:46:43 +09:00
|
|
|
NODE_OPTIONS: '--max-old-space-size=8192'
|
2023-11-02 13:57:11 +09:00
|
|
|
|
2023-09-20 17:18:01 +09:00
|
|
|
test-latest-bun:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Test latest bun
|
|
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: oven-sh/setup-bun@v1
|
|
|
|
with:
|
|
|
|
bun-version: latest
|
|
|
|
- name: Setup node
|
2023-10-24 12:03:35 +09:00
|
|
|
uses: actions/setup-node@v4
|
2023-09-20 17:18:01 +09:00
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
cache: 'yarn'
|
|
|
|
- name: Install
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
targets: x86_64-unknown-linux-gnu
|
|
|
|
- name: Cache cargo
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: stable-x86_64-unknown-linux-gnu-node@18-cargo-cache
|
|
|
|
- name: Install dependencies
|
|
|
|
run: yarn install --immutable --mode=skip-build
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
bun run build
|
|
|
|
bun run build:test
|
|
|
|
- name: Test
|
2023-11-06 12:03:44 +09:00
|
|
|
continue-on-error: true
|
2023-09-20 17:18:01 +09:00
|
|
|
run: bun run test:bun
|
|
|
|
|
2023-07-18 11:38:53 +09:00
|
|
|
release-npm:
|
|
|
|
runs-on: ubuntu-latest
|
2023-07-19 11:39:21 +09:00
|
|
|
needs:
|
|
|
|
- lint
|
|
|
|
- build_binary_crate
|
2023-07-18 11:38:53 +09:00
|
|
|
if: "startsWith(github.event.head_commit.message, 'chore(release): publish')"
|
|
|
|
steps:
|
2023-09-04 23:34:40 +09:00
|
|
|
- uses: actions/checkout@v4
|
2023-10-24 12:03:35 +09:00
|
|
|
- uses: actions/setup-node@v4
|
2023-07-18 11:38:53 +09:00
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
cache: 'yarn'
|
|
|
|
- name: Publish
|
|
|
|
run: |
|
|
|
|
yarn install --mode=skip-build
|
|
|
|
yarn build
|
|
|
|
npm config set provenance true
|
|
|
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
|
|
|
yarn lerna publish from-package --pre-dist-tag canary --yes
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|