|
@@ -3,8 +3,7 @@ env:
|
|
|
DEBUG: napi:*
|
|
|
APP_NAME: package-template
|
|
|
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
|
|
-
|
|
|
-on:
|
|
|
+'on':
|
|
|
push:
|
|
|
branches:
|
|
|
- main
|
|
@@ -12,12 +11,11 @@ on:
|
|
|
- '**'
|
|
|
paths-ignore:
|
|
|
- '**/*.md'
|
|
|
- - 'LICENSE'
|
|
|
+ - LICENSE
|
|
|
- '**/*.gitignore'
|
|
|
- - '.editorconfig'
|
|
|
- - 'docs/**'
|
|
|
+ - .editorconfig
|
|
|
+ - docs/**
|
|
|
pull_request: null
|
|
|
-
|
|
|
jobs:
|
|
|
build:
|
|
|
if: "!contains(github.event.head_commit.message, 'skip ci')"
|
|
@@ -27,34 +25,32 @@ jobs:
|
|
|
settings:
|
|
|
- host: macos-latest
|
|
|
target: x86_64-apple-darwin
|
|
|
+ architecture: x64
|
|
|
build: |
|
|
|
yarn build
|
|
|
strip -x *.node
|
|
|
- host: windows-latest
|
|
|
build: yarn build
|
|
|
target: x86_64-pc-windows-msvc
|
|
|
+ architecture: x64
|
|
|
- host: windows-latest
|
|
|
build: |
|
|
|
- export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=32;
|
|
|
- export CARGO_PROFILE_RELEASE_LTO=false
|
|
|
yarn build --target i686-pc-windows-msvc
|
|
|
yarn test
|
|
|
target: i686-pc-windows-msvc
|
|
|
- setup: |
|
|
|
- choco install nodejs-lts --x86 -y --force
|
|
|
- echo "C:\Program Files (x86)\nodejs" >> $GITHUB_PATH
|
|
|
+ architecture: x86
|
|
|
- host: ubuntu-latest
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
+ architecture: x64
|
|
|
docker: |
|
|
|
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
|
|
|
docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian
|
|
|
docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian builder
|
|
|
build: |
|
|
|
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build && strip package-template.linux-x64-gnu.node
|
|
|
- host: ubuntu-latest
|
|
|
target: x86_64-unknown-linux-musl
|
|
|
+ architecture: x64
|
|
|
docker: |
|
|
|
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
|
|
|
docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
|
|
docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
|
|
|
build: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build && strip package-template.linux-x64-musl.node
|
|
@@ -64,6 +60,7 @@ jobs:
|
|
|
yarn build --target=aarch64-apple-darwin
|
|
|
strip -x *.node
|
|
|
- host: ubuntu-latest
|
|
|
+ architecture: x64
|
|
|
target: aarch64-unknown-linux-gnu
|
|
|
setup: |
|
|
|
sudo apt-get update
|
|
@@ -72,6 +69,7 @@ jobs:
|
|
|
yarn build --target=aarch64-unknown-linux-gnu
|
|
|
aarch64-linux-gnu-strip package-template.linux-arm64-gnu.node
|
|
|
- host: ubuntu-latest
|
|
|
+ architecture: x64
|
|
|
target: armv7-unknown-linux-gnueabihf
|
|
|
setup: |
|
|
|
sudo apt-get update
|
|
@@ -80,32 +78,49 @@ jobs:
|
|
|
yarn build --target=armv7-unknown-linux-gnueabihf
|
|
|
arm-linux-gnueabihf-strip package-template.linux-arm-gnueabihf.node
|
|
|
- host: ubuntu-latest
|
|
|
+ architecture: x64
|
|
|
target: aarch64-linux-android
|
|
|
build: |
|
|
|
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
|
|
|
+ export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
|
|
|
+ export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
|
|
|
+ export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
|
|
|
yarn build --target aarch64-linux-android
|
|
|
${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip *.node
|
|
|
- host: ubuntu-latest
|
|
|
+ architecture: x64
|
|
|
+ target: armv7-linux-androideabi
|
|
|
+ build: |
|
|
|
+ export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
|
|
|
+ export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
|
|
|
+ export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"
|
|
|
+ export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
|
|
|
+ yarn build --target armv7-linux-androideabi
|
|
|
+ ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip *.node
|
|
|
+ - host: ubuntu-latest
|
|
|
+ architecture: x64
|
|
|
target: aarch64-unknown-linux-musl
|
|
|
downloadTarget: aarch64-unknown-linux-musl
|
|
|
docker: |
|
|
|
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
|
|
|
docker pull ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
|
|
docker tag ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
|
|
|
build: |
|
|
|
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder sh -c "yarn build --target=aarch64-unknown-linux-musl && /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip package-template.linux-arm64-musl.node"
|
|
|
- host: windows-latest
|
|
|
+ architecture: x64
|
|
|
target: aarch64-pc-windows-msvc
|
|
|
build: yarn build --target aarch64-pc-windows-msvc
|
|
|
- name: stable - ${{ matrix.settings.target }} - node@14
|
|
|
+ name: stable - ${{ matrix.settings.target }} - node@16
|
|
|
runs-on: ${{ matrix.settings.host }}
|
|
|
steps:
|
|
|
- uses: actions/checkout@v2
|
|
|
- name: Setup node
|
|
|
uses: actions/setup-node@v2
|
|
|
with:
|
|
|
- node-version: 14
|
|
|
+ node-version: 16
|
|
|
check-latest: true
|
|
|
+ cache: yarn
|
|
|
+ architecture: ${{ matrix.settings.architecture }}
|
|
|
- name: Install
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
with:
|
|
@@ -121,23 +136,21 @@ jobs:
|
|
|
uses: actions/cache@v2
|
|
|
with:
|
|
|
path: ~/.cargo/registry
|
|
|
- key: ${{ matrix.settings.target }}-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
|
|
+ key: ${{ matrix.settings.target }}-node@16-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
|
|
- name: Cache cargo index
|
|
|
uses: actions/cache@v2
|
|
|
with:
|
|
|
path: ~/.cargo/git
|
|
|
- key: ${{ matrix.settings.target }}-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
|
|
+ key: ${{ matrix.settings.target }}-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
|
|
- name: Cache NPM dependencies
|
|
|
uses: actions/cache@v2
|
|
|
with:
|
|
|
path: node_modules
|
|
|
- key: npm-cache-${{ matrix.settings.target }}-node@14-${{ hashFiles('yarn.lock') }}
|
|
|
+ key: npm-cache-${{ matrix.settings.target }}-node@16-${{ hashFiles('yarn.lock') }}
|
|
|
- name: Pull latest image
|
|
|
run: ${{ matrix.settings.docker }}
|
|
|
env:
|
|
|
DOCKER_REGISTRY_URL: ghcr.io
|
|
|
- DOCKER_USERNAME: ${{ github.actor }}
|
|
|
- DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
|
|
if: ${{ matrix.settings.docker }}
|
|
|
- name: Setup toolchain
|
|
|
run: ${{ matrix.settings.setup }}
|
|
@@ -153,6 +166,7 @@ jobs:
|
|
|
with:
|
|
|
name: bindings-${{ matrix.settings.target }}
|
|
|
path: ${{ env.APP_NAME }}.*.node
|
|
|
+ if-no-files-found: error
|
|
|
build-freebsd:
|
|
|
runs-on: macos-10.15
|
|
|
name: Build FreeBSD
|
|
@@ -192,6 +206,7 @@ jobs:
|
|
|
freebsd-version
|
|
|
yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
|
|
yarn build
|
|
|
+ strip -x *.node
|
|
|
yarn test
|
|
|
rm -rf node_modules
|
|
|
rm -rf target
|
|
@@ -200,6 +215,7 @@ jobs:
|
|
|
with:
|
|
|
name: bindings-freebsd
|
|
|
path: ${{ env.APP_NAME }}.*.node
|
|
|
+ if-no-files-found: error
|
|
|
test-macOS-windows-binding:
|
|
|
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
|
|
|
needs:
|
|
@@ -222,6 +238,7 @@ jobs:
|
|
|
with:
|
|
|
node-version: ${{ matrix.node }}
|
|
|
check-latest: true
|
|
|
+ cache: yarn
|
|
|
- name: Cache NPM dependencies
|
|
|
uses: actions/cache@v2
|
|
|
with:
|
|
@@ -258,6 +275,7 @@ jobs:
|
|
|
with:
|
|
|
node-version: ${{ matrix.node }}
|
|
|
check-latest: true
|
|
|
+ cache: yarn
|
|
|
- name: Cache NPM dependencies
|
|
|
uses: actions/cache@v2
|
|
|
with:
|
|
@@ -294,6 +312,7 @@ jobs:
|
|
|
with:
|
|
|
node-version: ${{ matrix.node }}
|
|
|
check-latest: true
|
|
|
+ cache: yarn
|
|
|
- name: Cache NPM dependencies
|
|
|
uses: actions/cache@v2
|
|
|
with:
|
|
@@ -347,6 +366,7 @@ jobs:
|
|
|
image: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-${{ matrix.node }}
|
|
|
options: '-v ${{ github.workspace }}:/build -w /build'
|
|
|
run: |
|
|
|
+ set -e
|
|
|
yarn test
|
|
|
ls -la
|
|
|
test-linux-aarch64-musl-binding:
|
|
@@ -378,6 +398,7 @@ jobs:
|
|
|
image: multiarch/alpine:aarch64-latest-stable
|
|
|
options: '-v ${{ github.workspace }}:/build -w /build'
|
|
|
run: |
|
|
|
+ set -e
|
|
|
apk add nodejs npm yarn
|
|
|
yarn test
|
|
|
test-linux-arm-gnueabihf-binding:
|
|
@@ -416,6 +437,7 @@ jobs:
|
|
|
image: ghcr.io/napi-rs/napi-rs/nodejs:armhf-${{ matrix.node }}
|
|
|
options: '-v ${{ github.workspace }}:/build -w /build'
|
|
|
run: |
|
|
|
+ set -e
|
|
|
yarn test
|
|
|
ls -la
|
|
|
publish:
|
|
@@ -434,8 +456,9 @@ jobs:
|
|
|
- name: Setup node
|
|
|
uses: actions/setup-node@v2
|
|
|
with:
|
|
|
- node-version: 14
|
|
|
+ node-version: 16
|
|
|
check-latest: true
|
|
|
+ cache: yarn
|
|
|
- name: Cache NPM dependencies
|
|
|
uses: actions/cache@v2
|
|
|
with:
|