Skip to content

Commit fbf762f

Browse files
syscod3claude
andcommitted
ci: consolidate lint+test into ci.yml — commitizen, manifests drift, codecov
Replaces stub lint.yml and test.yml with a proper pipeline: - lint job: conventional commits, CRD drift check, golangci-lint, gitleaks - build job: multi-arch (amd64 + arm64), depends on lint - test job: envtest + codecov upload, depends on lint Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1ea5855 commit fbf762f

3 files changed

Lines changed: 86 additions & 46 deletions

File tree

.github/workflows/ci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
env:
9+
GO_VERSION: "1.25"
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # commitizen needs full history
18+
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version: ${{ env.GO_VERSION }}
22+
23+
# Conventional commit validation — skip for dependabot
24+
- name: Check commit messages
25+
if: github.actor != 'dependabot[bot]'
26+
run: |
27+
pip install commitizen --quiet
28+
if [ "${{ github.event_name }}" = "pull_request" ]; then
29+
cz check --rev-range ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
30+
else
31+
cz check --rev-range HEAD~1..HEAD
32+
fi
33+
34+
# CRD drift — fail if types were changed without re-running make manifests
35+
- name: Check manifests are up to date
36+
run: |
37+
make manifests
38+
git diff --exit-code || (echo "Run 'make manifests' and commit the result" && exit 1)
39+
40+
- name: golangci-lint
41+
uses: golangci/golangci-lint-action@v6
42+
with:
43+
version: v2.8.0
44+
45+
- name: Install gitleaks
46+
run: |
47+
curl -sSfL https://github.com/gitleaks/gitleaks/releases/download/v8.24.2/gitleaks_8.24.2_linux_x64.tar.gz \
48+
| tar -xz -C /usr/local/bin gitleaks
49+
50+
- name: Gitleaks
51+
run: gitleaks detect --source . --no-git
52+
53+
build:
54+
runs-on: ubuntu-latest
55+
needs: lint
56+
strategy:
57+
matrix:
58+
arch: [amd64, arm64]
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- uses: actions/setup-go@v5
63+
with:
64+
go-version: ${{ env.GO_VERSION }}
65+
66+
- name: Build
67+
run: CGO_ENABLED=0 GOOS=linux GOARCH=${{ matrix.arch }} go build ./cmd/...
68+
69+
test:
70+
runs-on: ubuntu-latest
71+
needs: lint
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- uses: actions/setup-go@v5
76+
with:
77+
go-version: ${{ env.GO_VERSION }}
78+
79+
- name: Run tests
80+
run: make test
81+
82+
- name: Upload coverage
83+
uses: codecov/codecov-action@v5
84+
with:
85+
files: coverage.out
86+
fail_ci_if_error: false

.github/workflows/lint.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)