-
Notifications
You must be signed in to change notification settings - Fork 14
361 lines (334 loc) · 11.5 KB
/
pr.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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
name: Pull Request
on: pull_request
permissions:
contents: read
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
changed:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- id: build
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366
with:
files: |
.github/workflows/pr.yml
justfile
examples/Dockerfile
- id: markdown
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366
with:
files: |
**/*.md
- id: actions
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366
with:
files: |
.github/workflows/**
.devcontainer/*
- id: kubert
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366
with:
files: |
Cargo.toml
kubert/**
- id: kubert-prometheus-process
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366
with:
files: |
Cargo.toml
kubert-prometheus-process/**
- id: kubert-prometheus-tokio
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366
with:
files: |
Cargo.toml
kubert-prometheus-tokio/**
- id: cargo
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366
with:
files: |
**/Cargo.toml
- id: deny
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366
with:
files: |
deny.toml
- id: rust
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366
with:
files: |
**/*.rs
outputs:
by-dependabot: ${{ github.actor == 'dependabot[bot]' }}
any: >-
${{
steps.build.outputs.any_changed == 'true' ||
steps.actions.outputs.any_changed == 'true' ||
steps.markdown.outputs.any_changed == 'true' ||
steps.kubert.outputs.any_change == 'true' ||
steps.kubert-prometheus-process.outputs.any_change == 'true' ||
steps.kubert-prometheus-tokio.outputs.any_change == 'true' ||
steps.cargo.outputs.any_changed == 'true' ||
steps.deny.outputs.any_changed == 'true' ||
steps.rust.outputs.any_changed == 'true'
}}
build: ${{ steps.build.outputs.any_changed == 'true' }}
actions: ${{ steps.actions.outputs.any_changed == 'true' }}
cargo: ${{ steps.cargo.outputs.any_changed == 'true' }}
deny: ${{ steps.deny.outputs.any_changed == 'true' }}
kubert: ${{ steps.kubert.outputs.any_changed == 'true' }}
kubert-prometheus-process: ${{ steps.kubert-prometheus-process.outputs.any_changed == 'true' }}
kubert-prometheus-tokio: ${{ steps.kubert-prometheus-tokio.outputs.any_changed == 'true' }}
rust: ${{ steps.rust.outputs.any_changed == 'true' }}
markdown: ${{ steps.markdown.outputs.any_changed == 'true' }}
info:
timeout-minutes: 3
needs: changed
runs-on: ubuntu-latest
steps:
- name: changed.outputs
run: |
jq . <<EOF
${{ toJson(needs.changed.outputs) }}
EOF
fmt:
needs: changed
if: needs.changed.outputs.rust == 'true' || needs.changed.outputs.build == 'true'
timeout-minutes: 5
runs-on: ubuntu-latest
container: ghcr.io/linkerd/dev:v44-rust
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- run: just fmt-check
doc:
needs: changed
if: needs.changed.outputs.rust == 'true' || needs.changed.outputs.cargo == 'true' || needs.changed.outputs.build == 'true'
timeout-minutes: 10
runs-on: ubuntu-latest
container: ghcr.io/linkerd/dev:v44-rust
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3
- run: just fetch
- run: just doc
deny:
needs: changed
if: needs.changed.outputs.cargo == 'true' || needs.changed.outputs.deny == 'true' || needs.changed.outputs.build == 'true'
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- advisories
- bans licenses sources
# Prevent sudden announcement of a new advisory from failing Ci.
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: EmbarkStudios/cargo-deny-action@3f4a782664881cf5725d0ffd23969fcce89fd868
with:
command: check ${{ matrix.checks }}
kubert-check-all:
needs: changed
if: needs.changed.outputs.kubert == 'true' || needs.changed.outputs.build == 'true'
strategy:
matrix:
rust:
- "1.81"
- "1.83"
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: linkerd/dev/actions/setup-tools@v44
- uses: linkerd/dev/actions/setup-rust@v44
with:
version: ${{ matrix.rust }}
components: clippy
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3
- run: just fetch
- run: just features=all clippy
- run: just test-build
- run: just test
kubert-check-feature:
needs: changed
if: needs.changed.outputs.kubert == 'true' || needs.changed.outputs.build == 'true'
strategy:
matrix:
feature:
- admin
- admin,prometheus-client
- client
- client,rustls-tls
- client,openssl-tls
- errors
- index
- initialized
- lease
- log
- prometheus-client
- requeue
- runtime
- runtime,lease
- runtime,runtime-diagnostics
- runtime,runtime-diagnostics,lease,prometheus-client
- server
- server,rustls-tls
- server,openssl-tls
- shutdown
timeout-minutes: 10
runs-on: ubuntu-latest
container: ghcr.io/linkerd/dev:v44-rust
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3
- run: just fetch
- run: just "features=${{ matrix.feature }}" clippy
kubert-client-local:
needs: changed
if: needs.changed.outputs.kubert == 'true' || needs.changed.outputs.build == 'true'
strategy:
matrix:
k8s:
- v1.21
- v1.31
tls:
- openssl-tls
- rustls-tls
timeout-minutes: 30 # building with OpenSSL can be quite slow...
runs-on: ubuntu-latest
env:
KUBERT_TEST_CLUSTER_VERSION: ${{ matrix.k8s }}
steps:
- uses: linkerd/dev/actions/setup-tools@v44
- uses: linkerd/dev/actions/setup-rust@v44
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3
- run: just fetch
- run: just features=${{ matrix.tls }} build-examples
- run: just features=${{ matrix.tls }} test-cluster-create
- run: just features=${{ matrix.tls }} test-cluster-run-watch-pods --log-level=debug
- run: just features=${{ matrix.tls }} test-cluster-create-ns
- name: Run just test-cluster-run-watch-pods with impersonation
run: |
just features=${{ matrix.tls }} \
test-cluster-run-watch-pods \
--log-level=debug \
--as=system:serviceaccount:${KUBERT_TEST_NS}:watch-pods \
--kubeconfig=$HOME/.kube/config
- run: just features=${{ matrix.tls }} test-lease-build
- run: just features=${{ matrix.tls }} test-lease
kubert-client-in-cluster:
needs: changed
if: needs.changed.outputs.kubert == 'true' || needs.changed.outputs.build == 'true'
strategy:
matrix:
k8s:
- v1.21
- v1.31
tls:
- openssl-tls
- rustls-tls
timeout-minutes: 15
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KUBERT_TEST_CLUSTER_VERSION: ${{ matrix.k8s }}
KUBERT_TEST_NS: kubert-test
steps:
- uses: linkerd/dev/actions/setup-tools@v44
- uses: linkerd/dev/actions/setup-rust@v44
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- run: just features=${{ matrix.tls }} build-examples-image
- run: just features=${{ matrix.tls }} test-cluster-create
- run: just features=${{ matrix.tls }} test-cluster-import-examples
- run: just features=${{ matrix.tls }} test-cluster-create-ns
- run: just features=${{ matrix.tls }} test-cluster-deploy-watch-pods --log-level=debug
kubert-prometheus-process:
needs: changed
if: needs.changed.outputs.kubert-prometheus-process == 'true' || needs.changed.outputs.build == 'true'
strategy:
matrix:
rust:
- "1.81"
- "1.83"
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: linkerd/dev/actions/setup-tools@v44
- uses: linkerd/dev/actions/setup-rust@v44
with:
version: ${{ matrix.rust }}
components: clippy
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3
- run: just fetch
- run: just-cargo clippy -p kubert-prometheus-process
#- run: just-cargo test -p kubert-prometheus-process
kubert-prometheus-tokio:
needs: changed
if: needs.changed.outputs.kubert-prometheus-tokio == 'true' || needs.changed.outputs.build == 'true'
strategy:
matrix:
rust:
- "1.81"
- "1.83"
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: linkerd/dev/actions/setup-tools@v44
- uses: linkerd/dev/actions/setup-rust@v44
with:
version: ${{ matrix.rust }}
components: clippy
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3
- run: just fetch
- run: just-cargo clippy -p kubert-prometheus-tokio
#- run: just-cargo test -p kubert-prometheus-tokio
markdown:
needs: changed
if: needs.changed.outputs.markdown == 'true' || needs.changed.outputs.build == 'true'
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: DavidAnson/markdownlint-cli2-action@a23dae216ce3fee4db69da41fed90d2a4af801cf
with:
globs: |
**/*.md
!**/node_modules/**
!target/**
pr-ok:
needs:
- deny
- doc
- fmt
- kubert-check-all
- kubert-check-feature
- kubert-client-local
- kubert-client-in-cluster
- kubert-prometheus-process
- kubert-prometheus-tokio
- markdown
if: always()
timeout-minutes: 3
runs-on: ubuntu-latest
steps:
- name: Results
run: |
jq . <<EOF
${{ toJson(needs) }}
EOF
- name: Verify jobs
# All jobs must succeed or be skipped.
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1