| 1 |
on: |
| 2 |
push: |
| 3 |
branches: [main] |
| 4 |
pull_request: |
| 5 |
name: Test |
| 6 |
jobs: |
| 7 |
test: |
| 8 |
strategy: |
| 9 |
matrix: |
| 10 |
go-version: [1.25.x, 1.26.x] |
| 11 |
platform: [ubuntu-latest, macos-latest, windows-latest] |
| 12 |
runs-on: ${{ matrix.platform }} |
| 13 |
steps: |
| 14 |
- name: Checkout code |
| 15 |
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 16 |
- name: Install Go |
| 17 |
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 |
| 18 |
with: |
| 19 |
go-version: ${{ matrix.go-version }} |
| 20 |
- name: Install staticcheck |
| 21 |
run: go install honnef.co/go/tools/cmd/staticcheck@latest |
| 22 |
shell: bash |
| 23 |
- name: Install golint |
| 24 |
run: go install golang.org/x/lint/golint@latest |
| 25 |
shell: bash |
| 26 |
- name: Update PATH |
| 27 |
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH |
| 28 |
shell: bash |
| 29 |
- name: Fmt |
| 30 |
if: matrix.platform != 'windows-latest' |
| 31 |
run: "diff <(gofmt -d .) <(printf '')" |
| 32 |
shell: bash |
| 33 |
- name: Vet |
| 34 |
run: go vet ./... |
| 35 |
- name: Staticcheck |
| 36 |
run: staticcheck ./... |
| 37 |
- name: Lint |
| 38 |
run: golint ./... |
| 39 |
- name: Test |
| 40 |
run: go test -race ./... -coverpkg=./... -coverprofile=coverage.txt -covermode=atomic |
| 41 |
- name: Upload coverage reports to Codecov |
| 42 |
uses: codecov/codecov-action@0561704f0f02c16a585d4c7555e57fa2e44cf909 |
| 43 |
with: |
| 44 |
token: ${{ secrets.CODECOV_TOKEN }} |