Skip to content

Commit

Permalink
Renew python codegeneration real test
Browse files Browse the repository at this point in the history
  • Loading branch information
elchupanebrej committed Dec 11, 2024
1 parent cdcbcbf commit 0bd3ed1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
- name: Generate code
working-directory: ./python
run: |
make clean-real
make generate-real
make clean
make generate
- uses: cucumber/action-publish-pypi@v3.0.0
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ jobs:
with:
ruby-version: '3.1'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: generate code for all languages
run: |
make clean-all
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
- name: Generate code
working-directory: ./python
run: |
make clean-real
make generate-real
make clean
make generate
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
12 changes: 3 additions & 9 deletions python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ HERE := $(dir $(MKFILE_PATH))
help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make <target>\n\nWhere <target> is one of:\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

generate: ## Stub for the ancestor Makefile
echo "Skipping code generation - code is generated by Python"

generate-real: require install-deps
generate: require install-deps
datamodel-codegen \
--output-model-type "dataclasses.dataclass" \
--base-class ".json_converter.JSONDataclassMixin" \
--input $(HERE)../jsonschema/Envelope.json \
--output $(HERE)src/cucumber_messages/messages.py \
--output $(HERE)src/cucumber_messages/_messages.py \
--input-file-type=jsonschema \
--class-name Envelope \
--target-python-version=3.9 \
Expand All @@ -34,10 +31,7 @@ require: ## Check requirements for the code generation (python is required)
@python --version >/dev/null 2>&1 || (echo "ERROR: python is required."; exit 1)

clean: ## Stub for the ancestor Makefile
echo "Skipping code cleanup - code cleanup is done by Python"

clean-real: ## Remove automatically generated files and related artifacts
rm -rf $(HERE)src/_messages.py
rm -rf $(HERE)src/cucumber_messages/_messages.py.

install-deps: ## Install generation dependencies
python -m ensurepip --upgrade
Expand Down
2 changes: 1 addition & 1 deletion python/src/cucumber_messages/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from . import json_converter
from .messages import *
from ._messages import *

# Renaming types because of confusing collision naming
HookType = Type
Expand Down
File renamed without changes.

0 comments on commit 0bd3ed1

Please sign in to comment.