name: CI

on: [push, pull_request]

jobs:
  analyze:
    name: Analyze
    permissions:
      contents: read
      security-events: write
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: github/codeql-action/init@v2
        with:
          languages: javascript
      - uses: github/codeql-action/analyze@v2
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version-file: ".nvmrc"
          cache: npm
      - run: npm ci
      - run: npm run lint
  build:
    name: Build
    needs: [analyze, lint]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version-file: ".nvmrc"
          cache: npm
      - run: npm ci
      - run: npm run build
      - name: Check for changed files
        run: |
          git status
          git diff --quiet
  test:
    name: Test
    needs: build
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: [12, 14, 16]
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
          cache: npm
      - run: npm ci
      - run: npm test

name: CI

on: [push, pull_request]

jobs:
  analyze:
    name: Analyze
    permissions:
      contents: read
      security-events: write
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: github/codeql-action/init@v2
        with:
          languages: javascript
      - uses: github/codeql-action/analyze@v2
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version-file: ".nvmrc"
          cache: npm
      - run: npm ci
      - run: npm run lint
  build:
    name: Build
    needs: [analyze, lint]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version-file: ".nvmrc"
          cache: npm
      - run: npm ci
      - run: npm run build
      - name: Check for changed files
        run: |
          git status
          git diff --quiet
  test:
    name: Test
    needs: build
    runs-on: macos-latest
    strategy:
      matrix:
        browser: ["headlessChrome", "headlessFirefox", "MicrosoftEdge", "safari"]
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version-file: ".nvmrc"
          cache: npm
      - run: npm ci
      - run: npm test -- --browser=${{ matrix.browser }}

Use a macos matrix build to test browsers
Use a macos matrix build to test browsers
