ci: make lint block build and deduplicate test runs

- Add lint to build job's needs so lint failures prevent artifacts
- Combine race detector + coverage into a single test run
- Pin golangci-lint to v2.1.6 to avoid surprise breakage
- Rename workflow from go-improved.yml to go.yml
This commit is contained in:
Houmgaor
2026-02-20 21:10:03 +01:00
parent d456bd23e0
commit e3970bfda5

View File

@@ -15,7 +15,7 @@ on:
- 'go.mod' - 'go.mod'
- 'go.sum' - 'go.sum'
- 'main.go' - 'main.go'
- '.github/workflows/go-improved.yml' - '.github/workflows/go.yml'
pull_request: pull_request:
branches: branches:
- main - main
@@ -40,14 +40,8 @@ jobs:
- name: Download dependencies - name: Download dependencies
run: go mod download run: go mod download
- name: Run Tests - name: Run Tests with Race Detector and Coverage
run: go test -v ./... -timeout=10m run: go test -race -coverprofile=coverage.out ./... -timeout=10m
- name: Run Tests with Race Detector
run: go test -race ./... -timeout=10m
- name: Generate Coverage Report
run: go test -coverprofile=coverage.out ./...
- name: Upload Coverage to Codecov - name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v3
@@ -58,7 +52,7 @@ jobs:
build: build:
name: Build name: Build
needs: test needs: [test, lint]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -119,5 +113,5 @@ jobs:
- name: Run golangci-lint - name: Run golangci-lint
uses: golangci/golangci-lint-action@v7 uses: golangci/golangci-lint-action@v7
with: with:
version: latest version: v2.1.6
args: --timeout=5m args: --timeout=5m