forked from mariadb-operator/mariadb-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
239 lines (200 loc) · 5.47 KB
/
ci.yml
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: CI
on:
push:
branches:
- main
pull_request: {}
env:
GOLANGCI_VERSION: "v1.60.1"
jobs:
detect-noop:
name: Detect noop
runs-on: ubuntu-latest
outputs:
noop: ${{ steps.noop.outputs.should_skip }}
steps:
- name: Detect no-op changes
id: noop
uses: fkirc/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
paths_ignore: '["*.md","**.md.gotmpl","examples/**"]'
concurrent_skipping: false
detect-ent:
name: Detect enterprise
runs-on: ubuntu-latest
outputs:
ent: ${{ steps.ent.outputs.ent }}
steps:
- name: Detect enterprise
id: ent
env:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
if: "${{ env.DOCKERHUB_USER != '' }}"
run: |
echo "ent='true'" >> $GITHUB_OUTPUT
lint:
name: Lint
runs-on: ubuntu-latest
needs: detect-noop
if: ${{ needs.detect-noop.outputs.noop != 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- name: GolangCI Lint
uses: golangci/golangci-lint-action@v6
with:
version: ${{ env.GOLANGCI_VERSION }}
build:
name: Build
runs-on: ubuntu-latest
needs: detect-noop
if: ${{ needs.detect-noop.outputs.noop != 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- name: Build
run: make build
- name: Build Enterprise
run: make build-ent
- name: Build Docker
run: make docker-build
- name: Build Enterprise Docker
run: make docker-build-ent
unit-test:
name: Unit tests
runs-on: ubuntu-latest
needs: detect-noop
if: ${{ needs.detect-noop.outputs.noop != 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- name: Test
run: |
make helm-crds
make test
integration-test:
name: Integration tests
runs-on: ubuntu-latest
needs: detect-noop
if: ${{ needs.detect-noop.outputs.noop != 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- name: Cluster
run: |
make cluster
make install
make install-minio
make net
- name: Test
run: make test-int
integration-test-ent:
name: Integration tests enterprise
runs-on: ubuntu-latest
needs:
- detect-noop
- detect-ent
if: ${{ needs.detect-noop.outputs.noop != 'true' && needs.detect-ent.outputs.ent != '' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- name: Login Docker MariaDB
uses: docker/login-action@v3
with:
registry: docker-registry.mariadb.com
username: ${{ secrets.DOCKER_MARIADB_USER }}
password: ${{ secrets.DOCKER_MARIADB_PASSWORD }}
- name: Cluster
run: |
make cluster
make registry
make install-ent
make install-minio
make net
- name: Test
run: make test-int-ent
olm:
name: OLM
runs-on: ubuntu-latest
needs: detect-noop
if: ${{ needs.detect-noop.outputs.noop != 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate
run: make bundle-validate
- name: Build image
run: make bundle-build
- name: Cluster
run: make cluster
- name: Scorecard
run: make bundle-scorecard
artifacts:
name: Artifacts
runs-on: ubuntu-latest
needs: detect-noop
if: ${{ needs.detect-noop.outputs.noop != 'true' }}
env:
CRD_FILE: deploy/charts/mariadb-operator-crds/templates/crds.yaml
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate
run: make generate
- name: Check diff
uses: mmontes11/[email protected]
with:
message: Generated artifacts are not up to date. Run 'make generate' and commit the changes.
- name: Verify CRD size
shell: bash
run: |
crd_file="$CRD_FILE"
max_size=$((900 * 1024))
crd_size=$(stat -c%s "$crd_file")
echo "Current CRD size: $((crd_size / 1024)) KB"
if [ "$crd_size" -ge "$max_size" ]; then
echo "Error: CRDs exceed 900KB (current size: $((crd_size / 1024)) KB)"
exit 1
fi
licenses:
name: Licenses
runs-on: ubuntu-latest
needs: detect-noop
if: ${{ needs.detect-noop.outputs.noop != 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate
run: make licenses
- name: Check licenses
run: |
if [ ! -d "licenses" ] || [ ! -n "$(ls -A licenses)" ]; then
echo "Error: No licenses generated"
exit 1
fi