Skip to content

Commit b9d7958

Browse files
author
Moritz Clasmeier
committed
Code Quality GHA
1 parent 79e9884 commit b9d7958

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/code-quality.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Code Quality
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
code-quality:
11+
name: Code Quality Checks
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version-file: 'go.mod'
22+
cache: true
23+
24+
- name: Install golangci-lint
25+
run: |
26+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
27+
28+
- name: Check formatting
29+
run: |
30+
# Run gofmt to format code
31+
make fmt
32+
33+
# Check if any files were modified
34+
if [ -n "$(git status --porcelain)" ]; then
35+
echo "❌ Code formatting issues detected. Please run 'make fmt' locally and commit the changes."
36+
echo ""
37+
echo "Files that need formatting:"
38+
git status --porcelain
39+
echo ""
40+
echo "Differences:"
41+
git diff
42+
exit 1
43+
fi
44+
echo "✅ All files are properly formatted"
45+
46+
- name: Run go vet
47+
run: make vet
48+
49+
- name: Run golangci-lint
50+
run: make lint

0 commit comments

Comments
 (0)