name: Pull Request Checks

on:
  # Trigger the workflow pull requests,
  # but only for the master branch
  pull_request:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 10

    strategy:
      matrix:
        node-version: [18.x]

    steps:
      - name: Checkout branch
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install dependencies
        run: npm ci

      - name: Lint source
        run: npm run lint

      - name: Build package
        run: npm run build

      - name: Run tests
        run: npm test
