name: ci
on:
  push:
  pull_request:
  schedule:
    # run ci weekly
    - cron: "0 0 * * 0"
jobs:
  ci:
    runs-on: ${{ matrix.os }}
    timeout-minutes: 30
    strategy:
      matrix:
        go: ["1.20"]
        os: [ubuntu-latest, macOS-latest]
    name: Go ${{ matrix.go }} in ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go }}
      - name: Environment
        run: |
          go version
          go env
      - name: Lint
        uses: golangci/golangci-lint-action@v3
        with:
          version: v1.51.2
          only-new-issues: true
      - name: Test
        env:
          GOFLAGS: -mod=mod
        run: go test -race -coverpkg=./... -coverprofile=coverage.txt ./...
      - name: Send coverage
        run: bash <(curl -s https://codecov.io/bash)
