Skip to content

Commit

Permalink
ci: added golangci-lint to pre-commit (#829)
Browse files Browse the repository at this point in the history
Added golangci-lint run hook to pre-commit configuration and removed
separate CI step.

---------

Co-authored-by: Jonas L. <[email protected]>
  • Loading branch information
lukasmetzner and jooola authored Dec 20, 2024
1 parent 5f43b86 commit 1fad1a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
25 changes: 9 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ jobs:
with:
python-version: 3.x

- uses: actions/cache@v4
with:
path: ~/.cache/golangci-lint
key: pre-commit-golangci-lint|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}|${{ hashFiles('**/*.go') }}
restore-keys: |
pre-commit-golangci-lint|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}|
pre-commit-golangci-lint|${{ env.pythonLocation }}|
pre-commit-golangci-lint|
- uses: pre-commit/[email protected]

test:
Expand All @@ -36,22 +45,6 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod

- uses: golangci/golangci-lint-action@v6
with:
version: v1.62.2 # renovate: datasource=github-releases depName=golangci/golangci-lint

# In general linting is quite fast with warm caches, but a fresh run might take some time.
args: --timeout 5m

deploy-manifests:
name: Check deployment manifests
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@ repos:
rev: v0.10.0.1
hooks:
- id: shellcheck

- repo: https://github.com/golangci/golangci-lint
rev: v1.62.2
hooks:
- id: golangci-lint-full
args: [--timeout=5m]
language_version: 1.23.4 # renovate: datasource=golang-version

0 comments on commit 1fad1a5

Please sign in to comment.