name: ci
on: [push, pull_request]

jobs:
  test:
    strategy:
      matrix:
        os: [windows-latest, macos-latest, ubuntu-latest]
    name: test and coverage
    runs-on: ${{ matrix.os }}
    steps:
      - name: set up
        uses: actions/setup-go@v3
        with:
          go-version: '>=1.21.0'
      - name: checkout
        uses: actions/checkout@v3

      - name: golangci-lint # localでmake lintした方が今はわかりやすい
        if: runner.os == 'Linux'
        uses: golangci/golangci-lint-action@v3
        with:
          version: latest
          args: --issues-exit-code=0

      - name: test # testだけ各OSで実行
        run: go test . -race -coverprofile=coverage.out -covermode=atomic -v

      - name: upload coverage to Codecov
        if: runner.os == 'Linux'
        uses: codecov/codecov-action@v3
