-
Notifications
You must be signed in to change notification settings - Fork 137
/
Makefile
108 lines (87 loc) · 2.17 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
96
97
98
99
100
101
102
103
104
105
106
107
108
#
# Makefile for more convenient building of the Linode CLI and its baked content
#
# Test-related arguments
MODULE :=
TEST_CASE_COMMAND :=
TEST_ARGS :=
ifdef TEST_CASE
TEST_CASE_COMMAND = -k $(TEST_CASE)
endif
SPEC_VERSION ?= latest
ifndef SPEC
override SPEC = $(shell ./resolve_spec_url ${SPEC_VERSION})
endif
# Version-related variables
VERSION_FILE := ./linodecli/version.py
VERSION_MODULE_DOCSTRING ?= \"\"\"\nThe version of the Linode CLI.\n\"\"\"\n\n
LINODE_CLI_VERSION ?= "0.0.0.dev"
.PHONY: install
install: check-prerequisites requirements build
pip3 install --force dist/*.whl
.PHONY: bake
bake: clean
ifeq ($(SKIP_BAKE), 1)
@echo Skipping bake stage
else
python3 -m linodecli bake ${SPEC} --skip-config
cp data-3 linodecli/
endif
.PHONY: create-version
create-version:
@printf "${VERSION_MODULE_DOCSTRING}__version__ = \"${LINODE_CLI_VERSION}\"\n" > $(VERSION_FILE)
.PHONY: build
build: clean create-version bake
python3 -m build --wheel --sdist
.PHONY: requirements
requirements:
pip3 install --upgrade .[dev,obj]
.PHONY: lint
lint: build
pylint linodecli
isort --check-only linodecli tests
autoflake --check linodecli tests
black --check --verbose linodecli tests
twine check dist/*
.PHONY: check-prerequisites
check-prerequisites:
@ pip3 -v >/dev/null
@ python3 -V >/dev/null
.PHONY: clean
clean:
rm -f linodecli/data-*
rm -f linode-cli.sh baked_version
rm -f data-*
rm -rf dist linode_cli.egg-info build
.PHONY: testunit
testunit:
@mkdir -p /tmp/linode/.config
@orig_xdg_config_home=$${XDG_CONFIG_HOME:-}; \
export LINODE_CLI_TEST_MODE=1 XDG_CONFIG_HOME=/tmp/linode/.config; \
pytest -v tests/unit; \
exit_code=$$?; \
export XDG_CONFIG_HOME=$$orig_xdg_config_home; \
exit $$exit_code
.PHONY: testint
testint:
pytest tests/integration/${MODULE} ${TEST_CASE_COMMAND} ${TEST_ARGS}
.PHONY: testall
testall:
pytest tests
# Alias for unit; integration tests should be explicit
.PHONY: test
test: testunit
.PHONY: black
black:
black linodecli tests
.PHONY: isort
isort:
isort linodecli tests
.PHONY: autoflake
autoflake:
autoflake linodecli tests
.PHONY: format
format: black isort autoflake
@PHONEY: smoketest
smoketest:
pytest -m smoke tests/integration