Skip to content

Fix CI: install golangci-lint v2.5.0 and use GOPATH #9

Fix CI: install golangci-lint v2.5.0 and use GOPATH

Fix CI: install golangci-lint v2.5.0 and use GOPATH #9

Workflow file for this run

name: Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.22', '1.23', '1.24']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Download dependencies
run: go mod download
- name: Run tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic
- name: Check coverage
run: |
coverage=$(go tool cover -func=coverage.txt | grep total | awk '{print $3}' | sed 's/%//')
echo "Coverage: $coverage%"
if (( $(echo "$coverage < 100" | bc -l) )); then
echo "Error: Coverage is below 100%"
exit 1
fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.txt
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v2.5.0
- name: Verify golangci-lint installation
run: $(go env GOPATH)/bin/golangci-lint version
- name: Verify golangci-lint config
run: $(go env GOPATH)/bin/golangci-lint config verify
- name: Run golangci-lint
run: $(go env GOPATH)/bin/golangci-lint run --timeout=5m ./...