name: CI on: push: branches: [ main, dev ] pull_request: branches: [ main, dev ] jobs: test: name: Test runs-on: ubuntu-latest strategy: matrix: go-version: ['1.19', '1.20', '1.21'] steps: - name: Set up Go ${{ matrix.go-version }} uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} - name: Check out code uses: actions/checkout@v4 - name: Cache Go modules uses: actions/cache@v3 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-${{ matrix.go-version }}- - name: Download dependencies run: go mod download - name: Verify dependencies run: go mod verify - name: Build run: go build -v ./... - name: Run tests if: matrix.go-version != '1.21' run: go test -v -race -timeout 600s ./... - name: Run tests with coverage if: matrix.go-version == '1.21' run: go test -v -race -coverprofile="codecov.report" -covermode=atomic -timeout 600s ./... - name: Upload coverage reports to Codecov if: matrix.go-version == '1.21' uses: codecov/codecov-action@v3 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}