name: CI
on:
  push:
  pull_request:
  schedule:
    - cron: "0 */13 * * *"
jobs:
  ci:
    name: CI
    strategy:
      matrix:
        go: ['1.18', '1.19', '1.20']
        os: ['ubuntu-latest', 'windows-latest', 'macOS-latest']
    runs-on: ${{ matrix.os }}
    steps:
      - name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go }}

      - name: Check out code into the Go module directory
        uses: actions/checkout@v2

      - name: Run gofmt
        run: test -z "$(go fmt .)"
        shell: bash

      - name: Test
        run: go test -race

      - name: Bench
        run: go test -run=Benchmark -bench=.
