ci: add release npm cli
This commit is contained in:
parent
4e0c9b14e4
commit
092f9d5290
11 changed files with 179 additions and 221 deletions
4
.github/workflows/asan.yml
vendored
4
.github/workflows/asan.yml
vendored
|
@ -14,8 +14,8 @@ on:
|
|||
pull_request:
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
name: nightly - ubuntu - node@16
|
||||
test:
|
||||
name: Address sanitizer
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
|
|
35
.github/workflows/check-all-features.yml
vendored
35
.github/workflows/check-all-features.yml
vendored
|
@ -1,35 +0,0 @@
|
|||
name: Check NAPI-RS features
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
settings:
|
||||
- features: 'napi1,napi2,napi3,napi4,napi5,napi6,napi7,napi8,experimental,async,chrono_date,latin1,full'
|
||||
package: 'napi'
|
||||
- features: 'compat-mode,strict,type-def,noop,full,default'
|
||||
package: 'napi-derive'
|
||||
name: stable - ubuntu-latest
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Check build
|
||||
run: cargo check -p ${{ matrix.settings.package }} -F ${{ matrix.settings.features }}
|
52
.github/workflows/cli-binary.yml
vendored
52
.github/workflows/cli-binary.yml
vendored
|
@ -1,52 +0,0 @@
|
|||
name: Cli Build Binary
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build_binary_crate:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: stable-cargo-cache-build-binary
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --mode=skip-build --immutable
|
||||
|
||||
- name: Build and run binary
|
||||
run: |
|
||||
yarn workspace binary build
|
||||
./examples/binary/napi-examples-binary
|
||||
yarn workspace binary build --profile napi-rs-custom
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
56
.github/workflows/lint.yaml
vendored
56
.github/workflows/lint.yaml
vendored
|
@ -1,56 +0,0 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint SourceCode
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: lint-cargo-cache
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: 'Lint JS/TS'
|
||||
run: yarn lint
|
||||
|
||||
- name: Cargo fmt
|
||||
run: cargo fmt -- --check
|
||||
|
||||
- name: Clippy
|
||||
run: cargo clippy
|
||||
|
||||
- name: Clear the cargo caches
|
||||
run: |
|
||||
cargo install cargo-cache --no-default-features --features ci-autoclean
|
||||
cargo-cache
|
66
.github/workflows/linux-armv7.yaml
vendored
66
.github/workflows/linux-armv7.yaml
vendored
|
@ -1,66 +0,0 @@
|
|||
name: Linux-armv7
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
RUST_BACKTRACE: 1
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: stable - armv7-unknown-linux-gnu - node@18
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: armv7-unknown-linux-gnueabihf
|
||||
|
||||
- name: Install ziglang
|
||||
uses: goto-bus-stop/setup-zig@v2
|
||||
with:
|
||||
version: 0.10.1
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: stable-linux-armv7-gnu-node@18-cargo-cache
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
yarn config set --json supportedArchitectures.cpu '["arm", "current"]'
|
||||
yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: Cross build native tests
|
||||
run: yarn build:test -- --target armv7-unknown-linux-gnueabihf --cross-compile
|
||||
|
||||
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
|
||||
- name: Setup and run tests
|
||||
uses: addnab/docker-run-action@v3
|
||||
with:
|
||||
image: node:lts-bullseye-slim
|
||||
options: --platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build
|
||||
run: yarn test
|
|
@ -1,4 +1,4 @@
|
|||
name: Test
|
||||
name: Test & Release
|
||||
|
||||
env:
|
||||
DEBUG: 'napi:*'
|
||||
|
@ -9,6 +9,10 @@ concurrency:
|
|||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
|
@ -16,6 +20,45 @@ on:
|
|||
pull_request:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint SourceCode
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: lint-cargo-cache
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: 'Lint JS/TS'
|
||||
run: yarn lint
|
||||
|
||||
- name: Cargo fmt
|
||||
run: cargo fmt -- --check
|
||||
|
||||
- name: Clippy
|
||||
run: cargo clippy
|
||||
|
||||
build_and_test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -324,3 +367,131 @@ jobs:
|
|||
image: ${{ steps.image-name.outputs.docker-image }}
|
||||
options: ${{ matrix.settings.args }} -v ${{ github.workspace }}:/build -w /build
|
||||
run: yarn test
|
||||
|
||||
build-and-test-linux-armv7:
|
||||
name: stable - armv7-unknown-linux-gnu - node@18
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: armv7-unknown-linux-gnueabihf
|
||||
|
||||
- name: Install ziglang
|
||||
uses: goto-bus-stop/setup-zig@v2
|
||||
with:
|
||||
version: 0.10.1
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: stable-linux-armv7-gnu-node@18-cargo-cache
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
yarn config set --json supportedArchitectures.cpu '["arm", "current"]'
|
||||
yarn install --immutable --mode=skip-build
|
||||
|
||||
- name: Cross build native tests
|
||||
run: yarn build:test -- --target armv7-unknown-linux-gnueabihf --cross-compile
|
||||
|
||||
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
|
||||
- name: Setup and run tests
|
||||
uses: addnab/docker-run-action@v3
|
||||
with:
|
||||
image: node:lts-bullseye-slim
|
||||
options: --platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build
|
||||
run: yarn test
|
||||
|
||||
build_binary_crate:
|
||||
runs-on: ubuntu-latest
|
||||
name: Test cli build binary
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: stable-cargo-cache-build-binary
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --mode=skip-build --immutable
|
||||
|
||||
- name: Build and run binary
|
||||
run: |
|
||||
yarn workspace binary build
|
||||
./examples/binary/napi-examples-binary
|
||||
yarn workspace binary build --profile napi-rs-custom
|
||||
|
||||
check-all-features:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
settings:
|
||||
- features: 'napi1,napi2,napi3,napi4,napi5,napi6,napi7,napi8,experimental,async,chrono_date,latin1,full'
|
||||
package: 'napi'
|
||||
- features: 'compat-mode,strict,type-def,noop,full,default'
|
||||
package: 'napi-derive'
|
||||
name: stable - ubuntu-latest
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Check build
|
||||
run: cargo check -p ${{ matrix.settings.package }} -F ${{ matrix.settings.features }}
|
||||
|
||||
release-npm:
|
||||
runs-on: ubuntu-latest
|
||||
if: "startsWith(github.event.head_commit.message, 'chore(release): publish')"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
- name: Publish
|
||||
run: |
|
||||
yarn install --mode=skip-build
|
||||
yarn build
|
||||
npm config set provenance true
|
||||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
||||
yarn lerna publish from-package --pre-dist-tag canary --yes
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@ -4,3 +4,4 @@ scripts
|
|||
triples/index.js
|
||||
examples/napi/index.d.ts
|
||||
.yarn
|
||||
yarn.lock
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@napi-rs/cli",
|
||||
"version": "3.0.0-alpha.3",
|
||||
"version": "3.0.0-alpha.4",
|
||||
"description": "Cli tools for napi-rs",
|
||||
"author": "LongYinan <lynweklm@gmail.com>",
|
||||
"homepage": "https://github.com/napi-rs/napi-rs",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "independent",
|
||||
"npmClient": "yarn",
|
||||
"message": "chore: publish"
|
||||
"message": "chore(release): publish"
|
||||
}
|
||||
|
|
|
@ -60,11 +60,6 @@
|
|||
"cargo fmt --"
|
||||
]
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged && cargo fmt --all"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@napi-rs/cli": "workspace:*",
|
||||
"@rollup/plugin-alias": "^5.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@napi-rs/triples",
|
||||
"version": "2.0.0-alpha.1",
|
||||
"version": "2.0.0-alpha.2",
|
||||
"description": "Rust target triples objects",
|
||||
"keywords": [
|
||||
"Rust",
|
||||
|
|
Loading…
Reference in a new issue