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
210 changes: 89 additions & 121 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
check-latest: true
cache: yarn
- name: Install dependencies
run: yarn install
run: yarn install --immutable
- name: Run biome check
run: yarn biome check
format:
Expand All @@ -51,7 +51,7 @@ jobs:
- name: Install taplo
run: cargo install taplo-cli --locked
- name: Install dependencies
run: yarn install
run: yarn install --immutable
- name: Run rustfmt
run: cargo fmt --all --check
- name: Run taplo
Expand All @@ -64,7 +64,7 @@ jobs:
- name: Install rust
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
with:
toolchain: stable
toolchain: "1.91.0"
components: clippy
- name: Run clippy
run: cargo clippy
Expand All @@ -74,7 +74,7 @@ jobs:
fail-fast: false
matrix:
settings:
- host: macos-latest
- host: macos-15-intel
target: x86_64-apple-darwin
build: yarn build --target x86_64-apple-darwin
- host: macos-latest
Expand All @@ -86,65 +86,38 @@ jobs:
- host: windows-latest
target: aarch64-pc-windows-msvc
build: yarn build --target aarch64-pc-windows-msvc
- host: ubuntu-latest
- host: ubuntu-22.04
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: |-
rustup update stable &&
yarn build --target x86_64-unknown-linux-gnu
build: yarn build --target x86_64-unknown-linux-gnu --use-napi-cross
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |-
# `perl` needs for building openssl
set -e &&
apk add perl &&
rustup update stable &&
yarn build
- host: ubuntu-latest
build: yarn build --target x86_64-unknown-linux-musl -x
- host: ubuntu-22.04
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |-
# `perl` needs for building openssl
set -e &&
apt-get update &&
apt-get install -y perl &&
unset CC_aarch64_unknown_linux_gnu &&
unset CXX_aarch64_unknown_linux_gnu &&
rustup update stable &&
yarn build --target aarch64-unknown-linux-gnu
build: yarn build --target aarch64-unknown-linux-gnu --use-napi-cross
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |-
# `perl` needs for building openssl
set -e &&
apk add perl &&
rustup update stable &&
rustup target add aarch64-unknown-linux-musl &&
yarn build --target aarch64-unknown-linux-musl
build: yarn build --target aarch64-unknown-linux-musl -x
- host: ubuntu-latest
target: aarch64-linux-android
build: yarn build --target aarch64-linux-android
- host: ubuntu-latest
target: armv7-linux-androideabi
build: yarn build --target armv7-linux-androideabi
name: stable - ${{ matrix.settings.target }} - node@20
name: build (${{ matrix.settings.target }})
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup node
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
if: ${{ !matrix.settings.docker }}
with:
node-version-file: ".node-version"
check-latest: true
cache: yarn
- name: Install rust
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
if: ${{ !matrix.settings.docker }}
with:
toolchain: stable
toolchain: 1.91.0
targets: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
Expand All @@ -156,18 +129,22 @@ jobs:
.cargo-cache
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
- name: Install dependencies
run: yarn install
- name: Build in docker
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
if: ${{ matrix.settings.docker }}
- name: Setup zig
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # 2.2.1
if: ${{ contains(matrix.settings.target, 'musl') }}
with:
version: 0.14.1
- name: Install cargo-zigbuild
uses: taiki-e/install-action@288875dd3d64326724fa6d9593062d9f8ba0b131 # 2.67.30
if: ${{ contains(matrix.settings.target, 'musl') }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
image: ${{ matrix.settings.docker }}
options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build'
run: ${{ matrix.settings.build }}
tool: cargo-zigbuild
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
Expand All @@ -176,14 +153,14 @@ jobs:
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error
test-macos-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
name: test-macos (${{ matrix.settings.target }}), node@${{ matrix.node }})
needs:
- build
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
- host: macos-15-intel
target: "x86_64-apple-darwin"
architecture: "x64"
- host: macos-latest
Expand All @@ -192,6 +169,7 @@ jobs:
node:
- "18"
- "20"
- "22"
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand All @@ -203,7 +181,7 @@ jobs:
cache: yarn
architecture: ${{ matrix.settings.architecture }}
- name: Install dependencies
run: yarn install
run: yarn install --immutable
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
Expand All @@ -215,7 +193,7 @@ jobs:
- name: Test bindings
run: yarn vitest run
test-windows-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
name: test-windows (${{ matrix.settings.target }}), node@${{ matrix.node }})
needs:
- build
strategy:
Expand All @@ -224,9 +202,20 @@ jobs:
settings:
- host: windows-latest
target: x86_64-pc-windows-msvc
architecture: x64
- host: windows-11-arm
target: aarch64-pc-windows-msvc
architecture: arm64
node:
- '18'
- '20'
- "18"
- "20"
- "22"
exclude:
- settings:
host: windows-latest
target: aarch64-pc-windows-msvc
arch: arm64
node: "18"
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand All @@ -236,8 +225,9 @@ jobs:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
architecture: ${{ matrix.architecture }}
- name: Install dependencies
run: yarn install
run: yarn install --immutable
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
Expand All @@ -248,48 +238,23 @@ jobs:
shell: bash
- name: Test bindings
run: yarn vitest run
test-linux-x64-gnu-binding:
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
test-linux-binding:
name: test-linux-binding (${{ matrix.target }}, node@${{ matrix.node }})
needs:
- build
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
node:
- '18'
- '20'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup node
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
- name: Install dependencies
run: yarn install
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: bindings-x86_64-unknown-linux-gnu
path: .
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn vitest run
test-linux-x64-musl-binding:
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
node:
- '18'
- '20'
runs-on: ubuntu-latest
- "18"
- "20"
- "22"
runs-on: ${{ contains(matrix.target, 'aarch64') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup node
Expand All @@ -298,45 +263,48 @@ jobs:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
- name: Output docker params
id: docker
run: |
node -e "
if ('${{ matrix.target }}'.startsWith('aarch64')) {
console.log('PLATFORM=linux/arm64')
} else if ('${{ matrix.target }}'.startsWith('armv7')) {
console.log('PLATFORM=linux/arm/v7')
} else {
console.log('PLATFORM=linux/amd64')
}
" >> $GITHUB_OUTPUT
node -e "
if ('${{ matrix.target }}'.endsWith('-musl')) {
console.log('IMAGE=node:${{ matrix.node }}-alpine')
} else {
console.log('IMAGE=node:${{ matrix.node }}-slim')
}
" >> $GITHUB_OUTPUT
- name: Install dependencies
run: |
yarn config set supportedArchitectures.libc "musl"
yarn config set --json supportedArchitectures.cpu '["current", "arm64", "x64", "arm"]'
yarn config set --json supportedArchitectures.libc '["current", "musl", "gnu"]'
yarn install
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: bindings-x86_64-unknown-linux-musl
name: bindings-${{ matrix.target }}
path: .
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn vitest run
test-linux-aarch64-gnu-binding:
name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
node:
- '18'
- '20'
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
if: ${{ contains(matrix.target, 'armv7') }}
with:
name: bindings-aarch64-unknown-linux-gnu
path: .
- name: List packages
run: ls -R .
shell: bash
- name: Install dependencies
run: |
yarn config set supportedArchitectures.cpu "arm64"
yarn config set supportedArchitectures.libc "glibc"
yarn install
platforms: all
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
if: ${{ contains(matrix.target, 'armv7') }}
- name: Test bindings
run: yarn vitest run
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
with:
image: ${{ steps.docker.outputs.IMAGE }}
options: '-v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }}'
run: yarn vitest run
Loading