name: Continuous Integration
on: [push, pull_request]
jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go-version: [1.16]
    steps:
      - name: Set up Go ${{ matrix.go-version }}
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go-version }}
      - name: Check out code into the Go module directory
        uses: actions/checkout@v2
      - name: Get dependencies
        run: |
          go get -u golang.org/x/lint/golint
          go get -v -t -d ./...
      - name: Run go fmt
        run: diff -u <(echo -n) <(gofmt -d -s .)
      - name: Run tests
        run: |
          go test -v \
                  -race \
                  ./...
