1on: [push, pull_request] 2name: Test 3jobs: 4 test: 5 env: 6 GOPATH: ${{ github.workspace }} 7 defaults: 8 run: 9 working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }} 10 strategy: 11 matrix: 12 go-version: [1.11.x, 1.12.x, 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x] 13 os: [ubuntu-latest, macos-latest] 14 runs-on: ${{ matrix.os }} 15 steps: 16 - name: Install Go 17 uses: actions/setup-go@v2 18 with: 19 go-version: ${{ matrix.go-version }} 20 - name: Checkout code 21 uses: actions/checkout@v2 22 with: 23 path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }} 24 - name: Checkout dependencies 25 run: go get golang.org/x/xerrors 26 - name: Test 27 run: go test -v -race ./... 28 - name: Format 29 if: matrix.go-version == '1.17.x' 30 run: diff -u <(echo -n) <(gofmt -d .) 31