Run golangci-lint v2 via go install to match the active Go toolchain, and remove Windows coverprofile generation that PowerShell resolves incorrectly as package .out. Co-authored-by: Cursor <cursoragent@cursor.com>
67 lines
1.5 KiB
YAML
67 lines
1.5 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
name: Test (Go ${{ matrix.go }} / ${{ matrix.os }})
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
go:
|
|
- "1.22"
|
|
- "1.23"
|
|
- "stable"
|
|
include:
|
|
- os: macos-latest
|
|
go: "stable"
|
|
- os: windows-latest
|
|
go: "stable"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
cache: true
|
|
|
|
- name: Verify dependencies
|
|
run: |
|
|
go mod verify
|
|
go mod download
|
|
|
|
- name: Check go mod tidy
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
go mod tidy
|
|
git diff --exit-code go.mod go.sum
|
|
|
|
- name: Build
|
|
run: go build ./...
|
|
|
|
- name: Run tests with race detector and shuffle
|
|
if: runner.os != 'Windows'
|
|
run: go test -race -shuffle=on -count=1 -coverprofile=coverage.out -covermode=atomic ./...
|
|
|
|
- name: Run tests with shuffle
|
|
if: runner.os == 'Windows'
|
|
run: go test -shuffle=on -count=1 ./...
|
|
|
|
- name: Upload coverage
|
|
if: matrix.os == 'ubuntu-latest' && matrix.go == 'stable'
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
files: ./coverage.out
|
|
fail_ci_if_error: false
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|