Skip to content

Commit d451fbe

Browse files
committed
update github workflows for CRD migration
This commit updates the github workflows to integrate the migrated CRDs. Additionally, the makefile was updated as appropriate. Assisted-by: claude-4-sonnet Ref: EC-1316 Signed-off-by: Rob Nester <[email protected]>
1 parent 0854e44 commit d451fbe

File tree

4 files changed

+154
-4
lines changed

4 files changed

+154
-4
lines changed

.github/workflows/checks-codecov.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ jobs:
6969
- name: Generate
7070
run: make generate
7171

72+
- name: Generate CRD manifests
73+
run: make crd-generate
74+
7275
# Possibly useful for debugging if the next step produces an error
7376
- name: Show diff after `make generate`
7477
run: git diff --stat --patch
@@ -85,6 +88,9 @@ jobs:
8588
- name: Test
8689
run: make test
8790

91+
- name: Test CRDs
92+
run: make crd-test
93+
8894
- name: Upload unit test coverage report
8995
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
9096
env:
@@ -109,6 +115,30 @@ jobs:
109115
files: ./coverage-integration.out
110116
flags: integration
111117

118+
- name: Upload CRD test coverage report
119+
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
120+
env:
121+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
122+
with:
123+
files: ./crd_cover.out
124+
flags: crd
125+
126+
- name: Upload CRD API test coverage report
127+
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
128+
env:
129+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
130+
with:
131+
files: ./api_cover.out
132+
flags: crd-api
133+
134+
- name: Upload CRD schema test coverage report
135+
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
136+
env:
137+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
138+
with:
139+
files: ./schema_cover.out
140+
flags: crd-schema
141+
112142
Acceptance:
113143
runs-on: ubuntu-latest
114144
steps:

.github/workflows/crd-schema.yaml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Copyright The Conforma Contributors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
17+
---
18+
name: CRD Validation
19+
20+
"on":
21+
pull_request:
22+
paths:
23+
- "api/v1alpha1/**"
24+
- "schema/**"
25+
- "config/crd/**"
26+
- "tools/crd/**"
27+
- ".github/workflows/crd-schema.yaml"
28+
push:
29+
branches:
30+
- main
31+
paths:
32+
- "api/v1alpha1/**"
33+
- "schema/**"
34+
- "config/crd/**"
35+
- "tools/crd/**"
36+
- ".github/workflows/crd-schema.yaml"
37+
workflow_dispatch:
38+
39+
permissions:
40+
contents: read
41+
42+
defaults:
43+
run:
44+
shell: bash
45+
46+
jobs:
47+
crd-validation:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Harden Runner
51+
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
52+
with:
53+
egress-policy: audit
54+
disable-telemetry: true
55+
56+
- name: Checkout
57+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
58+
59+
- name: Setup Go environment
60+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
61+
with:
62+
cache: true
63+
go-version-file: go.mod
64+
65+
- name: Download CRD dependencies
66+
run: |
67+
(cd tools/crd && go mod download)
68+
(cd api && go mod download)
69+
(cd schema && go mod download)
70+
71+
- name: Generate CRD manifests
72+
run: make crd-generate
73+
74+
- name: Test CRDs
75+
run: make crd-test
76+
77+
- name: Generate CRD documentation
78+
run: make crd-docs
79+
80+
- name: Export CRD Schema
81+
run: make crd-export-schema
82+
83+
- name: Check for uncommitted changes
84+
run: |
85+
if ! git diff --exit-code -s; then
86+
for f in $(git diff --exit-code --name-only); do
87+
echo "::error file=$f,line=1,col=1,endColumn=1::CRD file was modified during build"
88+
echo -e "\033[1;33mHint:\033[0m Maybe you need to run \033[1;32mmake crd-generate\033[0m or \033[1;32mmake crd-docs\033[0m"
89+
done
90+
exit 1
91+
fi
92+
93+
- name: Upload generated artifacts
94+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
95+
with:
96+
name: crd-artifacts
97+
path: |
98+
config/crd/bases/
99+
docs/modules/ROOT/pages/crd-reference.adoc
100+
dist/

.github/workflows/release.yaml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,23 @@ jobs:
105105
run: |
106106
go mod download
107107
(cd tools && go mod download)
108+
(cd tools/crd && go mod download)
108109
(cd acceptance && go mod download)
110+
(cd api && go mod download)
111+
(cd schema && go mod download)
109112
110113
- name: Build distribution
111114
run: make dist
112115

116+
- name: Export CRD schema
117+
run: make crd-export-schema
118+
119+
- name: Upload CRD schema artifact
120+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
121+
with:
122+
name: crd-schema
123+
path: dist/
124+
113125
- name: Set up QEMU
114126
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
115127

@@ -167,15 +179,22 @@ jobs:
167179
GH_TOKEN: ${{ github.token }}
168180
run: hack/stats.sh
169181

170-
- name: Configure statistics pages
182+
- name: Prepare pages content
183+
run: |
184+
mkdir -p pages
185+
cp -r stats/* pages/
186+
mkdir -p pages/schema
187+
cp dist/* pages/schema/
188+
189+
- name: Configure pages
171190
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
172191

173-
- name: Upload statistics
192+
- name: Upload pages artifact
174193
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
175194
with:
176-
path: stats
195+
path: pages
177196

178-
- name: Deploy statistics
197+
- name: Deploy to GitHub Pages
179198
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
180199

181200
- name: Delete snapshot release and tag

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ crd-docs: $(wildcard $(CRD_DEF)/*.go) ## Generate CRD documentation
414414
crd-test: crd-manifests crd-generate ## Run CRD tests.
415415
KUBEBUILDER_ASSETS="$$($(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile crd_cover.out
416416
cd api && go test ./... -coverprofile ../api_cover.out
417+
cd ../schema && go test ./... -coverprofile ../schema_cover.out
417418

418419
.PHONY: crd-export-schema
419420
crd-export-schema: crd-generate ## Export the CRD schema to the schema directory as a json-store.org schema.

0 commit comments

Comments
 (0)