name: build

on:
  push:
    paths:
      - '**.go'
      - 'go.mod'
  pull_request:
    paths:
      - '**.go'
      - 'go.mod'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: ^1.19

      - name: Build
        run: go build

      - name: Test
        run: go test -coverprofile=coverage.txt -covermode=atomic -v ./...

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v3
