From 8b8ce997b3fbe9d3d7e11fc758bca2171aa29e85 Mon Sep 17 00:00:00 2001 From: Radovan Zivkovic Date: Wed, 19 Jun 2024 14:27:26 +0200 Subject: [PATCH] Add target to check if gRPC code is in sync with generated python code --- .github/workflows/continuous-integration.yml | 3 +++ Makefile | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 621943452..5b0a5c1df 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -59,6 +59,9 @@ jobs: - name: Install Dependencies 📦 run: make install + - name: Listing Dependencies 📦 + run: poetry show + - name: Lint Code 🎎 run: | # If it's not a pull request, $DOCSTRING_DIFF_BRANCH is unset. diff --git a/Makefile b/Makefile index 878d2b0df..aca74196d 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,10 @@ install: poetry run python -m pip install -U pip poetry install +install-dev: + 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 {} + @@ -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 @@ -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 \ No newline at end of file