-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (70 loc) · 2.01 KB
/
code-quality.yml
File metadata and controls
83 lines (70 loc) · 2.01 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
name: Code Quality
on:
push:
branches:
- main
paths:
- "**.go"
- "go.mod"
- "go.sum"
- "Taskfile.yml"
- ".golangci.yml"
- ".github/workflows/code-quality.yml"
pull_request:
branches:
- main
paths:
- "**.go"
- "go.mod"
- "go.sum"
- "Taskfile.yml"
- ".golangci.yml"
- ".pre-commit-config.yaml"
- ".github/workflows/code-quality.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GO_VERSION: "1.26.0"
jobs:
code-quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
- name: Install Task
uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
- name: Install pre-commit
run: pip install pre-commit
- name: Cache pre-commit environments
uses: actions/cache@v5
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-${{ runner.os }}-
- name: Run pre-commit hooks
run: pre-commit run --all-files --show-diff-on-failure
- name: Check code formatting
run: |
task fmt
if [ -n "$(git diff --name-only)" ]; then
echo "Code formatting changes detected:"
git diff
exit 1
fi
- name: Run linter
run: task lint