2023-11-28 12:47:19 +03:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
|
|
|
pull_request:
|
|
|
|
name: Test
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-08-06 21:48:55 +03:00
|
|
|
go-version: [1.20.x, 1.21.x, 1.22.x]
|
2023-11-28 12:47:19 +03:00
|
|
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
steps:
|
|
|
|
- name: Install Go
|
2024-08-06 21:48:55 +03:00
|
|
|
uses: actions/setup-go@v5
|
2023-11-28 12:47:19 +03:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- name: Install staticcheck
|
|
|
|
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
|
2024-08-06 21:48:55 +03:00
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-11-28 12:47:19 +03:00
|
|
|
- name: Fmt
|
|
|
|
if: matrix.platform != 'windows-latest' # :(
|
|
|
|
run: "diff <(gofmt -d .) <(printf '')"
|
|
|
|
shell: bash
|
|
|
|
- name: Vet
|
|
|
|
run: go vet ./...
|
|
|
|
- name: Staticcheck
|
|
|
|
run: staticcheck ./...
|
|
|
|
- name: Test
|
|
|
|
run: go test -race ./...
|