napi-rs/.github/workflows/test.yaml

77 lines
1.7 KiB
YAML
Raw Normal View History

2020-10-14 17:15:20 +09:00
name: macOS/Windows/Linux x64
2020-02-18 22:09:17 +09:00
env:
DEBUG: 'napi:*'
2020-08-17 23:36:09 +09:00
on:
push:
2020-12-03 17:30:14 +09:00
branches:
- main
2020-08-17 23:36:09 +09:00
pull_request:
2020-02-18 22:09:17 +09:00
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
2022-01-24 12:33:51 +09:00
node: ['14', '16', '17']
2020-07-29 23:04:47 +09:00
os: [ubuntu-latest, macos-latest, windows-latest]
2020-02-18 22:09:17 +09:00
2020-07-29 23:04:47 +09:00
name: stable - ${{ matrix.os }} - node@${{ matrix.node }}
runs-on: ${{ matrix.os }}
2020-02-18 22:09:17 +09:00
steps:
2022-04-01 15:29:51 +09:00
- uses: actions/checkout@v3
2020-02-18 22:09:17 +09:00
- name: Setup node
uses: actions/setup-node@v3
2020-02-18 22:09:17 +09:00
with:
node-version: ${{ matrix.node }}
2020-11-10 12:09:25 +09:00
check-latest: true
2021-11-19 15:58:21 +09:00
cache: 'yarn'
2020-07-29 23:04:47 +09:00
- name: Install
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
2022-04-01 15:29:51 +09:00
- name: Cache cargo
uses: actions/cache@v3
2020-02-18 22:09:17 +09:00
with:
2022-04-01 15:29:51 +09:00
path: |
~/.cargo/registry
~/.cargo/git
key: stable-${{ matrix.os }}-node@${{ matrix.node }}-cargo-cache
2020-07-29 23:04:47 +09:00
2022-04-01 15:29:51 +09:00
- name: Cache NPM dependencies
uses: actions/cache@v3
2020-02-18 22:09:17 +09:00
with:
2022-04-01 15:29:51 +09:00
path: .yarn/cache
key: npm-cache-${{ matrix.os }}-node@${{ matrix.node }}
2020-07-29 23:04:47 +09:00
- name: 'Install dependencies'
2022-04-01 15:29:51 +09:00
run: yarn install --mode=skip-build --immutable
2020-07-29 23:04:47 +09:00
- name: 'Build TypeScript'
run: yarn build
2020-02-18 22:09:17 +09:00
- name: Check build
2020-02-18 22:09:17 +09:00
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests -vvv
2020-02-18 22:09:17 +09:00
- name: Unit tests
2020-02-18 22:09:17 +09:00
run: |
2020-10-10 15:50:35 +09:00
yarn build:test
yarn test --verbose
2020-02-19 00:05:13 +09:00
env:
RUST_BACKTRACE: 1
2020-02-18 22:09:17 +09:00
- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache