-
Notifications
You must be signed in to change notification settings - Fork 27
259 lines (219 loc) · 6.88 KB
/
pr-checks.yaml
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
name: pr-checks
on:
pull_request:
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: Install all tools
uses: ./.github/tools-cache
- name: make docs
run: |
make docs
git diff --exit-code
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: Install all tools
uses: ./.github/tools-cache
- name: make fmt
run: make fmt && git diff --exit-code
escapes_detect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: Install all tools
uses: ./.github/tools-cache
- name: run escapes detect
run: make escapes_detect
golangci:
permissions:
contents: read
# NOTE: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
runs-on: ubuntu-latest
steps:
- name: code checkout
uses: actions/checkout@v3
- uses: actions/setup-go@main
with:
go-version-file: go.mod
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53
args: --timeout=3m --issues-exit-code=0 ./...
only-new-issues: true
vulnerability_detect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: Install all tools
uses: ./.github/tools-cache
- name: run vulnerability detect
run: make check-govuln
bundle:
needs: [docs, golangci, fmt, vulnerability_detect, escapes_detect]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: Install all tools
uses: ./.github/tools-cache
- name: bundle
run: |
make generate manifests bundle
git diff --exit-code
build-images:
needs: [docs, golangci, fmt, vulnerability_detect, escapes_detect]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- uses: ./.github/compute-version
id: version
- name: additional image tags
id: additional_tags
shell: bash
run: |
echo "result=$(git rev-parse --short HEAD),v1alpha1" >> $GITHUB_OUTPUT
- name: Install all tools
uses: ./.github/tools-cache
- name: build images for PR checks
uses: ./.github/publish-images
with:
image_registry: "localhost:5001"
version: ${{ steps.version.outputs.version }}
additional_tags: ${{ steps.additional_tags.outputs.result }}
operator-upgrade:
needs: [build-images,bundle]
env:
KIND_VERSION: "0.15.0"
GO111MODULE: "on"
OPERATOR_IMAGE: "quay.io/sustainable_computing_io/kepler-operator"
KUBECONFIG: /tmp/.kube/config
KIND_WORKER_NODES: 2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
go-version-file: go.mod
- name: Install Go
uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: Install all tools
uses: ./.github/tools-cache
- name: use kepler action for kind cluster build
uses: sustainable-computing-io/kepler-action@v0.0.5
with:
ebpfprovider: libbpf
cluster_provider: kind
env:
PROMETHEUS_ENABLE: "false"
- name: Ensure cluster is able to run OLM bundles
run: make cluster-prereqs
- uses: ./.github/compute-version
id: version
- name: Run Operator Upgrade
shell: bash
run: |
./tests/run-e2e.sh --ci
env:
VERSION: ${{ steps.version.outputs.version }}
- name: Capture cluster state
if: always()
shell: bash
run: |
# Capture apiserver state
# TODO: enable this when we have oc installed as part of `make tools`
# oc adm inspect node --dest-dir cluster-state || true
# oc adm inspect -A statefulset --dest-dir cluster-state || true
# oc adm inspect -A deployment --dest-dir cluster-state || true
# oc adm inspect -A ns --dest-dir cluster-state || true
cp -r tmp/e2e cluster-state/ || true
- name: Archive production artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: cluster-state
path: cluster-state
e2e:
needs: [operator-upgrade]
env:
KIND_VERSION: "0.15.0"
GO111MODULE: "on"
OPERATOR_IMAGE: "quay.io/sustainable_computing_io/kepler-operator"
KUBECONFIG: /tmp/.kube/config
KIND_WORKER_NODES: 2
name: e2e
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: Install all tools
uses: ./.github/tools-cache
- name: use kepler action for kind cluster build
uses: sustainable-computing-io/kepler-action@v0.0.5
with:
ebpfprovider: libbpf
cluster_provider: kind
env:
PROMETHEUS_ENABLE: "false"
- name: Ensure cluster is able to run OLM bundles
run: make cluster-prereqs
- uses: ./.github/compute-version
id: version
- name: reclaim space before running tests
run: |
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
sudo rm -rf /tmp/*
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /opt/hostedtoolcache/Python
df -kh
- name: Run e2e tests
run: |
./tests/run-e2e.sh --ci --no-upgrade
env:
VERSION: ${{ steps.version.outputs.version }}
- name: Capture cluster state
if: always()
shell: bash
run: |
# Capture apiserver state
# TODO: enable this when we have oc installed as part of `make tools`
# oc adm inspect node --dest-dir cluster-state || true
# oc adm inspect -A statefulset --dest-dir cluster-state || true
# oc adm inspect -A deployment --dest-dir cluster-state || true
# oc adm inspect -A ns --dest-dir cluster-state || true
cp -r tmp/e2e cluster-state/ || true
- name: Archive production artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: cluster-state
path: cluster-state