Skip to content

Commit 22c3724

Browse files
[chore][backend] Add workflow to validate affected generated files (kubeflow#11539)
Check if there is a difference in generated files fix lint fix make file Signed-off-by: chahatsagarmain <[email protected]>
1 parent a1f3262 commit 22c3724

File tree

3 files changed

+577
-507
lines changed

3 files changed

+577
-507
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Validate Generated Files
2+
on:
3+
pull_request:
4+
paths:
5+
- 'backend/api/**/*.proto'
6+
- '.github/workflows/validate-generated-files.yml'
7+
- 'backend/api/**/go_http_client/**'
8+
- 'backend/api/**/go_client/**'
9+
- 'backend/api/**/python_http_client/**'
10+
- 'backend/api/**/swagger/**'
11+
12+
jobs:
13+
validate-generated-files:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Install Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version-file: go.mod
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: 3.9
30+
31+
- name: Install Dependencies
32+
run: |
33+
sudo apt-get update && sudo apt-get install -y protobuf-compiler jq default-jdk
34+
python3 -m pip install setuptools wheel
35+
36+
- name: Generate API proto files
37+
working-directory: ./api
38+
run: make clean all
39+
40+
- name: Generate kfp-kubernetes proto files from source
41+
working-directory: ./kubernetes_platform
42+
run: make clean all
43+
44+
- name: Check for Changes
45+
run: make check-diff
46+

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
# Check diff for generated files
3+
.PHONY: check-diff
4+
check-diff:
5+
/bin/bash -c 'if [[ -n "$$(git status --porcelain)" ]]; then \
6+
echo "ERROR: Generated files are out of date"; \
7+
echo "Please regenerate using make clean all for api and kubernetes_platform"; \
8+
echo "Changes found in the following files:"; \
9+
git status; \
10+
echo "Diff of changes:"; \
11+
git diff; \
12+
exit 1; \
13+
fi'

0 commit comments

Comments
 (0)