name: test

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        deno:
          [1.x, "1.8.2", canary, ~1.7, e7b7129b7a92b7500ded88f8f5baa25a7f59e56e]

    steps:
      - uses: actions/checkout@v2

      - name: Setup Deno
        uses: ./
        with:
          deno-version: ${{ matrix.deno }}

      - name: Test Deno
        run: deno run https://deno.land/std/examples/welcome.ts

      - name: Format
        if: runner.os == 'Linux' && matrix.deno == 'canary'
        run: npm run fmt:check

      - name: Lint
        if: runner.os == 'Linux' && matrix.deno == 'canary'
        run: npm run lint