-
Notifications
You must be signed in to change notification settings - Fork 26
92 lines (79 loc) · 2.54 KB
/
lint.yml
File metadata and controls
92 lines (79 loc) · 2.54 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
82
83
84
85
86
87
88
89
90
91
92
name: Lint and Scan
on:
# Only run on PRs targeting master
pull_request:
branches: [ master ]
types: [opened, synchronize, reopened]
# For direct pushes to master only
push:
branches: [ master ]
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/**'
- '!.github/workflows/lint.yml'
# Prevent duplicate workflow runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
golangci:
name: Go Linting
runs-on: ubuntu-latest
# Allow job to succeed even with lint issues for now
continue-on-error: true
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24.x
cache: true
# Simple linting first using standard go tools
- name: Run go fmt
run: |
go fmt ./...
- name: Run go vet
run: |
go vet ./...
- name: Run golangci-lint
id: lint
uses: golangci/golangci-lint-action@v7
with:
version: latest
gosec-issues:
name: Security Scan Issues
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: List security issues
uses: securego/gosec@master
with:
args: -exclude-generated ./...
license-check:
name: License Compliance
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24.x
- name: Check License Headers
run: |
# Only check Go files that aren't in vendor or generated
echo "Checking for Apache License headers in Go files..."
# Store files missing license in a variable
MISSING_LICENSE=$(find . -name "*.go" -type f -not -path "*/vendor/*" -not -path "*/mocks/*" | xargs grep -L "Licensed under the Apache License" || true)
# If any files are missing license headers, report and exit with error
if [ -n "$MISSING_LICENSE" ]; then
echo "ERROR: The following files are missing Apache License headers:"
echo "$MISSING_LICENSE"
echo "License check failed. Please add the appropriate license headers."
exit 1
else
echo "License check passed. All files have proper license headers."
fi