2020-09-18 20:07:28 +03:00
|
|
|
name: Publish (node)
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
on:
|
|
|
|
create:
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_INCREMENTAL: 0
|
2020-09-18 20:07:28 +03:00
|
|
|
CI: "1"
|
|
|
|
DEBUG: "napi:*"
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
2021-02-20 11:07:58 +03:00
|
|
|
fail-fast: false
|
2020-08-30 09:29:42 +03:00
|
|
|
matrix:
|
2021-02-23 19:53:36 +03:00
|
|
|
os: [ubuntu-18.04, macos-latest, windows-latest]
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
name: Build - ${{ matrix.os }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup node
|
2021-01-11 13:39:17 +03:00
|
|
|
uses: actions/setup-node@v2
|
2020-08-30 09:29:42 +03:00
|
|
|
with:
|
2020-12-30 08:30:09 +03:00
|
|
|
node-version: 14
|
2021-05-07 15:13:54 +03:00
|
|
|
|
2021-02-20 11:07:58 +03:00
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
- name: Install node dependencies
|
2020-09-05 11:48:22 +03:00
|
|
|
run: npm i
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
- name: Build
|
2020-09-07 06:45:11 +03:00
|
|
|
shell: bash
|
|
|
|
run: npm run build
|
|
|
|
env:
|
2020-09-18 20:07:28 +03:00
|
|
|
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
2020-09-07 06:45:11 +03:00
|
|
|
|
2020-08-30 09:29:42 +03:00
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: bindings
|
2020-12-30 08:30:09 +03:00
|
|
|
path: swc.*.node
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
- name: Test bindings
|
2020-09-05 11:48:22 +03:00
|
|
|
run: npm test
|
2020-08-30 09:29:42 +03:00
|
|
|
|
2021-02-23 19:53:36 +03:00
|
|
|
- name: Test in lts docker
|
|
|
|
if: matrix.os == 'ubuntu-18.04'
|
|
|
|
run: docker run --rm -v $(pwd):/swc -w /swc node:10-slim sh -c "yarn test"
|
|
|
|
|
2021-01-29 09:09:44 +03:00
|
|
|
build-windows-i686:
|
|
|
|
name: stable - windows-i686 - node@14
|
|
|
|
runs-on: windows-latest
|
|
|
|
env:
|
|
|
|
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 32
|
2021-05-07 15:13:54 +03:00
|
|
|
CARGO_PROFILE_RELEASE_LTO: "false"
|
2021-01-29 09:09:44 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install node x86
|
|
|
|
run: |
|
|
|
|
choco install nodejs-lts --x86 -y --force
|
|
|
|
refreshenv
|
2021-02-20 11:07:58 +03:00
|
|
|
|
2021-01-29 09:09:44 +03:00
|
|
|
- name: Set 32bit NodeJS path
|
|
|
|
run: |
|
|
|
|
echo "C:\\Program Files (x86)\\nodejs" >> $GITHUB_PATH
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: NodeJS arch
|
|
|
|
run: node -e "console.log(process.arch)"
|
|
|
|
|
2021-02-20 11:07:58 +03:00
|
|
|
- name: Install Rust
|
2021-01-29 09:09:44 +03:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
2021-02-20 11:07:58 +03:00
|
|
|
target: i686-pc-windows-msvc
|
2021-01-29 09:09:44 +03:00
|
|
|
|
|
|
|
- name: Install node dependencies
|
|
|
|
run: npm i
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
shell: bash
|
|
|
|
run: yarn build --target i686-pc-windows-msvc
|
|
|
|
|
|
|
|
- name: Test bindings
|
|
|
|
run: npm test
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: bindings
|
|
|
|
path: swc.*.node
|
|
|
|
|
2020-12-30 08:30:09 +03:00
|
|
|
build-linux-musl:
|
|
|
|
name: stable - linux-musl - node@10
|
2020-09-13 12:27:26 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Login to registry
|
|
|
|
run: |
|
|
|
|
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
|
|
|
|
env:
|
2021-04-30 06:20:39 +03:00
|
|
|
DOCKER_REGISTRY_URL: ghcr.io
|
2020-09-13 12:27:26 +03:00
|
|
|
DOCKER_USERNAME: ${{ github.actor }}
|
|
|
|
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2020-12-30 08:30:09 +03:00
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
target/
|
|
|
|
key: linux-musl-publish-integration
|
|
|
|
|
2020-09-13 12:27:26 +03:00
|
|
|
- name: Pull docker image
|
|
|
|
run: |
|
2021-04-30 06:20:39 +03:00
|
|
|
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
|
2021-02-20 11:07:58 +03:00
|
|
|
|
2020-09-18 20:07:28 +03:00
|
|
|
- name: "Install dependencies"
|
2020-12-30 08:30:09 +03:00
|
|
|
run: npm i
|
2020-09-13 12:27:26 +03:00
|
|
|
|
2020-09-18 20:07:28 +03:00
|
|
|
- name: "Build"
|
2020-09-13 12:27:26 +03:00
|
|
|
run: |
|
2020-12-30 08:30:09 +03:00
|
|
|
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/swc -w /swc builder sh -c "./node_modules/.bin/napi build --platform --cargo-name node --release -c ./package.json --cargo-flags='-p node'"
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: bindings
|
|
|
|
path: swc.*.node
|
|
|
|
|
|
|
|
build-apple-silicon:
|
2021-01-29 09:09:44 +03:00
|
|
|
name: stable - aarch64-apple-darwin - node@14
|
2020-12-30 08:30:09 +03:00
|
|
|
runs-on: macos-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2020-09-13 12:27:26 +03:00
|
|
|
|
2020-12-30 08:30:09 +03:00
|
|
|
- name: Setup node
|
2021-01-11 13:39:17 +03:00
|
|
|
uses: actions/setup-node@v2
|
2020-12-30 08:30:09 +03:00
|
|
|
with:
|
|
|
|
node-version: 14
|
|
|
|
|
2021-02-20 11:07:58 +03:00
|
|
|
- name: Install Rust
|
2020-12-30 08:30:09 +03:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
2021-02-20 11:07:58 +03:00
|
|
|
target: aarch64-apple-darwin
|
2020-12-30 08:30:09 +03:00
|
|
|
|
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
target/
|
|
|
|
key: aarch64-apple-darwin-publish-integration
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm i
|
|
|
|
|
|
|
|
- name: Cross build aarch64
|
|
|
|
run: yarn build --target aarch64-apple-darwin
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: bindings
|
|
|
|
path: swc.*.node
|
|
|
|
|
|
|
|
build-linux-aarch64:
|
|
|
|
name: stable - aarch64-unknown-linux-gnu - node@14
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
|
|
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup node
|
2021-01-11 13:39:17 +03:00
|
|
|
uses: actions/setup-node@v2
|
2020-12-30 08:30:09 +03:00
|
|
|
with:
|
|
|
|
node-version: 14
|
|
|
|
|
2021-02-20 11:07:58 +03:00
|
|
|
- name: Install Rust
|
2020-12-30 08:30:09 +03:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
2021-02-20 11:07:58 +03:00
|
|
|
target: aarch64-unknown-linux-gnu
|
2020-12-30 08:30:09 +03:00
|
|
|
|
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
target/
|
|
|
|
key: aarch64-linux-gnu-publish-integration
|
|
|
|
|
|
|
|
- name: Install cross compile toolchain
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm i
|
|
|
|
|
|
|
|
- name: Cross build aarch64
|
|
|
|
run: yarn build --target aarch64-unknown-linux-gnu
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: bindings
|
|
|
|
path: swc.*.node
|
2021-05-07 15:13:54 +03:00
|
|
|
|
2020-12-30 08:30:09 +03:00
|
|
|
build-linux-arm7:
|
|
|
|
name: stable - arm7-unknown-linux-gnu - node@14
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
|
|
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup node
|
2021-01-11 13:39:17 +03:00
|
|
|
uses: actions/setup-node@v2
|
2020-12-30 08:30:09 +03:00
|
|
|
with:
|
|
|
|
node-version: 14
|
|
|
|
|
2021-02-20 11:07:58 +03:00
|
|
|
- name: Install Rust
|
2020-12-30 08:30:09 +03:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
2021-02-20 11:07:58 +03:00
|
|
|
target: armv7-unknown-linux-gnueabihf
|
2020-12-30 08:30:09 +03:00
|
|
|
|
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
target/
|
|
|
|
key: arm7-linux-gnu-publish-integration
|
|
|
|
|
|
|
|
- name: Install cross compile toolchain
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install gcc-arm-linux-gnueabihf -y
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm i
|
|
|
|
|
|
|
|
- name: Cross build aarch64
|
|
|
|
run: yarn build --target armv7-unknown-linux-gnueabihf
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: bindings
|
|
|
|
path: swc.*.node
|
|
|
|
|
|
|
|
build-android-aarch64:
|
|
|
|
name: Build - Android - aarch64
|
|
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup node
|
2021-01-11 13:39:17 +03:00
|
|
|
uses: actions/setup-node@v2
|
2020-12-30 08:30:09 +03:00
|
|
|
with:
|
|
|
|
node-version: 14
|
|
|
|
|
2021-02-20 11:07:58 +03:00
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
target: aarch64-linux-android
|
2020-12-30 08:30:09 +03:00
|
|
|
|
|
|
|
- name: Install node dependencies
|
|
|
|
run: npm i
|
|
|
|
|
|
|
|
- name: Build
|
2020-09-13 12:27:26 +03:00
|
|
|
shell: bash
|
2020-12-30 08:30:09 +03:00
|
|
|
run: |
|
|
|
|
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang"
|
|
|
|
yarn build --target aarch64-linux-android
|
2020-09-13 12:27:26 +03:00
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: bindings
|
2020-12-30 08:30:09 +03:00
|
|
|
path: swc.*.node
|
|
|
|
|
2020-08-30 09:29:42 +03:00
|
|
|
publish:
|
|
|
|
name: npm
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- build
|
2021-01-29 09:09:44 +03:00
|
|
|
- build-windows-i686
|
2020-12-30 08:30:09 +03:00
|
|
|
- build-linux-musl
|
|
|
|
- build-linux-arm7
|
|
|
|
- build-linux-aarch64
|
|
|
|
- build-apple-silicon
|
2021-05-07 15:13:54 +03:00
|
|
|
# - build-android-aarch64
|
2020-08-30 09:29:42 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup node
|
2021-01-11 13:39:17 +03:00
|
|
|
uses: actions/setup-node@v2
|
2020-08-30 09:29:42 +03:00
|
|
|
with:
|
2020-12-30 08:30:09 +03:00
|
|
|
node-version: 14
|
2020-08-30 09:29:42 +03:00
|
|
|
|
2020-09-13 18:25:22 +03:00
|
|
|
- name: Set release name
|
2020-11-22 12:14:22 +03:00
|
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
2020-09-13 18:25:22 +03:00
|
|
|
|
2020-08-30 09:29:42 +03:00
|
|
|
- name: Install dependencies
|
|
|
|
run: npm i
|
|
|
|
|
|
|
|
- name: Download all artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
2020-09-05 11:48:22 +03:00
|
|
|
path: artifacts
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
- name: List binaries
|
2020-09-05 11:48:22 +03:00
|
|
|
run: ls -R artifacts
|
2020-08-30 09:29:42 +03:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Move binaries
|
|
|
|
shell: bash
|
2020-09-05 11:48:22 +03:00
|
|
|
run: npm run artifacts
|
2020-08-30 09:29:42 +03:00
|
|
|
|
2020-12-30 08:30:09 +03:00
|
|
|
- name: List npm
|
|
|
|
run: ls -R ./scripts/npm
|
|
|
|
shell: bash
|
|
|
|
|
2020-09-07 19:14:05 +03:00
|
|
|
- name: Publish
|
|
|
|
run: |
|
|
|
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
2020-12-23 06:01:49 +03:00
|
|
|
npm publish --access public
|
2020-09-07 19:14:05 +03:00
|
|
|
env:
|
2020-09-05 11:48:22 +03:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2020-09-07 19:14:05 +03:00
|
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|