Skip to content

Merge pull request #654 from rithvikvibhu/hsd-update-6 #436

Merge pull request #654 from rithvikvibhu/hsd-update-6

Merge pull request #654 from rithvikvibhu/hsd-update-6 #436

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Build and Test
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
node-version: ['16', '18']
# OS-specific commands/variables
include:
- os: ubuntu-latest
cmd_build: npm run build
- os: windows-latest
cmd_build: node .\scripts\package.js
runs-on: ${{matrix.os}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# https://github.com/actions/setup-node/issues/280#issuecomment-1139455898
- name: Update node-gyp (windows only)
if: startsWith(matrix.os, 'windows')
run: |
$WhereNode = Get-Command node | Select-Object -ExpandProperty Definition
$NodeDirPath = Split-Path $WhereNode -Parent
$NodeModulesPath = $NodeDirPath + "\node_modules\npm\node_modules\@npmcli\run-script"
cd $NodeModulesPath
npm install node-gyp@latest
- name: Install dependencies (linux only)
if: matrix.os == 'ubuntu-latest'
run: sudo apt update && sudo apt install libudev-dev libusb-1.0-0-dev -y
- name: Install npm packages
run: npm i
- name: Build
run: ${{ matrix.cmd_build }}
- name: Test
run: npm test