Skip to content

Commit

Permalink
[chore][backend] Add workflow to validate affected generated files (#…
Browse files Browse the repository at this point in the history
…11539)

Check if there is a difference in generated files



fix lint



fix make file

Signed-off-by: chahatsagarmain <[email protected]>
  • Loading branch information
chahatsagarmain authored Feb 12, 2025
1 parent a1f3262 commit 22c3724
Show file tree
Hide file tree
Showing 3 changed files with 577 additions and 507 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/validate-generated-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Validate Generated Files
on:
pull_request:
paths:
- 'backend/api/**/*.proto'
- '.github/workflows/validate-generated-files.yml'
- 'backend/api/**/go_http_client/**'
- 'backend/api/**/go_client/**'
- 'backend/api/**/python_http_client/**'
- 'backend/api/**/swagger/**'

jobs:
validate-generated-files:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Dependencies
run: |
sudo apt-get update && sudo apt-get install -y protobuf-compiler jq default-jdk
python3 -m pip install setuptools wheel
- name: Generate API proto files
working-directory: ./api
run: make clean all

- name: Generate kfp-kubernetes proto files from source
working-directory: ./kubernetes_platform
run: make clean all

- name: Check for Changes
run: make check-diff

13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Check diff for generated files
.PHONY: check-diff
check-diff:
/bin/bash -c 'if [[ -n "$$(git status --porcelain)" ]]; then \
echo "ERROR: Generated files are out of date"; \
echo "Please regenerate using make clean all for api and kubernetes_platform"; \
echo "Changes found in the following files:"; \
git status; \
echo "Diff of changes:"; \
git diff; \
exit 1; \
fi'
Loading

0 comments on commit 22c3724

Please sign in to comment.