Skip to content

Commit 1fad1a5

Browse files
lukasmetznerjooola
andauthored
ci: added golangci-lint to pre-commit (#829)
Added golangci-lint run hook to pre-commit configuration and removed separate CI step. --------- Co-authored-by: Jonas L. <jooola@users.noreply.github.com>
1 parent 5f43b86 commit 1fad1a5

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

.github/workflows/ci.yml

+9-16
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ jobs:
1616
with:
1717
python-version: 3.x
1818

19+
- uses: actions/cache@v4
20+
with:
21+
path: ~/.cache/golangci-lint
22+
key: pre-commit-golangci-lint|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}|${{ hashFiles('**/*.go') }}
23+
restore-keys: |
24+
pre-commit-golangci-lint|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}|
25+
pre-commit-golangci-lint|${{ env.pythonLocation }}|
26+
pre-commit-golangci-lint|
27+
1928
- uses: pre-commit/action@v3.0.1
2029

2130
test:
@@ -36,22 +45,6 @@ jobs:
3645
with:
3746
token: ${{ secrets.CODECOV_TOKEN }}
3847

39-
lint:
40-
name: Lint
41-
runs-on: ubuntu-latest
42-
steps:
43-
- uses: actions/checkout@v4
44-
- uses: actions/setup-go@v5
45-
with:
46-
go-version-file: go.mod
47-
48-
- uses: golangci/golangci-lint-action@v6
49-
with:
50-
version: v1.62.2 # renovate: datasource=github-releases depName=golangci/golangci-lint
51-
52-
# In general linting is quite fast with warm caches, but a fresh run might take some time.
53-
args: --timeout 5m
54-
5548
deploy-manifests:
5649
name: Check deployment manifests
5750
runs-on: ubuntu-latest

.pre-commit-config.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,10 @@ repos:
5050
rev: v0.10.0.1
5151
hooks:
5252
- id: shellcheck
53+
54+
- repo: https://github.com/golangci/golangci-lint
55+
rev: v1.62.2
56+
hooks:
57+
- id: golangci-lint-full
58+
args: [--timeout=5m]
59+
language_version: 1.23.4 # renovate: datasource=golang-version

0 commit comments

Comments
 (0)