Skip to content

Commit

Permalink
Move out code generation from general flow
Browse files Browse the repository at this point in the history
  • Loading branch information
elchupanebrej committed Dec 8, 2024
1 parent 118039e commit 6b439aa
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/release-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ jobs:
- name: Show Python version
run: python --version

- name: Generate code
working-directory: ./python
run: |
make clean-real
make generate-real
- uses: cucumber/[email protected]
with:
working-directory: "python"
5 changes: 0 additions & 5 deletions .github/workflows/test-codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ jobs:
with:
ruby-version: '3.1'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: generate code for all languages
run: |
make clean-all
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Generate code
working-directory: ./python
run: |
make clean-real
make generate-real
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
10 changes: 8 additions & 2 deletions python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ 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: require install-deps
generate: ## Stub for the ancestor Makefile
echo "Skipping code generation - code is generated by Python"

generate-real: require install-deps
datamodel-codegen \
--output-model-type "pydantic_v2.BaseModel" \
--input $(HERE)../jsonschema/Envelope.json \
Expand All @@ -27,7 +30,10 @@ generate: require install-deps
require: ## Check requirements for the code generation (python is required)
@python --version >/dev/null 2>&1 || (echo "ERROR: python is required."; exit 1)

clean: ## Remove automatically generated files and related artifacts
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

install-deps: ## Install generation dependencies
Expand Down

0 comments on commit 6b439aa

Please sign in to comment.