From 09f8fcd83d3466b0509c94c33e030a3f3890a7b8 Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Sun, 23 Aug 2026 16:44:19 +1000 Subject: [PATCH] Split CI into pre-commit/test/build workflows for branch protection Branch protection on this repo will require the contexts ci/woodpecker/pr/pre-commit, ci/woodpecker/pr/test and ci/woodpecker/pr/build, mirroring the node-lookup workflow layout. - Adds .woodpecker/pre-commit.yaml running pre-commit via uvx - Adds .pre-commit-config.yaml mirroring node-lookup (vendored web/static assets excluded) - Adds .woodpecker/test.yaml with vet + gofmt check + race tests - Reworks build.yaml to compile via make build plus the existing buildx dry-run image check, PR events only - Renames docker.yaml to release.yaml per node-lookup convention (tag-driven docker release unchanged) --- .pre-commit-config.yaml | 19 +++++++++++++++++++ .woodpecker/build.yaml | 8 +++----- .woodpecker/pre-commit.yaml | 18 ++++++++++++++++++ .woodpecker/{docker.yaml => release.yaml} | 0 .woodpecker/test.yaml | 20 ++++++++++++++++++++ 5 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 .woodpecker/pre-commit.yaml rename .woodpecker/{docker.yaml => release.yaml} (100%) create mode 100644 .woodpecker/test.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c91b826 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +exclude: ^web/static/ + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-merge-conflict + - id: mixed-line-ending + args: [--fix=lf] + + - repo: https://github.com/dnephin/pre-commit-golang + rev: v0.5.1 + hooks: + - id: go-fmt + - id: go-vet + - id: go-unit-tests diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml index c452a1e..9044f0b 100644 --- a/.woodpecker/build.yaml +++ b/.woodpecker/build.yaml @@ -1,13 +1,11 @@ when: - - event: [pull_request, push] + - event: pull_request steps: - - name: test + - name: build image: golang:1.25 commands: - - go vet ./... - - test -z "$(gofmt -l .)" - - go test -race ./... + - make build backend_options: kubernetes: serviceAccountName: default diff --git a/.woodpecker/pre-commit.yaml b/.woodpecker/pre-commit.yaml new file mode 100644 index 0000000..d57b508 --- /dev/null +++ b/.woodpecker/pre-commit.yaml @@ -0,0 +1,18 @@ +when: + - event: pull_request + +steps: + - name: pre-commit + image: git.unkin.net/unkin/almalinux9-gobuilder:20260606 + commands: + - uvx pre-commit run --all-files + backend_options: + kubernetes: + serviceAccountName: default + resources: + requests: + memory: 512Mi + cpu: 1 + limits: + memory: 2Gi + cpu: 2 diff --git a/.woodpecker/docker.yaml b/.woodpecker/release.yaml similarity index 100% rename from .woodpecker/docker.yaml rename to .woodpecker/release.yaml diff --git a/.woodpecker/test.yaml b/.woodpecker/test.yaml new file mode 100644 index 0000000..5884a7a --- /dev/null +++ b/.woodpecker/test.yaml @@ -0,0 +1,20 @@ +when: + - event: pull_request + +steps: + - name: test + image: golang:1.25 + commands: + - go vet ./... + - test -z "$(gofmt -l .)" + - go test -v -race ./... + backend_options: + kubernetes: + serviceAccountName: default + resources: + requests: + memory: 512Mi + cpu: 1 + limits: + memory: 2Gi + cpu: 2