name: Node CI

on:
  push:
    paths:
      - '.github/workflows/*'
      - 'lib/*'
      - 'test'
      - 'cli.js'
      - 'index.js'
      - 'markdown.css'
      - 'package*.json'

jobs:
  build:
    strategy:
      matrix:
        node: [8, 10, 12]
        os: ['ubuntu-latest', 'windows-latest', 'macOS-latest']

    name: Node ${{ matrix.node }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@master

      - name: Use Node.js ${{ matrix.node }}.x
        uses: actions/setup-node@v1
        with:
          version: ${{ matrix.node }}.x

      - name: install and lint
        run: |
          npm install
          npx xo

      - name: test lib
        run: npx nyc ava test/lib.spec.js

      - name: test api
        run: npx ava test/api.spec.js

      - name: test cli
        run: npx ava test/cli.spec.js
