| 1 |
name: Test |
| 2 |
on: |
| 3 |
pull_request: |
| 4 |
types: [opened, synchronize] |
| 5 |
push: |
| 6 |
branches: [main] |
| 7 |
|
| 8 |
jobs: |
| 9 |
test: |
| 10 |
strategy: |
| 11 |
matrix: |
| 12 |
platform: [ubuntu-latest, macos-latest] |
| 13 |
runs-on: ${{ matrix.platform }} |
| 14 |
steps: |
| 15 |
- name: Install Go |
| 16 |
uses: actions/setup-go@v3 |
| 17 |
with: |
| 18 |
go-version: 1.x |
| 19 |
|
| 20 |
- name: Check out repo |
| 21 |
uses: actions/checkout@v3 |
| 22 |
with: |
| 23 |
ref: ${{ github.event.pull_request.head.sha }} # default is a pseudo 'merge' commit |
| 24 |
|
| 25 |
- name: Install tools |
| 26 |
run: | |
| 27 |
go install honnef.co/go/tools/cmd/staticcheck@latest |
| 28 |
go install mvdan.cc/gofumpt@latest |
| 29 |
|
| 30 |
- name: gofmt |
| 31 |
run: diff <(gofmt -d . 2>/dev/null) <(printf '') |
| 32 |
|
| 33 |
- name: go vet |
| 34 |
run: go vet ./... |
| 35 |
|
| 36 |
- name: staticcheck |
| 37 |
run: staticcheck ./... |
| 38 |
|
| 39 |
- name: gofumpt |
| 40 |
run: diff <(gofumpt -d -e -l . 2>/dev/null) <(printf '') |
| 41 |
|
| 42 |
- name: go test |
| 43 |
run: go test -v ./... |