Nodejs bindings checks #9458
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nodejs bindings checks | |
on: | |
push: | |
branches: [develop, staging] | |
paths: | |
- ".github/actions/**" | |
- "**.rs" # Include all rust files | |
- "**Cargo.toml" # Include all Cargo.toml files | |
- "**Cargo.lock" # Include all Cargo.lock files | |
- "!**/examples/**" # Exclude all examples | |
- "!**/tests/**" # Exclude all tests | |
- "!cli/**" # Exclude CLI | |
- "!**/bindings/**" # Exclude all bindings | |
- "bindings/nodejs/**" | |
- ".github/workflows/bindings-nodejs.yml" | |
pull_request: | |
branches: [develop, staging] | |
paths: | |
- ".github/actions/**" | |
- "**.rs" # Include all rust files | |
- "**Cargo.toml" # Include all Cargo.toml files | |
- "**Cargo.lock" # Include all Cargo.lock files | |
- "!**/examples/**" # Exclude all examples | |
- "!**/tests/**" # Exclude all tests | |
- "!cli/**" # Exclude CLI | |
- "!**/bindings/**" # Exclude all bindings | |
- "bindings/nodejs/**" | |
- ".github/workflows/bindings-nodejs.yml" | |
schedule: | |
- cron: "0 1 * * *" | |
workflow_dispatch: | |
env: | |
CARGO_INCREMENTAL: 0 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# os: [windows-latest, macos-latest, ubuntu-latest] | |
os: [windows-latest, ubuntu-latest] | |
node: ["18"] | |
steps: | |
- name: Checkout the Source Code | |
uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
cache-root: bindings/nodejs | |
- name: Set Up Node.js ${{ matrix.node }} and Yarn Cache | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: yarn | |
cache-dependency-path: bindings/nodejs/yarn.lock | |
# This step is required for bindgen to work on Windows. | |
- name: Set Up Clang/LLVM (Windows) | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
uses: ./.github/actions/setup-clang | |
- name: Install Required Dependencies (Ubuntu) | |
if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install libudev-dev libusb-1.0-0-dev | |
- name: Run Yarn Install | |
working-directory: bindings/nodejs/ | |
run: yarn install | |
- name: Run Yarn Rebuild | |
working-directory: bindings/nodejs/ | |
run: yarn rebuild | |
- name: Run Yarn Test | |
working-directory: bindings/nodejs/ | |
run: yarn test | |
- name: Yarn Build Examples | |
working-directory: bindings/nodejs/examples/ | |
run: | | |
yarn | |
yarn build | |
- name: Test types module webpack compatibility | |
working-directory: bindings/nodejs/ | |
run: | | |
yarn run test-webpack | |
lint: | |
name: Lint | |
if: ${{ ! github.event.schedule }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the Source Code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: yarn | |
cache-dependency-path: bindings/nodejs/yarn.lock | |
node-version: 18.x | |
- name: Install Dependencies | |
working-directory: bindings/nodejs/ | |
run: yarn install --ignore-scripts | |
- name: Lint | |
working-directory: bindings/nodejs/ | |
run: yarn lint | |
check-format: | |
name: Check Format | |
if: ${{ ! github.event.schedule }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the Source Code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: yarn | |
cache-dependency-path: bindings/nodejs/yarn.lock | |
node-version: 18.x | |
- name: Install Dependencies | |
working-directory: bindings/nodejs/ | |
run: yarn install --ignore-scripts | |
- name: Format | |
working-directory: bindings/nodejs/ | |
run: yarn format-check |