-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
64 lines (44 loc) · 2.33 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
# https://www.gnu.org/software/make/manual/html_node/Special-Variables.html
# https://ftp.gnu.org/old-gnu/Manuals/make-3.80/html_node/make_17.html
PROJECT_MKFILE_PATH := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
PROJECT_MKFILE_DIR := $(shell cd $(shell dirname $(PROJECT_MKFILE_PATH)); pwd)
PROJECT_NAME := openapi_client_generator
PROJECT_ROOT := $(PROJECT_MKFILE_DIR)
BUILD_DIR := $(PROJECT_ROOT)/build
DIST_DIR := $(PROJECT_ROOT)/dist
TEST_DIR := $(PROJECT_ROOT)/tests
SPECS_DIR := $(PROJECT_ROOT)/specification/examples/v3.0
CLI := openapi-client-generator
typecheck:
mypy --config-file setup.cfg --package $(PROJECT_NAME)
mypy --config-file setup.cfg $(TEST_DIR)/petstore-full/petstore_full
mypy --config-file setup.cfg $(TEST_DIR)/test_generated_client.py
test: typecheck
pytest -s --cov=openapi_client_generator $(TEST_DIR)
example-clients:
$(CLI) gen -f -s "$(TEST_DIR)/petstore-full.json" -o "$(TEST_DIR)/petstore-full" -n petstore-full
pip install -e $(TEST_DIR)/petstore-full
$(CLI) gen -f -s "$(SPECS_DIR)/api-with-examples.json" -o "$(TEST_DIR)/api-with-examples" -n api-with-examples
pip install -e $(TEST_DIR)/api-with-examples
$(CLI) gen -f -s "$(SPECS_DIR)/callback-example.json" -o "$(TEST_DIR)/callback-example" -n callback-example
pip install -e $(TEST_DIR)/callback-example
$(CLI) gen -f -s "$(SPECS_DIR)/link-example.json" -o "$(TEST_DIR)/link-example" -n link-example
pip install -e $(TEST_DIR)/link-example
$(CLI) gen -f -s "$(SPECS_DIR)/petstore.json" -o "$(TEST_DIR)/petstore" -n petstore
pip install -e $(TEST_DIR)/petstore
$(CLI) gen -f -s "$(SPECS_DIR)/petstore-expanded.json" -o "$(TEST_DIR)/petstore-expanded" -n petstore-expanded
pip install -e $(TEST_DIR)/petstore-expanded
$(CLI) gen -f -s "$(SPECS_DIR)/uspto.json" -o "$(TEST_DIR)/uspto" -n uspto
pip install -e $(TEST_DIR)/uspto
publish: example-clients test clean | do-publish
@echo "Done publishing."
do-publish:
python $(PROJECT_ROOT)/setup.py sdist bdist_wheel
twine upload $(DIST_DIR)/*
test-all: | example-clients test
@echo "Done."
clean:
rm -rf $(BUILD_DIR) $(DIST_DIR)
shell:
# pyopenssl on m1 issue https://github.com/NixOS/nixpkgs/issues/175875
NIXPKGS_ALLOW_BROKEN=1 nix-shell $(PROJECT_ROOT)/shell.nix