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

76 lines
1.7 KiB
YAML
Raw Normal View History

2020-10-14 16:15:20 +08:00
name: macOS/Windows/Linux x64
2020-02-18 21:09:17 +08:00
env:
DEBUG: 'napi:*'
2022-05-10 17:29:43 +08:00
RUST_BACKTRACE: 1
2023-03-12 18:31:13 +08:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
2020-08-17 22:36:09 +08:00
on:
push:
2020-12-03 16:30:14 +08:00
branches:
- main
2020-08-17 22:36:09 +08:00
pull_request:
2020-02-18 21:09:17 +08:00
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
node: ['16', '18']
2020-07-29 22:04:47 +08:00
os: [ubuntu-latest, macos-latest, windows-latest]
2020-02-18 21:09:17 +08:00
2020-07-29 22:04:47 +08:00
name: stable - ${{ matrix.os }} - node@${{ matrix.node }}
runs-on: ${{ matrix.os }}
2020-02-18 21:09:17 +08:00
steps:
2022-04-01 14:29:51 +08:00
- uses: actions/checkout@v3
2020-02-18 21:09:17 +08:00
- name: Setup node
uses: actions/setup-node@v3
2020-02-18 21:09:17 +08:00
with:
node-version: ${{ matrix.node }}
2021-11-19 14:58:21 +08:00
cache: 'yarn'
2020-07-29 22:04:47 +08:00
- name: Install
2023-03-12 18:24:48 +08:00
uses: dtolnay/rust-toolchain@stable
2020-07-29 22:04:47 +08:00
with:
toolchain: stable
2022-04-01 14:29:51 +08:00
- name: Cache cargo
uses: actions/cache@v3
2020-02-18 21:09:17 +08:00
with:
2022-04-01 14:29:51 +08:00
path: |
~/.cargo/registry
~/.cargo/git
2022-04-15 21:22:04 +08:00
target
2022-04-01 14:29:51 +08:00
key: stable-${{ matrix.os }}-node@${{ matrix.node }}-cargo-cache
2020-07-29 22:04:47 +08:00
- name: 'Install dependencies'
2022-04-01 14:29:51 +08:00
run: yarn install --mode=skip-build --immutable
2020-07-29 22:04:47 +08:00
- name: Check build
2023-04-08 23:37:28 +08:00
run: cargo check --all --bins --examples --tests -vvv
2020-02-18 21:09:17 +08:00
- name: Unit tests
2020-02-18 21:09:17 +08:00
run: |
yarn test:cli
2020-10-10 14:50:35 +08:00
yarn build:test
yarn test --verbose
yarn tsc -p examples/napi/tsconfig.json --noEmit
yarn test:macro
2022-05-10 17:29:43 +08:00
- name: Electron tests
if: matrix.os != 'ubuntu-latest'
run: |
node ./node_modules/electron/install.js
yarn test:electron
- name: Electron tests
if: matrix.os == 'ubuntu-latest'
run: |
node ./node_modules/electron/install.js
xvfb-run --auto-servernum yarn test:electron