-
Notifications
You must be signed in to change notification settings - Fork 316
433 lines (416 loc) · 16.2 KB
/
Copy pathbuild_and_test.yaml
File metadata and controls
433 lines (416 loc) · 16.2 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
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
name: Build and Test
on:
pull_request:
branches:
- "main"
# Release branches are like "release/v0.1", "release/v0.2", etc. where we backport the changes to non EOL versions.
# The branch will be created from the main branch after the initial release tag is cut. For example, when we cut v0.8.0 release,
# we will create a branch "release/v0.8" from the main branch. For rc release, we simply iterate on main branch.
#
# See RELEASES.md for more details.
- "release/**"
push:
branches:
- "main"
- "release/**"
concurrency:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.actor }}-${{ github.event_name }}
cancel-in-progress: true
permissions:
contents: read
packages: write
id-token: write
jobs:
changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- uses: dorny/paths-filter@f3ceefdc7ef57bc2d8560787d4b6c33e44044cec
id: changes
with:
filters: |
code:
- '!**/*.md'
- '!docs/**'
- '!site/**'
- '!netlify.toml'
predicate-quantifier: every # Make the filters be AND-ed
token: "" # don't use github api
outputs:
code: ${{ steps.changes.outputs.code }}
unittest:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
name: Unit Test
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v5
with:
cache: false
go-version-file: go.mod
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: unittest-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}-${{ matrix.os }}
- run: make test-coverage GO_TEST_ARGS='-race'
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
with:
fail_ci_if_error: true
files: ./out/go-test-coverage.out
name: codecov-envoy-ai-gateway
verbose: true
# https://github.com/codecov/codecov-action/issues/1594#issuecomment-2394913029
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
test_crdcel:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
name: CRD CEL Validation Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v5
with:
cache: false
go-version-file: go.mod
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: controller-test-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}-${{ matrix.os }}
- run: make test-crdcel
test_controller:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
name: Controller Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v5
with:
cache: false
go-version-file: go.mod
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: controller-test-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}-${{ matrix.os }}
- run: make test-controller
test_data_plane:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
name: Data Plane Test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v5
with:
cache: false
go-version-file: go.mod
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: data-plane-tests-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}
- env:
TEST_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_BEDROCK_USER_AWS_ACCESS_KEY_ID }}
TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_BEDROCK_USER_AWS_SECRET_ACCESS_KEY }}
TEST_OPENAI_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_OPENAI_API_KEY }}
TEST_GEMINI_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_GEMINI_API_KEY }}
TEST_COHERE_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_COHERE_API_KEY }}
TEST_GROQ_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_GROQ_API_KEY }}
TEST_GROK_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_GROK_API_KEY }}
TEST_SAMBANOVA_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_SAMBANOVA_API_KEY }}
TEST_DEEPINFRA_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_DEEPINFRA_API_KEY }}
run: make test-data-plane
test_data_plane_mcp:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
name: Data Plane MCP Test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v5
with:
cache: false
go-version-file: go.mod
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: data-plane-tests-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}
- run: make test-data-plane-mcp
env:
TEST_GITHUB_ACCESS_TOKEN: ${{ secrets.TEST_GITHUB_ACCESS_TOKEN }}
test_e2e:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
# Not all the cases in E2E require secrets, so we run for all the events.
name: E2E Test (Envoy Gateway ${{ matrix.name }})
# TODO: make it possible to run this job on macOS as well, which is a bit tricky due to the nested
# virtualization is not supported on macOS runners.
# E.g. Use https://github.com/douglascamata/setup-docker-macos-action per the comment in
# https://github.com/actions/runner-images/issues/17#issuecomment-1971073406
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: latest
envoy_gateway_version: v0.0.0-latest
- name: v1.8.1
envoy_gateway_version: v1.8.1
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v5
with:
cache: false
go-version-file: go.mod
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
with:
path: |
~/.cache/go-build
~/.cache/golangci-lint
~/go/pkg/mod
~/go/bin
key: e2e-test-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- env:
EG_VERSION: ${{ matrix.envoy_gateway_version }}
TEST_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_BEDROCK_USER_AWS_ACCESS_KEY_ID }}
TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_BEDROCK_USER_AWS_SECRET_ACCESS_KEY }}
TEST_OPENAI_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_OPENAI_API_KEY }}
TEST_ANTHROPIC_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_ANTHROPIC_API_KEY }}
TEST_GEMINI_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_GEMINI_API_KEY }}
TEST_COHERE_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_COHERE_API_KEY }}
run: make test-e2e
test_e2e_upgrade:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
name: E2E Test for Upgrades (k8s ${{ matrix.k8s-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
k8s-version:
- v1.35.0
- v1.34.3
- v1.33.4
- v1.32.8
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v5
with:
cache: false
go-version-file: go.mod
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
with:
path: |
~/.cache/go-build
~/.cache/golangci-lint
~/go/pkg/mod
~/go/bin
key: e2e-test-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- run: make test-e2e-upgrade
env:
# We only need to test the upgrade from the latest stable version of EG.
EG_VERSION: v1.8.1
K8S_VERSION: ${{ matrix.k8s-version }}
test_e2e_inference_extension:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
name: E2E Test for Inference Extensions
# TODO: make it possible to run this job on macOS as well, which is a bit tricky due to the nested
# virtualization is not supported on macOS runners.
# E.g. Use https://github.com/douglascamata/setup-docker-macos-action per the comment in
# https://github.com/actions/runner-images/issues/17#issuecomment-1971073406
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v5
with:
cache: false
go-version-file: go.mod
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
with:
path: |
~/.cache/go-build
~/.cache/golangci-lint
~/go/pkg/mod
~/go/bin
key: e2e-test-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- run: make test-e2e-inference-extension
env:
EG_VERSION: v1.8.1
test_e2e_namespaced:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
name: E2E Test for Namespaced Controller
# TODO: make it possible to run this job on macOS as well, which is a bit tricky due to the nested
# virtualization is not supported on macOS runners.
# E.g. Use https://github.com/douglascamata/setup-docker-macos-action per the comment in
# https://github.com/actions/runner-images/issues/17#issuecomment-1971073406
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v5
with:
cache: false
go-version-file: go.mod
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
with:
path: |
~/.cache/go-build
~/.cache/golangci-lint
~/go/pkg/mod
~/go/bin
key: e2e-test-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- run: make test-e2e-namespaced
env:
# We only need to test with the latest stable version of EG, since these e2e tests
# do not depend on the EG version.
EG_VERSION: v1.8.1
test_e2e_aigw:
needs: changes
name: E2E Test for aigw CLI
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v5
with:
cache: false
go-version-file: go.mod
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
with:
path: |
~/.cache/go-build
~/.cache/golangci-lint
~/go/pkg/mod
~/go/bin
key: e2e-aigw-test-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Start Ollama server
run: |
curl -fsSL https://ollama.com/install.sh | sh && sudo systemctl stop ollama
nohup ollama serve > ollama.log 2>&1 &
timeout 30 sh -c 'until nc -z localhost 11434; do sleep 1; done'
grep _MODEL .env.ollama | cut -d= -f2 | xargs -I{} ollama pull {}
env:
OLLAMA_CONTEXT_LENGTH: 131072 # Larger context for goose
OLLAMA_HOST: 0.0.0.0
# Download Envoy via func-e using implicit default version `aigw` would
# otherwise need to download during test runs.
- name: Download Envoy via func-e
run: go tool -modfile=tools/go.mod func-e run --version
env:
FUNC_E_DATA_HOME: ~/.local/share/aigw
- name: Install Goose
env:
GOOSE_VERSION: v1.10.0
OS: Linux
run: |
curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh | CONFIGURE=false bash
- env:
TEST_GITHUB_ACCESS_TOKEN: ${{ secrets.TEST_GITHUB_ACCESS_TOKEN }}
run: make test-e2e-aigw
- if: failure()
run: cat ollama.log || true
docker_push:
# Docker builds are verified in test_e2e job, so we only need to push the images when the event is a push event.
if: github.event_name == 'push'
name: Push Docker Images
needs: [ci-required]
uses: ./.github/workflows/docker_build_job.yaml
secrets: inherit
helm_push:
name: Push Helm chart
# Only push the Helm chart to the GHR when merged into the main branch.
if: github.event_name == 'push'
needs: [docker_push]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4
- name: Login into DockerHub
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- run: |
make helm-push HELM_CHART_VERSION=v0.0.0-latest
make helm-push HELM_CHART_VERSION=0.0.0-latest
make helm-push HELM_CHART_VERSION=v0.0.0-${{ github.sha }} TAG=${{ github.sha }}
make helm-push HELM_CHART_VERSION=0.0.0-${{ github.sha }} TAG=${{ github.sha }}
# Aggregate all the required jobs and make it easier to customize CI required jobs
ci-required:
runs-on: ubuntu-latest
needs:
- unittest
- test_crdcel
- test_controller
- test_e2e
- test_e2e_upgrade
- test_e2e_inference_extension
- test_data_plane
- test_data_plane_mcp
- test_e2e_aigw
# We need this to run always to force-fail (and not skip) if any needed
# job has failed. Otherwise, a skipped job will not fail the workflow.
if: always()
steps:
- run: |
echo "CI required checks completed"
if [ "${{
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled')
}}" == "true" ]; then
echo "Some required jobs have failed or were cancelled or skipped."
exit 1
fi