-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.18 KB
/
code-quality.yml
File metadata and controls
54 lines (44 loc) · 1.18 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
name: Code Quality
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
code-quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.12.2
- name: Check formatting
run: |
# Run gofmt to format code
make fmt
# Check if any files were modified
if [ -n "$(git status --porcelain)" ]; then
echo "❌ Code formatting issues detected. Please run 'make fmt' locally and commit the changes."
echo ""
echo "Files that need formatting:"
git status --porcelain
echo ""
echo "Differences:"
git diff
exit 1
fi
echo "✅ All files are properly formatted"
- name: Run go vet
run: make vet
- name: Run golangci-lint
run: make lint