-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (66 loc) · 2.26 KB
/
code-quality.yml
File metadata and controls
81 lines (66 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Code Quality
# This workflow checks code quality: formatting, linting, security, and dependency verification
on:
pull_request:
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- 'Makefile'
- '.github/workflows/code-quality.yml'
concurrency:
group: code-quality-${{ github.head_ref }}
cancel-in-progress: true
jobs:
code-quality:
name: Code Quality Checks
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff
with:
go-version: '1.25.6'
- name: Cache Go modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: go mod download
- name: Verify go.mod and go.sum
run: |
go mod verify
go mod tidy
git diff --exit-code go.mod go.sum || (echo "Error: go.mod or go.sum are out of sync. Run 'go mod tidy' and commit the changes." && exit 1)
# Pin tool versions for reproducible builds
# Update these versions periodically and bump the cache key
- name: Cache development tools
id: cache-tools
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: |
~/go/bin/gofumpt
~/go/bin/golangci-lint
~/go/bin/govulncheck
key: ${{ runner.os }}-dev-tools-gofumpt0.9.2-lint2.8.0-vuln1.1.4
- name: Install development tools
if: steps.cache-tools.outputs.cache-hit != 'true'
run: |
go install mvdan.cc/gofumpt@v0.9.2
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.8.0
go install golang.org/x/vuln/cmd/govulncheck@v1.1.4
- name: Check code formatting
run: make fmt-check
- name: Run linter
run: make lint
- name: Security scan
run: govulncheck ./...
- name: Verify build
run: go build ./...