napi-rs/.github/workflows/cli-binary.yml

68 lines
1.5 KiB
YAML
Raw Normal View History

2022-04-01 15:04:29 +09:00
name: Cli Build Binary
env:
DEBUG: 'napi:*'
2023-03-12 19:31:13 +09:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
2022-04-01 15:04:29 +09:00
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:
2022-12-09 18:29:03 +09:00
node-version: 18
2022-04-01 15:04:29 +09:00
check-latest: true
cache: 'yarn'
- name: Install
2023-03-12 19:24:48 +09:00
uses: dtolnay/rust-toolchain@stable
2022-04-01 15:04:29 +09:00
with:
toolchain: stable
2022-04-01 15:29:51 +09:00
- name: Cache cargo
2022-04-01 15:04:29 +09:00
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
2022-04-15 22:22:04 +09:00
target
2022-04-01 15:04:29 +09:00
key: stable-cargo-cache-build-binary
- name: 'Install dependencies'
2022-04-01 15:29:51 +09:00
run: yarn install --mode=skip-build --immutable
2022-04-01 15:04:29 +09:00
- name: 'Build TypeScript'
run: yarn build
- name: Build and run binary
run: |
yarn workspace binary build
./examples/binary/napi-examples-binary
env:
RUST_BACKTRACE: 1
- name: Pass -p and --cargo-name to build
run: |
2022-12-09 18:29:03 +09:00
node ./cli/scripts/index.js build -p napi-examples-binary --cargo-name napi-examples-binary
./napi-examples-binary
env:
RUST_BACKTRACE: 1
2022-04-01 15:04:29 +09:00
- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache