chore(deps): lock file maintenance #100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pure Rust project build on Linux | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
DEBUG: 'napi:*' | |
MACOSX_DEPLOYMENT_TARGET: '10.13' | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
targets: | |
[ | |
'x86_64-apple-darwin', | |
'aarch64-apple-darwin', | |
'x86_64-pc-windows-msvc', | |
'i686-pc-windows-msvc', | |
'aarch64-pc-windows-msvc', | |
'x86_64-unknown-linux-gnu', | |
'aarch64-unknown-linux-gnu', | |
'x86_64-unknown-linux-musl', | |
'aarch64-unknown-linux-musl', | |
'armv7-unknown-linux-gnueabihf', | |
'aarch64-linux-android', | |
'armv7-linux-androideabi', | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo | |
${{ github.workspace }}/.xwin | |
~/.napi-rs | |
./target | |
key: ${{ matrix.targets }}-cargo-cache | |
- name: Install | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: ${{ matrix.targets }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'yarn' | |
- name: Install ziglang | |
uses: goto-bus-stop/setup-zig@v1 | |
with: | |
version: 0.13.0 | |
- name: Install cargo toolchains | |
uses: taiki-e/install-action@v2 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
tool: cargo-zigbuild,cargo-xwin | |
- run: yarn install | |
- run: yarn workspace @napi-cross-build/01-pure-rust build --target ${{ matrix.targets }} | |
env: | |
XWIN_CACHE_DIR: ${{ github.workspace }}/.xwin | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: bindings-${{ matrix.targets }} | |
path: 01-pure-rust/*.node | |
if-no-files-found: error | |
test-host: | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- target: x86_64-apple-darwin | |
host: macos-latest | |
- target: aarch64-apple-darwin | |
host: macos-latest | |
- target: x86_64-pc-windows-msvc | |
host: windows-latest | |
- target: i686-pc-windows-msvc | |
host: windows-latest | |
node: ['18', '20'] | |
runs-on: ${{ matrix.settings.host }} | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
if: matrix.settings.target != 'aarch64-apple-darwin' | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'yarn' | |
architecture: x64 | |
- uses: actions/setup-node@v4 | |
if: matrix.settings.target == 'aarch64-apple-darwin' | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'yarn' | |
architecture: arm64 | |
- name: Setup node x86 | |
if: matrix.settings.target == 'i686-pc-windows-msvc' | |
run: yarn config set supportedArchitectures.cpu "ia32" | |
shell: bash | |
- name: Install dependencies | |
run: yarn install | |
- name: Setup node x86 | |
uses: actions/setup-node@v4 | |
if: matrix.settings.target == 'i686-pc-windows-msvc' | |
with: | |
node-version: 20 | |
cache: yarn | |
architecture: x86 | |
- name: Download bindings | |
uses: actions/download-artifact@v4 | |
with: | |
name: bindings-${{ matrix.settings.target }} | |
path: 01-pure-rust/ | |
- name: Run tests | |
run: yarn workspace @napi-cross-build/01-pure-rust test | |
test-docker: | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- target: x86_64-unknown-linux-gnu | |
docker: node:18-slim | |
args: '' | |
- target: aarch64-unknown-linux-gnu | |
docker: node:18-slim | |
args: '--platform linux/arm64' | |
- target: x86_64-unknown-linux-musl | |
docker: node:18-alpine | |
args: '' | |
- target: aarch64-unknown-linux-musl | |
docker: node:18-alpine | |
args: '--platform linux/arm64' | |
- target: armv7-unknown-linux-gnueabihf | |
docker: node:18-bullseye-slim | |
args: '--platform linux/arm/v7' | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- name: Download bindings | |
uses: actions/download-artifact@v4 | |
with: | |
name: bindings-${{ matrix.settings.target }} | |
path: 01-pure-rust/ | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64,arm | |
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Run tests | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: ${{ matrix.settings.docker }} | |
options: ${{ matrix.settings.args }} -v ${{ github.workspace }}:/build -w /build | |
run: | | |
set -e | |
yarn workspace @napi-cross-build/01-pure-rust test |