| 1 | on: [push, pull_request] |
| 2 | name: Test |
| 3 | |
| 4 | jobs: |
| 5 | test: |
| 6 | strategy: |
| 7 | matrix: |
| 8 | go-version: [1.14.x, 1.15.x] |
| 9 | platform: [ubuntu-latest, macos-latest, windows-latest] |
| 10 | fail-fast: false |
| 11 | runs-on: ${{ matrix.platform }} |
| 12 | env: |
| 13 | GO111MODULE: on |
| 14 | |
| 15 | steps: |
| 16 | - name: Install Go |
| 17 | uses: actions/setup-go@v2 |
| 18 | with: |
| 19 | go-version: ${{ matrix.go-version }} |
| 20 | |
| 21 | - name: Go environment |
| 22 | run: | |
| 23 | go version |
| 24 | go env |
| 25 | echo PATH is $PATH |
| 26 | shell: bash |
| 27 | |
| 28 | - name: Checkout code |
| 29 | uses: actions/checkout@v2 |
| 30 | |
| 31 | - name: Run tests |
| 32 | run: go test -race -v ./... |
| 33 | |
| 34 | - name: Check gofmt |
| 35 | run: | |
| 36 | gofmt -l . |
| 37 | test `gofmt -l . | wc -l` = 0 |
| 38 | shell: bash |
| 39 |