name: CI

on:
  push:
    paths-ignore:
        - 'docs/**'
        - '*.md'
  pull_request:
    paths-ignore:
        - 'docs/**'
        - '*.md'

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: [10, 12, 13, 14, 16]
    name: Node ${{ matrix.node }}
    steps:
      - uses: actions/checkout@v2.3.4
      - name: Setup node
        uses: actions/setup-node@v2.3.2
        with:
          node-version: ${{ matrix.node }}
      - name: Restore cached dependencies
        uses: actions/cache@v2.1.6
        with:
          path: node_modules
          key: node-modules-${{ hashFiles('package.json') }}
      - name: Install dependencies
        run: npm install
      - name: Run tests
        run: npm test

  automerge:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: fastify/github-action-merge-dependabot@v2.5.0
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
