84701ef879
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/cache](https://togithub.com/actions/cache) | action | major | `v3` -> `v4` | --- ### Release Notes <details> <summary>actions/cache (actions/cache)</summary> ### [`v4`](https://togithub.com/actions/cache/compare/v3...v4) [Compare Source](https://togithub.com/actions/cache/compare/v3...v4) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/napi-rs/napi-rs). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzNS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
146 lines
4.4 KiB
YAML
146 lines
4.4 KiB
YAML
name: Zig-Cross-Compile
|
|
|
|
env:
|
|
DEBUG: 'napi:*'
|
|
TEST_ZIG_CROSS: '1'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
name: Zig-Cross-Compile-On-Linux
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target:
|
|
[
|
|
'x86_64-apple-darwin',
|
|
'x86_64-unknown-linux-musl',
|
|
'aarch64-unknown-linux-musl',
|
|
]
|
|
|
|
steps:
|
|
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
|
- uses: actions/checkout@v4
|
|
- name: Setup node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'yarn'
|
|
- name: Install
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
toolchain: stable
|
|
targets: ${{ matrix.target }}
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: stable-zig-${{ matrix.target }}-cargo-cache
|
|
- name: Install aarch64 toolchain
|
|
run: rustup target add aarch64-unknown-linux-gnu
|
|
- name: Install ziglang
|
|
uses: goto-bus-stop/setup-zig@v2
|
|
with:
|
|
version: 0.11.0
|
|
- name: Install dependencies
|
|
run: yarn install --immutable --mode=skip-build
|
|
- name: install MacOS SDK
|
|
if: contains(matrix.target, 'apple')
|
|
run: |
|
|
curl -L "https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz" | tar -J -x -C /opt
|
|
- name: Cross build native tests
|
|
env:
|
|
SDKROOT: /opt/MacOSX11.3.sdk
|
|
run: |
|
|
yarn build:test -- --target ${{ matrix.target }} --cross-compile
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: compat-${{ matrix.target }}
|
|
path: ./examples/napi-compat-mode/index.node
|
|
if-no-files-found: error
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: napi-${{ matrix.target }}
|
|
path: ./examples/napi/index.node
|
|
if-no-files-found: error
|
|
|
|
test:
|
|
name: Test Zig Cross Compiled ${{ matrix.settings.target }}
|
|
runs-on: ${{ matrix.settings.host }}
|
|
needs:
|
|
- build
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
settings:
|
|
- host: ubuntu-latest
|
|
target: x86_64-unknown-linux-musl
|
|
- host: macos-latest
|
|
target: x86_64-apple-darwin
|
|
- host: ubuntu-latest
|
|
target: aarch64-unknown-linux-musl
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'yarn'
|
|
- name: Install dependencies
|
|
run: |
|
|
yarn config set --json supportedArchitectures.libc '["current", "musl"]'
|
|
yarn config set --json supportedArchitectures.cpu '["current", "arm64"]'
|
|
yarn install --immutable --mode=skip-build
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: napi-${{ matrix.settings.target }}
|
|
path: ./examples/napi/
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: compat-${{ matrix.settings.target }}
|
|
path: ./examples/napi-compat-mode/
|
|
- name: List files
|
|
run: |
|
|
ls ./examples/napi
|
|
ls ./examples/napi-compat-mode
|
|
- name: Test
|
|
run: yarn test --verbose
|
|
env:
|
|
SKIP_UNWIND_TEST: 1
|
|
if: matrix.settings.host == 'macos-latest'
|
|
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
if: matrix.settings.host == 'ubuntu-latest'
|
|
- name: Test
|
|
uses: addnab/docker-run-action@v3
|
|
if: matrix.settings.target == 'aarch64-unknown-linux-musl'
|
|
with:
|
|
image: node:lts-alpine
|
|
options: --platform linux/arm64 -v ${{ github.workspace }}:/build -w /build
|
|
run: |
|
|
set -e
|
|
yarn test
|
|
- name: Test
|
|
uses: addnab/docker-run-action@v3
|
|
if: matrix.settings.target == 'x86_64-unknown-linux-musl'
|
|
with:
|
|
image: node:lts-alpine
|
|
options: -v ${{ github.workspace }}:/napi-rs -w /napi-rs
|
|
run: yarn test
|