forked from argoproj-labs/hera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
95 lines (79 loc) · 2.93 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
OPENAPI_SPEC_URL="https://raw.githubusercontent.com/argoproj/argo-workflows/v3.4.4/api/openapi-spec/swagger.json"
.PHONY: help
help: ## Showcase the help instructions for all the available `make` commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: ci
ci: ## Run all the CI checks
ci: CI=1
ci: lint test check-codegen
.PHONY: codegen
codegen: ## Generate all the code
codegen: models services examples init-files
.PHONY: check-codegen
check-codegen: ## Check if the code is up to date
check-codegen: codegen
git diff --exit-code || "Code is not up-to-date. Please run 'make codegen'"
.PHONY: format
format: ## Format and sort imports for source, tests, examples, etc.
@poetry run black .
@poetry run ruff . --fix
.PHONY: lint
lint: ## Run a `lint` process on Hera and report problems
@poetry run black . --check
@poetry run ruff .
@poetry run mypy -p hera
.PHONY: test
test: ## Run tests for Hera
@poetry run python -m pytest -v
.PHONY: workflows-models
workflows-models: ## Generate the Workflows models portion of Argo Workflows
@poetry run datamodel-codegen \
--url $(OPENAPI_SPEC_URL) \
--snake-case-field \
--target-python-version 3.7 \
--output src/hera/workflows/models \
--base-class hera.shared._base_model.BaseModel \
--wrap-string-literal \
--disable-appending-item-suffix \
--disable-timestamp
@poetry run python scripts/models.py $(OPENAPI_SPEC_URL) workflows
@$(MAKE) format
.PHONY: events-models
events-models: ## Generate the Events models portion of Argo Workflows
@poetry run datamodel-codegen \
--url $(OPENAPI_SPEC_URL) \
--snake-case-field \
--target-python-version 3.7 \
--output src/hera/events/models \
--base-class hera.shared._base_model.BaseModel \
--wrap-string-literal \
--disable-appending-item-suffix \
--disable-timestamp
@poetry run python scripts/models.py $(OPENAPI_SPEC_URL) events
@$(MAKE) format
.PHONY: models
models: ## Generate all the Argo Workflows models
models: workflows-models events-models
.PHONY: workflows-service
workflows-service: ## Generate the Workflows service option of Hera
@poetry run python scripts/service.py $(OPENAPI_SPEC_URL) workflows
$(MAKE) format
.PHONY: events-service
events-service: ## Generate the events service option of Hera
@poetry run python scripts/service.py $(OPENAPI_SPEC_URL) events
$(MAKE) format
.PHONY: services
services: ## Generate the services of Hera
services: workflows-service events-service
.PHONY: init-files
init-files: ## Generate the init-files of Hera
init-files:
@poetry run python scripts/init_files.py
$(MAKE) format
.PHONY: examples
examples: ## Generate all the examples
@(cd docs && poetry run python generate.py)
.PHONY: regenerate-test-data
regenerate-test-data: ## Regenerates the test data from upstream examples and runs tests
find examples -name "*.yaml" -type f -delete
HERA_REGENERATE=1 make test examples