Skip to content

chore: vendor glob reference implementation #1

chore: vendor glob reference implementation

chore: vendor glob reference implementation #1

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: Build (${{ matrix.settings.target }})
runs-on: ${{ matrix.settings.host }}
strategy:
fail-fast: false
matrix:
settings:
# Linux x64
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
build: |
npm run build
strip -x *.node
# Linux x64 musl
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: npm run build
# Linux ARM64
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: npm run build
# Linux ARM64 musl
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |-
rustup target add aarch64-unknown-linux-musl
npm run build -- --target aarch64-unknown-linux-musl
# macOS x64
- host: macos-latest
target: x86_64-apple-darwin
build: |
npm run build
strip -x *.node
# macOS ARM64
- host: macos-latest
target: aarch64-apple-darwin
build: |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*
export CC=$(xcrun -f clang)
export CXX=$(xcrun -f clang++)
SYSROOT=$(xcrun --sdk macosx --show-sdk-path)
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"
npm run build -- --target aarch64-apple-darwin
strip -x *.node
# Windows x64
- host: windows-latest
target: x86_64-pc-windows-msvc
build: npm run build
# Windows ARM64
- host: windows-latest
target: aarch64-pc-windows-msvc
build: npm run build -- --target aarch64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install Rust
uses: dtolnay/rust-action@stable
with:
targets: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.settings.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.settings.target }}-cargo-
- name: Install dependencies
run: npm ci
- name: Build in Docker
if: ${{ matrix.settings.docker }}
uses: addnab/docker-run-action@v3
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 }}
- name: Build
if: ${{ !matrix.settings.docker }}
run: ${{ matrix.settings.build }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: '*.node'
if-no-files-found: error