Skip to content

Commit

Permalink
Try fix release-node CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Dec 5, 2023
1 parent 2f2372d commit 868166f
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 281 deletions.
87 changes: 37 additions & 50 deletions .github/workflows/release-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: Release Node
env:
DEBUG: napi:*
APP_NAME: autocorrect-node
MACOSX_DEPLOYMENT_TARGET: "10.13"
MACOSX_DEPLOYMENT_TARGET: '10.13'
on:
push:
tags:
- "v*"
- 'v*'
branches:
- "release-node"
- 'release-node'
defaults:
run:
working-directory: autocorrect-node
Expand Down Expand Up @@ -57,15 +57,15 @@ jobs:
name: Build - ${{ matrix.settings.target }}- node
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
if: ${{ !matrix.settings.docker }}
with:
node-version: 16
node-version: 18
check-latest: true
cache: yarn
cache-dependency-path: "autocorrect-node/yarn.lock"
cache-dependency-path: 'autocorrect-node/yarn.lock'
- name: Install
uses: actions-rs/toolchain@v1
if: ${{ !matrix.settings.docker }}
Expand All @@ -84,6 +84,10 @@ jobs:
autocorrect-node/.cargo-cache
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
- uses: goto-bus-stop/setup-zig@v2
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
with:
version: 0.11.0
- name: Cache NPM dependencies
uses: actions/cache@v3
with:
Expand All @@ -103,17 +107,17 @@ jobs:
uses: actions/setup-node@v3
if: matrix.settings.target == 'i686-pc-windows-msvc'
with:
node-version: 16
node-version: 18
check-latest: true
cache: yarn
cache-dependency-path: "autocorrect-node/yarn.lock"
cache-dependency-path: 'autocorrect-node/yarn.lock'
architecture: x86
- 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 }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build"
options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build'
run: ${{ matrix.settings.build }}
- name: Build
run: ${{ matrix.settings.build }}
Expand All @@ -133,28 +137,23 @@ jobs:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
node:
- "16"
- "18"
- '18'
- '20'
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
cache-dependency-path: "autocorrect-node/yarn.lock"
- name: Cache NPM dependencies
uses: actions/cache@v3
with:
path: .yarn/cache
key: npm-cache-test-${{ matrix.settings.target }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install
run: cd autocorrect-node && yarn install
- name: Download artifacts
uses: actions/download-artifact@v3
with:
Expand All @@ -173,26 +172,18 @@ jobs:
fail-fast: false
matrix:
node:
- "14"
- "16"
- "18"
- '18'
- '20'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
cache-dependency-path: "autocorrect-node/yarn.lock"
- name: Cache NPM dependencies
uses: actions/cache@v3
with:
path: autocorrect-node/.yarn/cache
key: npm-cache-test-linux-x64-gnu-${{ matrix.node }}
- name: Install dependencies
run: yarn install
run: cd autocorrect-node/ && yarn install
- name: Download artifacts
uses: actions/download-artifact@v3
with:
Expand All @@ -204,33 +195,28 @@ jobs:
- name: Test bindings
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
test-linux-x64-musl-binding:
name: Test bindings on Linux-x64-musl - node@${{ matrix.node }}
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
node:
- "14"
- "16"
- "18"
- '18'
- '20'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
cache-dependency-path: "autocorrect-node/yarn.lock"
- name: Cache NPM dependencies
uses: actions/cache@v3
with:
path: autocorrect-node/.yarn/cache
key: npm-cache-test-linux-x64-musl-${{ matrix.node }}
- name: Install dependencies
run: yarn install
run: |
cd autocorrect-node
yarn config set supportedArchitectures.libc "musl"
yarn install
- name: Download artifacts
uses: actions/download-artifact@v3
with:
Expand All @@ -241,6 +227,7 @@ jobs:
shell: bash
- name: Test bindings
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test

publish:
name: Publish Node
runs-on: ubuntu-latest
Expand All @@ -257,7 +244,7 @@ jobs:
node-version: 16
check-latest: true
cache: yarn
cache-dependency-path: "autocorrect-node/yarn.lock"
cache-dependency-path: 'autocorrect-node/yarn.lock'
- name: Cache NPM dependencies
uses: actions/cache@v3
with:
Expand Down
6 changes: 3 additions & 3 deletions autocorrect-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ crate-type = ["cdylib"]
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
autocorrect = {path = "../autocorrect", version = ">= 1.0.0"}
autocorrect-cli = {path = "../autocorrect-cli", version = ">= 2.6", default-features = false}
napi = {version = "2.10.0", default-features = false, features = ["napi4", "async"]}
napi-derive = "2.9.1"
napi = {version = "2.14.1", default-features = false, features = ["napi4", "async"]}
napi-derive = "2.14.2"

[build-dependencies]
napi-build = "2.0.1"
napi-build = "2.1.0"

[profile.release]
lto = true
6 changes: 3 additions & 3 deletions autocorrect-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
},
"license": "MIT",
"devDependencies": {
"@napi-rs/cli": "^2.12.0",
"ava": "^4.3.3"
"@napi-rs/cli": "^2.16.5",
"ava": "^5.1.1"
},
"ava": {
"timeout": "3m"
Expand All @@ -34,4 +34,4 @@
"test": "ava",
"version": "napi version"
}
}
}
Loading

0 comments on commit 868166f

Please sign in to comment.