name: Build and test

on: [pull_request, workflow_dispatch]

jobs:
  build_and_test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version-file: .nvmrc
      - name: Install dependencies
        run: |
          rm -rf node_modules
          npm ci
      - name: Lint and test
        run: |
          npm run lint
          npm run test
      - name: Build package
        run: npm run build
