2022-07-14 13:07:48 +03:00
|
|
|
on:
|
|
|
|
push:
|
2023-11-28 12:33:13 +03:00
|
|
|
branches: [main]
|
2022-07-14 13:07:48 +03:00
|
|
|
pull_request:
|
|
|
|
name: Test
|
2023-11-28 12:33:00 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2022-07-14 13:07:48 +03:00
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-11-28 12:33:13 +03:00
|
|
|
go-version: [1.19.x, 1.20.x, 1.21.x]
|
2022-07-14 13:40:46 +03:00
|
|
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
2022-07-14 13:07:48 +03:00
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
steps:
|
2023-11-28 12:33:13 +03:00
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- name: Install staticcheck
|
|
|
|
if: matrix.go-version == '1.21.x'
|
|
|
|
run: go install honnef.co/go/tools/cmd/staticcheck@latest
|
|
|
|
shell: bash
|
|
|
|
- name: Update PATH
|
|
|
|
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
|
|
|
shell: bash
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Fmt
|
|
|
|
if: matrix.platform != 'windows-latest' # :(
|
|
|
|
run: "diff <(gofmt -d .) <(printf '')"
|
|
|
|
shell: bash
|
|
|
|
- name: Vet
|
|
|
|
run: go vet ./...
|
|
|
|
- name: Staticcheck
|
|
|
|
if: matrix.go-version == '1.21.x'
|
|
|
|
run: staticcheck ./...
|
|
|
|
- name: Test
|
|
|
|
run: go test -race ./...
|