Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (53 loc) · 2.35 KB
/
Copy pathMakefile
File metadata and controls
70 lines (53 loc) · 2.35 KB
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
.PHONY: help .check-pypi-envs .install-poetry update install docs lint unit-tests tests build deploy
.DEFAULT_GOAL := help
export PATH := ${HOME}/.local/bin:$(PATH)
IS_POETRY := $(shell command -v poetry 2>/dev/null)
CURRENT_VERSION := $(shell poetry version -s)
help:
@echo "Please use 'make <target>', where <target> is one of"
@echo ""
@echo " build builds the project .whl with poetry"
@echo " deploy deploys the project using poetry (not recommended, only use if really needed)"
@echo " help outputs this helper"
@echo " install installs the dependencies in the env"
@echo " release version=<sem. version> bumps the project version to <sem. version>, using poetry;"
@echo " Updates also docs/source/conf.py version;"
@echo " If no version is provided, poetry outputs the current project version"
@echo " lint run the linting checks (black, isort, flake8)"
@echo " unit-tests run the test suite"
@echo " tests run all the tests and linting"
@echo " update updates the dependencies in poetry.lock"
@echo ""
@echo "Check the Makefile to know exactly what each target is doing."
.install-poetry:
ifdef IS_POETRY
@:
else
ifndef VIRTUAL_ENV
$(error Please activate a virtual environment or install poetry globally with your preferred tool)
endif
@pip install poetry
endif
update: .install-poetry
poetry update
install: .install-poetry
poetry install
docs: .install-poetry
poetry run sphinx-build -b html docs/source docs/build
format: .install-poetry
poetry run isort ocpp tests && poetry run black ocpp tests
lint: .install-poetry
poetry run black --check --diff ocpp tests
poetry run isort --check-only ocpp tests
poetry run flake8 ocpp tests
unit-tests: .install-poetry
poetry run py.test -vvv --cov=ocpp --cov-report=term-missing tests/
tests: lint unit-tests
build: .install-poetry
poetry build
release: .install-poetry
@echo "Please remember to update the CHANGELOG.md, before tagging the release"
@sed -i ".bkp" "s/release = '${CURRENT_VERSION}'/release = '${version}'/g" docs/source/conf.py
@poetry version ${version}
deploy: update tests
poetry publish --build