name: CI

on:
  - pull_request
  - push

jobs:
  Test:
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
        node_version:
          - 12
          - 14
        node_arch:
          - x64
        include:
          - os: windows-2016
            node_version: 12
            node_arch: x86
    steps:
      - uses: actions/checkout@v2

      - name: Install Node
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node_version }}
          architecture: ${{ matrix.node_arch }}

      - name: Install npm
        run: npm install -g npm

      - name: Install dependencies
        run: npm install

      - if: "!contains(matrix.os, 'windows')"
        name: Run tests 👩🏾‍💻
        run: ./bin/npm test

  Skip:
    if: contains(github.event.head_commit.message, '[skip ci]')
    runs-on: ubuntu-latest
    steps:
      - name: Skip CI 🚫
        run: echo skip ci
