From 74d9c0fa84ea43dc12e712bf835d518b655c9d01 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Tue, 23 Jun 2026 23:21:09 +1000 Subject: [PATCH] chore: add pre-commit config and update CI pipeline (#55) ## Summary - New `.pre-commit-config.yaml` with standard Go hooks (gofmt, go vet, go mod tidy) plus file hygiene checks (trailing whitespace, end-of-file, yaml, large files, merge conflicts) - go vet runs as a local hook with `./...` since the dnephin per-file hook doesn't work with Go module layouts - Woodpecker pre-commit pipeline updated to use `almalinux9-gobuilder` image with `uvx pre-commit run --all-files` - Pre-commit hooks installed into the repo Reviewed-on: https://git.unkin.net/unkin/artifactapi/pulls/55 Co-authored-by: Ben Vincent Co-committed-by: Ben Vincent --- .pre-commit-config.yaml | 24 ++++++++++++++++++++++++ .woodpecker/pre-commit.yaml | 14 +++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..82bd396 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: check-merge-conflict + + - repo: https://github.com/dnephin/pre-commit-golang + rev: v0.5.1 + hooks: + - id: go-fmt + - id: go-mod-tidy + + - repo: local + hooks: + - id: go-vet + name: go vet + entry: go vet ./... + language: system + types: [go] + pass_filenames: false diff --git a/.woodpecker/pre-commit.yaml b/.woodpecker/pre-commit.yaml index 2dd88b8..c250c97 100644 --- a/.woodpecker/pre-commit.yaml +++ b/.woodpecker/pre-commit.yaml @@ -3,7 +3,15 @@ when: steps: - name: pre-commit - image: golang:1.25 + image: git.unkin.net/unkin/almalinux9-gobuilder:20260606 commands: - - test -z "$(gofmt -l .)" - - go vet ./... + - uvx pre-commit run --all-files + backend_options: + kubernetes: + resources: + requests: + memory: 512Mi + cpu: 1 + limits: + memory: 2Gi + cpu: 2