name: Examine the Node.js Bindings
on:
push:
branches:
- develop
- production
paths:
- '.github/workflows/examine-nodejs-bindings.yml'
- '.github/actions/**'
- 'bindings/nodejs/**'
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
pull_request:
branches:
- develop
- production
paths:
- '.github/workflows/examine-nodejs-bindings.yml'
- '.github/actions/**'
- 'bindings/nodejs/**'
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
jobs:
test:
name: Test
if: ${{ ! github.event.schedule }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019, macos-latest, ubuntu-latest]
node: ['12', '14', '16']
exclude:
- os: windows-2019
node: '16'
steps:
- name: Checkout the Source Code
uses: actions/checkout@v2
- name: Set Up Nightly Rust
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
cache: true
cache-root: bindings/nodejs/native/
cache-job-id: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}-${{ matrix.node }}
cache-hash: ${{ hashFiles('.github/workflows/examine-nodejs-bindings.yml') }}
- name: Set Up Node.js ${{ matrix.node }} and Yarn Cache
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: yarn
cache-dependency-path: bindings/nodejs/yarn.lock
- name: Set Up Clang/LLVM (Windows)
if: ${{ startsWith(matrix.os, 'windows') }}
uses: ./.github/actions/setup-clang
- name: Run Yarn Install
working-directory: bindings/nodejs/
run: yarn install
- name: Run Cargo Test
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path bindings/nodejs/native/Cargo.toml --all-features --release
- name: Run Yarn Test
working-directory: bindings/nodejs/
run: yarn test
lint:
name: Lint
if: ${{ ! github.event.schedule }}
runs-on: ubuntu-latest
steps:
- name: Checkout the Source Code
uses: actions/checkout@v2
- name: Set Up Nightly Clippy
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
components: clippy
cache: true
cache-root: bindings/nodejs/native/
cache-job-id: ${{ github.workflow }}-${{ github.job }}
cache-hash: ${{ hashFiles('.github/workflows/examine-nodejs-bindings.yml') }}
- name: Run Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path bindings/nodejs/native/Cargo.toml --all-features --all-targets -- --deny warnings
name: Clippy Results for the Node.js Bindings
check-unused-deps:
name: Check Unused Dependencies
if: ${{ ! github.event.schedule }}
runs-on: ubuntu-latest
steps:
- name: Checkout the Source Code
uses: actions/checkout@v2
- name: Install Cargo-udeps with Nightly Rust
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
cache: true
install: cargo-udeps
cache-root: bindings/nodejs/native/
cache-job-id: ${{ github.workflow }}-${{ github.job }}
cache-hash: ${{ hashFiles('.github/workflows/examine-nodejs-bindings.yml') }}
- name: Run Cargo Udeps
uses: actions-rs/cargo@v1
with:
command: udeps
args: --manifest-path bindings/nodejs/native/Cargo.toml --all-targets
check-format:
name: Check Format
if: ${{ ! github.event.schedule }}
runs-on: ubuntu-latest
steps:
- name: Checkout the Source Code
uses: actions/checkout@v2
- name: Set Up Nightly Rustfmt
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
components: rustfmt
cache: false
- name: Run Cargo Fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path bindings/nodejs/native/Cargo.toml --all -- --check
audit:
name: Perform Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout the Source Code
uses: actions/checkout@v2
- name: Install Cargo-audit with Nightly Rust
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
install: cargo-audit
cache: true
cache-job-id: ${{ github.workflow }}-${{ github.job }}
cache-hash: ${{ hashFiles('.github/workflows/examine-nodejs-bindings.yml') }}
- name: Run Cargo Audit
uses: actions-rs/cargo@v1
with:
command: audit
args: --file bindings/nodejs/native/Cargo.lock --deny warnings --ignore RUSTSEC-2021-0145