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