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

[ATO-1652] Add target to check if gRPC code is in sync with generated python code #1111

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ jobs:
- name: Install Dependencies 📦
run: make install

- name: Listing Dependencies 📦
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to help with debugging.

run: poetry show

- name: Lint Code 🎎
run: |
# If it's not a pull request, $DOCSTRING_DIFF_BRANCH is unset.
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ install:
poetry run python -m pip install -U pip
poetry install

install-dev:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Target to install runtime and dev dependencies.

poetry run python -m pip install -U pip
poetry install --with dev

clean:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
Expand All @@ -38,6 +42,7 @@ lint:
poetry run ruff check rasa_sdk tests --ignore D
poetry run black --exclude="rasa_sdk/grpc_py" --check rasa_sdk tests
make lint-docstrings
make check-generate-grpc-code-in-sync

# Compare against `main` if no branch was provided
BRANCH ?= main
Expand All @@ -62,10 +67,15 @@ release:
poetry run python scripts/release.py

generate-grpc:
python -m grpc_tools.protoc \
poetry run python -m grpc_tools.protoc \
-Irasa_sdk/grpc_py=./proto \
--python_out=. \
--grpc_python_out=. \
--pyi_out=. \
proto/action_webhook.proto \
proto/health.proto

check-generate-grpc-code-in-sync: generate-grpc
# this is a helper to check if the generated code is in sync with the proto files
# it's not run on CI at the moment
git diff --exit-code rasa_sdk/grpc_py | if [ "$$(wc -c)" -eq 0 ]; then echo "Generated code is in sync with proto files"; else echo "Generated code is not in sync with proto files"; exit 1; fi
Loading