Merge pull request 'Split PR CI into pre-commit, test, and build workflows' (#2) from benvin/ci-split into main
Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
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
|
||||||
@@ -2,21 +2,6 @@ when:
|
|||||||
- event: [pull_request, push]
|
- event: [pull_request, push]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: test
|
|
||||||
image: golang:1.25
|
|
||||||
commands:
|
|
||||||
- go test -race ./...
|
|
||||||
backend_options:
|
|
||||||
kubernetes:
|
|
||||||
serviceAccountName: default
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
memory: 512Mi
|
|
||||||
cpu: 1
|
|
||||||
limits:
|
|
||||||
memory: 2Gi
|
|
||||||
cpu: 2
|
|
||||||
|
|
||||||
# Validate the image builds without pushing. The CA-baked buildx plugin trusts
|
# Validate the image builds without pushing. The CA-baked buildx plugin trusts
|
||||||
# the internal registry's CA; the plain woodpeckerci plugin fails x509 here.
|
# the internal registry's CA; the plain woodpeckerci plugin fails x509 here.
|
||||||
- name: build-check
|
- name: build-check
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
when:
|
||||||
|
- event: [pull_request, push]
|
||||||
|
|
||||||
|
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,18 @@
|
|||||||
|
when:
|
||||||
|
- event: [pull_request, push]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: test
|
||||||
|
image: golang:1.25
|
||||||
|
commands:
|
||||||
|
- make test
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: default
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 1
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 2
|
||||||
@@ -6,7 +6,7 @@ GOFLAGS := -ldflags="-s -w -X main.version=$(VERSION)"
|
|||||||
OS ?= $(shell go env GOOS)
|
OS ?= $(shell go env GOOS)
|
||||||
ARCH ?= $(shell go env GOARCH)
|
ARCH ?= $(shell go env GOARCH)
|
||||||
|
|
||||||
.PHONY: all build test test-integration lint fmt clean docker patch minor major _tag
|
.PHONY: all build test test-integration lint fmt pre-commit clean docker patch minor major _tag
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
@@ -27,6 +27,12 @@ lint:
|
|||||||
fmt:
|
fmt:
|
||||||
gofmt -w .
|
gofmt -w .
|
||||||
|
|
||||||
|
# Run the pre-commit hooks across the whole tree. uvx fetches pre-commit on
|
||||||
|
# demand; falls back to a bare pre-commit on PATH if uvx is absent.
|
||||||
|
pre-commit:
|
||||||
|
@if command -v uvx >/dev/null 2>&1; then uvx pre-commit run --all-files; \
|
||||||
|
else pre-commit run --all-files; fi
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(DIST)
|
rm -rf $(DIST)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user