name: Build and Test
on: [push, pull_request]
jobs:
  build:
    # https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/
    permissions:
      contents: read
    name: Go CI
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go: [1.16.8, 1.17.5]
    steps:
      - name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go }}

      - name: Check out source
        uses: actions/checkout@v2

      - name: Build
        run: go build ./...

      - name: Test
        run: |
          sh ./goclean.sh

      - name: Send coverage
        uses: shogo82148/actions-goveralls@v1
        with:
          path-to-profile: profile.cov