Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore][backend] Add workflow to validate affected generated files #11539

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/check-generated-diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Validate Generated Files
on:
pull_request:
paths:
- 'backend/api/**/*.proto'
- '.github/workflows/check-generated-diff.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:
matrix:
api_version: ['v1beta1', 'v2beta1']
fail-fast: false

steps:
- uses: actions/checkout@v4

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

- name: Install Dependencies
run: |
# Go dependencies
apt-get update && apt-get install -y protobuf-compiler jq default-jdk python3 python3-pip curl
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@latest
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@latest
go install github.com/golang/protobuf/protoc-gen-go@latest
go install github.com/go-swagger/go-swagger/cmd/swagger@latest

# Python dependencies
python3 -m pip install setuptools wheel

- name: Generate Proto Files
run: |
export API_VERSION=${{ matrix.api_version }}
export PROTOCCOMPILER=protoc
export TMP_OUTPUT=/tmp
./backend/api/hack/generator.sh

- name: Generate Python Package
run: |
export API_VERSION=${{ matrix.api_version }}
./backend/api/build_kfp_server_api_python_package.sh

- name: Check for Changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "ERROR: Generated files are out of date for API version ${{ matrix.api_version }}."
echo "Please regenerate using both generate_api.sh and build_kfp_server_api_python_package.sh"
echo "Changes found in the following files:"
git status
echo "Diff of changes:"
git diff
exit 1
fi
Loading