Skip to content

ci: Add NPM CI workflow for testing and building #2

ci: Add NPM CI workflow for testing and building

ci: Add NPM CI workflow for testing and building #2

Workflow file for this run

name: NPM CI
on:
push:
pull_request:
branches: ["main"]
jobs:
build:
name: Test & Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Display Node.js version
run: node -v
- name: Install dependencies
run: npm ci
- name: Cache node_modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build the project
run: npm run build --if-present
- name: Run tests
run: npm test