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: Test CI2 | |
on: | |
push: | |
branches: | |
- test-ci2 | |
pull_request: {} | |
jobs: | |
build-nodejs-sdk: | |
strategy: | |
fail-fast: true | |
matrix: | |
settings: | |
- host: ubuntu-latest | |
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine | |
target: x86_64-unknown-linux-musl | |
build: | | |
npm run build | |
strip -x *.node | |
artifact-name: macos | |
- host: macos-13 | |
architecture: x64 | |
build: | | |
npm run build | |
strip -x *.node | |
artifact-name: macos | |
- host: windows-latest | |
build: npm run build | |
architecture: x64 | |
artifact-name: windows | |
- host: ubuntu-latest | |
build: | | |
npm run build | |
strip *.node | |
artifact-name: linux-x64 | |
- host: macos-13 | |
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"; | |
yarn build --target aarch64-apple-darwin | |
strip -x *.node | |
artifact-name: macos-aarch64 | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
if: ${{ !matrix.settings.docker }} | |
with: | |
node-version: 16 | |
check-latest: true | |
architecture: ${{ matrix.settings.architecture }} | |
- name: Install napi-rs/cli | |
if: ${{ !matrix.settings.docker }} | |
run: npm install -g @napi-rs/cli | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
if: ${{ !matrix.settings.docker }} | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
target: ${{ matrix.settings.target }} | |
- name: Build | |
if: ${{ !matrix.settings.docker }} | |
working-directory: nodejs | |
run: ${{ matrix.settings.build }} | |
- name: Build in Docker | |
uses: addnab/docker-run-action@v3 | |
if: ${{ matrix.settings.docker }} | |
with: | |
image: ${{ matrix.settings.docker }} | |
options: "--user 0:0 -v ${{ github.workspace }}:/nodejs -w /nodejs" | |
run: ${{ matrix.settings.build }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bindings-${{ matrix.settings.artifact-name }} | |
path: nodejs/longport.*.node |