-
Notifications
You must be signed in to change notification settings - Fork 69
209 lines (175 loc) · 4.67 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
name: CI
on:
push:
branches:
- main
pull_request: {}
env:
GOLANGCI_VERSION: "v1.56.2"
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@v5
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
test:
name: Test
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-ha
make install
make install-minio
make net
- name: Test
run: make test
test-ent:
name: Test 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 DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login GAR
uses: docker/login-action@v3
with:
registry: us-central1-docker.pkg.dev
username: _json_key
password: ${{ secrets.GAR_JSON_KEY }}
- name: Cluster
run: |
make cluster
make registry
make install-ent
make install-minio
make net
- name: Test
run: make test-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
gen:
name: Generate artifacts
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 generate
- name: Check diff
uses: mmontes11/[email protected]
with:
message: Generated artifacts are not up to date. Run 'make generate' and commit the changes.
licenses:
name: Generate 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