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)
This commit is contained in:
@@ -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
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
when:
|
when:
|
||||||
- event: [pull_request, push]
|
- event: pull_request
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: test
|
- name: build
|
||||||
image: golang:1.25
|
image: golang:1.25
|
||||||
commands:
|
commands:
|
||||||
- go vet ./...
|
- make build
|
||||||
- test -z "$(gofmt -l .)"
|
|
||||||
- go test -race ./...
|
|
||||||
backend_options:
|
backend_options:
|
||||||
kubernetes:
|
kubernetes:
|
||||||
serviceAccountName: default
|
serviceAccountName: default
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user