Repository navigation
175 lines (164 loc) · 4.72 KB
/
Copy pathci.yml
File metadata and controls
175 lines (164 loc) · 4.72 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
workflow_dispatch:
permissions:
contents: read
# Each job maps to a local make target for easy debugging:
# lint → make lint
# test → make test
# build → make build
# govulncheck → make govulncheck
# helm-lint → make helm-lint && make helm-template
# docs-build → make docs-build
# e2e → make e2e-local
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- uses: golangci/golangci-lint-action@v9
with:
version: v2.13.2
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Run tests
run: make test
govulncheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Scan for known vulnerabilities
run: make govulncheck
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Build
run: make build
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build Docker image (no push)
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
tags: drop:ci-build
cache-from: type=gha,scope=drop-image
cache-to: type=gha,scope=drop-image,mode=max,ignore-error=true
provenance: false
helm-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- uses: azure/setup-helm@v5
- name: Generate CRDs and sync into charts
run: make sync-crds
- name: Lint Helm charts
run: |
helm lint charts/drop
helm lint charts/drop-crds
- name: Template Helm charts
run: |
helm template drop charts/drop
helm template drop-crds charts/drop-crds
docs-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: false
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 'latest'
extended: true
- name: Build docs
working-directory: docs
run: |
hugo mod get
hugo --minify
e2e:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Install kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.24.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
- name: Create kind cluster
run: make kind-create KIND=kind
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build image (reusing docker-build layer cache)
uses: docker/build-push-action@v7
with:
context: .
load: true
tags: controller:ci
cache-from: |
type=gha,scope=drop-image
type=gha,scope=drop-image-e2e
cache-to: type=gha,scope=drop-image-e2e,mode=max,ignore-error=true
provenance: false
- name: Load image into kind
run: kind load docker-image controller:ci --name drop-dev
- name: Install CRDs
run: |
make controller-gen
make sync-crds
kubectl apply -f config/crd/bases/
- name: Deploy E2E infrastructure (Prometheus, Loki, Registry)
run: make e2e-infra
- name: Deploy operator
run: |
helm install drop charts/drop \
--namespace drop-system \
--create-namespace \
--skip-crds \
--set crds.install=false \
--set image.repository=controller \
--set image.tag=ci \
--set image.pullPolicy=Never \
--set leaderElection.enabled=false \
--set metrics.enabled=true \
--set metrics.secureServing=false \
--wait --timeout 120s
- name: Run E2E tests
run: make test-e2e