Skip to content

Commit 6ad8c1e

Browse files
committed
[ci] Separated workflows for PR and push to main and releases
Signed-off-by: dd di cesare <[email protected]>
1 parent af51522 commit 6ad8c1e

File tree

2 files changed

+380
-5
lines changed

2 files changed

+380
-5
lines changed

.github/workflows/test-release.yaml

+375
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,375 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ 'release-*' ]
6+
pull_request:
7+
branches: ['release-*']
8+
merge_group:
9+
types: [ checks_requested ]
10+
workflow_dispatch:
11+
12+
jobs:
13+
pre-job:
14+
runs-on: ubuntu-latest
15+
name: Pre job checks
16+
outputs:
17+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
- id: skip_check
21+
uses: fkirc/[email protected]
22+
with:
23+
cancel_others: false
24+
paths_ignore: '["**.adoc", "**.md", "examples/**", "LICENSE"]'
25+
unit-tests:
26+
name: Unit Tests
27+
if: needs.pre-job.outputs.should_skip != 'true'
28+
needs: pre-job
29+
strategy:
30+
matrix:
31+
go-version: [1.22.x]
32+
platform: [ubuntu-latest]
33+
runs-on: ${{ matrix.platform }}
34+
defaults:
35+
run:
36+
shell: bash
37+
steps:
38+
- name: Set up Go ${{ matrix.go-version }}
39+
uses: actions/setup-go@v4
40+
with:
41+
go-version: ${{ matrix.go-version }}
42+
id: go
43+
- name: Check out code
44+
uses: actions/checkout@v4
45+
- name: Run make test
46+
run: |
47+
make test-unit
48+
- name: Upload unit-test coverage reports to CodeCov
49+
# more at https://github.com/codecov/codecov-action
50+
# Only run if the feature branch is in your repo (not in a fork)
51+
# as Tokenless uploading is rate limited for public repos
52+
if: github.event.pull_request.head.repo.full_name == github.repository
53+
uses: codecov/codecov-action@v4
54+
with:
55+
token: ${{ secrets.CODECOV_TOKEN }}
56+
flags: unit
57+
fail_ci_if_error: false
58+
verbose: true
59+
60+
controllers-integration-tests:
61+
name: Integration Tests for kuadrant-operator/controllers
62+
if: needs.pre-job.outputs.should_skip != 'true'
63+
needs: pre-job
64+
strategy:
65+
matrix:
66+
include:
67+
- gatewayapi-provider: istio
68+
istio-type: istioctl
69+
- gatewayapi-provider: istio
70+
istio-type: sail
71+
- gatewayapi-provider: envoygateway
72+
fail-fast: false
73+
runs-on: ubuntu-latest
74+
env:
75+
KIND_CLUSTER_NAME: kuadrant-test
76+
KUADRANT_NAMESPACE: kuadrant-system
77+
defaults:
78+
run:
79+
shell: bash
80+
steps:
81+
- name: Set up Go 1.22.x
82+
uses: actions/setup-go@v4
83+
with:
84+
go-version: 1.22.x
85+
id: go
86+
- name: Check out code
87+
uses: actions/checkout@v4
88+
- name: Create k8s Kind Cluster
89+
uses: helm/[email protected]
90+
with:
91+
version: v0.23.0
92+
config: utils/kind-cluster.yaml
93+
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
94+
wait: 120s
95+
- name: Check cluster info
96+
run: |
97+
kubectl cluster-info dump
98+
- name: Run make env-setup GATEWAYAPI_PROVIDER=${{ matrix.gatewayapi-provider }} ISTIO_INSTALL_SAIL=${{ matrix.istio-type == 'sail' && true || false }}
99+
run: |
100+
make env-setup GATEWAYAPI_PROVIDER=${{ matrix.gatewayapi-provider }} ISTIO_INSTALL_SAIL=${{ matrix.istio-type == 'sail' && true || false }}
101+
- name: Run integration tests
102+
run: |
103+
make test-integration GATEWAYAPI_PROVIDER=${{ matrix.gatewayapi-provider }}
104+
- name: Upload integration-test coverage reports to CodeCov
105+
# more at https://github.com/codecov/codecov-action
106+
# Only run if the feature branch is in your repo (not in a fork)
107+
# as Tokenless uploading is rate limited for public repos
108+
if: github.event.pull_request.head.repo.full_name == github.repository
109+
uses: codecov/codecov-action@v4
110+
with:
111+
token: ${{ secrets.CODECOV_TOKEN }}
112+
flags: controllers-integration
113+
fail_ci_if_error: false
114+
verbose: true
115+
- name: Check kuadrant status
116+
if: always()
117+
run: |
118+
kubectl get pods -n kuadrant-system
119+
120+
bare-k8s-integration-tests:
121+
name: Integration Tests for kuadrant-operator/tests/bare_k8s
122+
if: needs.pre-job.outputs.should_skip != 'true'
123+
needs: pre-job
124+
runs-on: ubuntu-latest
125+
env:
126+
KIND_CLUSTER_NAME: kuadrant-test
127+
KUADRANT_NAMESPACE: kuadrant-system
128+
defaults:
129+
run:
130+
shell: bash
131+
steps:
132+
- name: Set up Go 1.22.x
133+
uses: actions/setup-go@v4
134+
with:
135+
go-version: 1.22.x
136+
id: go
137+
- name: Check out code
138+
uses: actions/checkout@v4
139+
- name: Create k8s Kind Cluster
140+
uses: helm/[email protected]
141+
with:
142+
version: v0.23.0
143+
config: utils/kind-cluster.yaml
144+
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
145+
wait: 120s
146+
- name: Check cluster info
147+
run: |
148+
kubectl cluster-info dump
149+
- name: Run make k8s-env-setup
150+
run: |
151+
make k8s-env-setup
152+
- name: Run integration tests
153+
run: |
154+
make test-bare-k8s-integration
155+
- name: Upload integration-test coverage reports to CodeCov
156+
# more at https://github.com/codecov/codecov-action
157+
# Only run if the feature branch is in your repo (not in a fork)
158+
# as Tokenless uploading is rate limited for public repos
159+
if: github.event.pull_request.head.repo.full_name == github.repository
160+
uses: codecov/codecov-action@v4
161+
with:
162+
token: ${{ secrets.CODECOV_TOKEN }}
163+
flags: bare-k8s-integration
164+
fail_ci_if_error: false
165+
verbose: true
166+
167+
gatewayapi-integration-tests:
168+
name: Integration Tests for kuadrant-operator/tests/gatewayapi
169+
if: needs.pre-job.outputs.should_skip != 'true'
170+
needs: pre-job
171+
runs-on: ubuntu-latest
172+
env:
173+
KIND_CLUSTER_NAME: kuadrant-test
174+
KUADRANT_NAMESPACE: kuadrant-system
175+
defaults:
176+
run:
177+
shell: bash
178+
steps:
179+
- name: Set up Go 1.22.x
180+
uses: actions/setup-go@v4
181+
with:
182+
go-version: 1.22.x
183+
id: go
184+
- name: Check out code
185+
uses: actions/checkout@v4
186+
- name: Create k8s Kind Cluster
187+
uses: helm/[email protected]
188+
with:
189+
version: v0.23.0
190+
config: utils/kind-cluster.yaml
191+
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
192+
wait: 120s
193+
- name: Check cluster info
194+
run: |
195+
kubectl cluster-info dump
196+
- name: Run make gatewayapi-env-setup
197+
run: |
198+
make gatewayapi-env-setup
199+
- name: Run integration tests
200+
run: |
201+
make test-gatewayapi-env-integration
202+
- name: Upload integration-test coverage reports to CodeCov
203+
# more at https://github.com/codecov/codecov-action
204+
# Only run if the feature branch is in your repo (not in a fork)
205+
# as Tokenless uploading is rate limited for public repos
206+
if: github.event.pull_request.head.repo.full_name == github.repository
207+
uses: codecov/codecov-action@v4
208+
with:
209+
token: ${{ secrets.CODECOV_TOKEN }}
210+
flags: gatewayapi-integration
211+
fail_ci_if_error: false
212+
verbose: true
213+
214+
gatewayapi-provider-integration-tests:
215+
name: Integration Tests for kuadrant-operator/tests/[gatewayapi-provider]
216+
if: needs.pre-job.outputs.should_skip != 'true'
217+
needs: pre-job
218+
strategy:
219+
matrix:
220+
include:
221+
- gatewayapi-provider: istio
222+
istio-type: istioctl
223+
- gatewayapi-provider: istio
224+
istio-type: sail
225+
- gatewayapi-provider: envoygateway
226+
fail-fast: false
227+
runs-on: ubuntu-latest
228+
env:
229+
KIND_CLUSTER_NAME: kuadrant-test
230+
KUADRANT_NAMESPACE: kuadrant-system
231+
defaults:
232+
run:
233+
shell: bash
234+
steps:
235+
- name: Set up Go 1.22.x
236+
uses: actions/setup-go@v4
237+
with:
238+
go-version: 1.22.x
239+
id: go
240+
- name: Check out code
241+
uses: actions/checkout@v4
242+
- name: Create k8s Kind Cluster
243+
uses: helm/[email protected]
244+
with:
245+
version: v0.23.0
246+
config: utils/kind-cluster.yaml
247+
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
248+
wait: 120s
249+
- name: Check cluster info
250+
run: |
251+
kubectl cluster-info dump
252+
- name: Run make ${{ matrix.gatewayapi-provider }}-env-setup ISTIO_INSTALL_SAIL=${{ matrix.istio-type == 'sail' && true || false }}
253+
run: |
254+
make ${{ matrix.gatewayapi-provider }}-env-setup ISTIO_INSTALL_SAIL=${{ matrix.istio-type == 'sail' && true || false }}
255+
- name: Run integration tests
256+
run: |
257+
make test-${{ matrix.gatewayapi-provider }}-env-integration
258+
- name: Upload integration-test coverage reports to CodeCov
259+
# more at https://github.com/codecov/codecov-action
260+
# Only run if the feature branch is in your repo (not in a fork)
261+
# as Tokenless uploading is rate limited for public repos
262+
if: github.event.pull_request.head.repo.full_name == github.repository
263+
uses: codecov/codecov-action@v4
264+
with:
265+
token: ${{ secrets.CODECOV_TOKEN }}
266+
flags: ${{ matrix.gatewayapi-provider }}-integration
267+
fail_ci_if_error: false
268+
verbose: true
269+
- name: Check kuadrant status
270+
if: always()
271+
run: |
272+
kubectl get pods -n kuadrant-system
273+
274+
verify-release:
275+
name: Validate release data
276+
if: needs.pre-job.outputs.should_skip != 'true'
277+
needs: pre-job
278+
runs-on: ubuntu-latest
279+
steps:
280+
- name: Set up Go 1.22.x
281+
uses: actions/setup-go@v4
282+
with:
283+
go-version: 1.22.x
284+
id: go
285+
- name: Checkout code at git ref
286+
uses: actions/checkout@v4
287+
- name: Check bundles and manifests
288+
run: make verify-prepare-release
289+
290+
verify-fmt:
291+
name: Verify fmt
292+
if: needs.pre-job.outputs.should_skip != 'true'
293+
needs: pre-job
294+
runs-on: ubuntu-latest
295+
steps:
296+
- name: Set up Go 1.22.x
297+
uses: actions/setup-go@v4
298+
with:
299+
go-version: 1.22.x
300+
id: go
301+
- name: Check out code
302+
uses: actions/checkout@v4
303+
- name: Run make verify-fmt
304+
run: |
305+
make verify-fmt
306+
307+
test-scripts:
308+
name: Test Scripts
309+
if: needs.pre-job.outputs.should_skip != 'true'
310+
needs: pre-job
311+
strategy:
312+
matrix:
313+
go-version: [1.22.x]
314+
platform: [ubuntu-latest, macos-latest]
315+
runs-on: ${{ matrix.platform }}
316+
defaults:
317+
run:
318+
shell: bash
319+
steps:
320+
- name: Set up Go ${{ matrix.go-version }}
321+
uses: actions/setup-go@v4
322+
with:
323+
go-version: ${{ matrix.go-version }}
324+
id: go
325+
- name: Check out code
326+
uses: actions/checkout@v4
327+
- name: Run make operator-sdk
328+
run: |
329+
make operator-sdk
330+
331+
verify-generate:
332+
name: Verify generate
333+
if: needs.pre-job.outputs.should_skip != 'true'
334+
needs: pre-job
335+
runs-on: ubuntu-latest
336+
steps:
337+
- name: Set up Go 1.22.x
338+
uses: actions/setup-go@v4
339+
with:
340+
go-version: 1.22.x
341+
id: go
342+
- name: Check out code
343+
uses: actions/checkout@v4
344+
- name: Verify generate command
345+
run: |
346+
make verify-generate
347+
348+
verify-go-mod:
349+
name: Verify go.mod
350+
if: needs.pre-job.outputs.should_skip != 'true'
351+
needs: pre-job
352+
runs-on: ubuntu-latest
353+
steps:
354+
- name: Set up Go 1.22.x
355+
uses: actions/setup-go@v4
356+
with:
357+
go-version: 1.22.x
358+
id: go
359+
- name: Check out code
360+
uses: actions/checkout@v4
361+
- name: Verify generate command
362+
run: |
363+
make verify-go-mod
364+
365+
required-checks:
366+
name: Test Required Checks
367+
# This check adds a list of checks to one job to simplify adding settings to the repo.
368+
# If a new check is added in this file, and it should be retested on entry to the merge queue,
369+
# it needs to be added to the list below aka needs: [ existing check 1, existing check 2, new check ].
370+
needs: [ unit-tests, controllers-integration-tests, bare-k8s-integration-tests, gatewayapi-integration-tests, gatewayapi-provider-integration-tests, verify-release, verify-fmt, test-scripts, verify-generate, verify-go-mod ]
371+
if: always()
372+
runs-on: ubuntu-latest
373+
steps:
374+
- uses: actions/checkout@v4
375+
- run: echo '${{ toJSON(needs) }}' | jq -e 'all(.[]; .result == "success" or .result == "skipped")'

0 commit comments

Comments
 (0)