Skip to content

Commit 8d8a242

Browse files
authored
Add a check for consistency of generated manifests (#738)
Signed-off-by: Jonathan West <[email protected]>
1 parent 2703166 commit 8d8a242

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/codegen.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Verify generated code is up to date
2+
on:
3+
push:
4+
branches:
5+
- '*'
6+
pull_request:
7+
branches:
8+
- '*'
9+
10+
jobs:
11+
check-go-modules:
12+
name: "Check for go.mod/go.sum synchronicity"
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
- name: Setup Golang
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version-file: 'go.mod'
21+
- name: Download all Go modules
22+
run: |
23+
go mod download
24+
- name: Check for tidyness of go.mod and go.sum
25+
run: |
26+
go mod tidy
27+
git diff --exit-code -- .
28+
29+
check-sdk-codegen:
30+
name: "Check for changes from make bundle"
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v4
35+
- name: Setup Golang
36+
uses: actions/setup-go@v5
37+
with:
38+
go-version-file: 'go.mod'
39+
- name: Run make bundle
40+
run: |
41+
make bundle
42+
43+
# We ignore '*createdAt:*' because various generated YAMLs have a 'createdAt' field that is always updated with the current time.
44+
45+
- name: Ensure there is no diff in bundle
46+
run: |
47+
git diff --ignore-matching-lines='.*createdAt:.*' --exit-code -- .
48+
49+
- name: Run make generate
50+
run: |
51+
make generate
52+
- name: Ensure there is no diff in generated assets
53+
run: |
54+
git diff --ignore-matching-lines='.*createdAt:.*' --exit-code -- .
55+
- name: Run make manifests
56+
run: |
57+
make manifests
58+
- name: Ensure there is no diff in manifests
59+
run: |
60+
git diff --ignore-matching-lines='.*createdAt:.*' --exit-code -- .

0 commit comments

Comments
 (0)