File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ name : Security
2+
3+ on :
4+ push :
5+ branches : [ aicode, master, develop ]
6+ pull_request :
7+ branches : [ aicode, master ]
8+ schedule :
9+ # 每周一早上 6:00 UTC 运行
10+ - cron : ' 0 6 * * 1'
11+
12+ jobs :
13+ govulncheck :
14+ name : Vulnerability Check
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v4
19+
20+ - name : Setup Go
21+ uses : actions/setup-go@v5
22+ with :
23+ go-version : ' 1.22'
24+
25+ - name : Install govulncheck
26+ run : go install golang.org/x/vuln/cmd/govulncheck@latest
27+
28+ - name : Run govulncheck
29+ run : govulncheck ./...
30+
31+ gosec :
32+ name : Security Scan
33+ runs-on : ubuntu-latest
34+ steps :
35+ - name : Checkout code
36+ uses : actions/checkout@v4
37+
38+ - name : Run Gosec Security Scanner
39+ uses : securego/gosec@master
40+ with :
41+ args : ./...
42+ # 渐进式:初期不阻塞 CI,后续修复问题后再强制
43+ continue-on-error : true
44+
45+ dependency-review :
46+ name : Dependency Review
47+ runs-on : ubuntu-latest
48+ if : github.event_name == 'pull_request'
49+ steps :
50+ - name : Checkout code
51+ uses : actions/checkout@v4
52+
53+ - name : Dependency Review
54+ uses : actions/dependency-review-action@v4
Original file line number Diff line number Diff line change 77 branches : [ aicode, master ]
88
99jobs :
10+ lint :
11+ name : Lint
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout code
15+ uses : actions/checkout@v4
16+
17+ - name : Setup Go
18+ uses : actions/setup-go@v5
19+ with :
20+ go-version : ' 1.22'
21+
22+ - name : golangci-lint
23+ uses : golangci/golangci-lint-action@v6
24+ with :
25+ version : latest
26+ # 渐进式:初期不阻塞 CI,后续修复问题后再强制
27+ continue-on-error : true
28+
1029 test :
1130 name : Test with Go ${{ matrix.go-version }}
1231 runs-on : ubuntu-latest
32+ needs : lint
1333 strategy :
1434 matrix :
1535 go-version : ['1.21', '1.22', '1.23']
Original file line number Diff line number Diff line change 1+ # golangci-lint configuration
2+ # 渐进式配置:初期宽松,逐步收紧
3+
4+ run :
5+ timeout : 5m
6+ skip-dirs :
7+ - examples
8+ skip-files :
9+ - " .*_test\\ .go$"
10+
11+ linters :
12+ enable :
13+ - errcheck
14+ - gosimple
15+ - govet
16+ - ineffassign
17+ - staticcheck
18+ - unused
19+ - typecheck
20+ - gocritic
21+ - misspell
22+
23+ linters-settings :
24+ errcheck :
25+ check-type-assertions : false
26+ check-blank : false
27+
28+ gocritic :
29+ disabled-checks :
30+ - ifElseChain
31+ - singleCaseSwitch
32+
33+ issues :
34+ # 初期不阻塞 CI,后续修复后再强制
35+ max-issues-per-linter : 0
36+ max-same-issues : 0
37+
38+ exclude-rules :
39+ # 测试文件放宽要求
40+ - path : _test\.go
41+ linters :
42+ - errcheck
43+
44+ # examples 目录放宽要求
45+ - path : examples/
46+ linters :
47+ - errcheck
48+
49+ # 忽略已知问题的文件
50+ - path : " test/.*"
51+ linters :
52+ - errcheck
53+
54+ output :
55+ formats :
56+ - format : colored-line-number
57+ print-issued-lines : true
58+ print-linter-name : true
You can’t perform that action at this time.
0 commit comments