-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (57 loc) · 1.76 KB
/
Makefile
File metadata and controls
69 lines (57 loc) · 1.76 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
PYTHON_FILES := tests
MAX_CONCURRENCY ?= 1
SHELL := $(shell which bash)
check-swarm-init:
@if [ "$$(docker info --format '{{.Swarm.LocalNodeState}}')" != "active" ]; then \
echo "Docker is not part of a swarm. Initializing..."; \
docker swarm init; \
else \
echo "Docker is already part of a swarm."; \
fi
.PHONY: code
code: check format lint sort bandit test
.PHONY: check
check:
poetry run mypy $(PYTHON_FILES)
.PHONY: format
format:
poetry run yapf --in-place --recursive $(PYTHON_FILES)
.PHONY: format-check
format-check:
poetry run yapf --diff --recursive $(PYTHON_FILES)
.PHONY: lint
lint:
poetry run flake8 $(PYTHON_FILES)
.PHONY: sort
sort:
poetry run isort --force-single-line-imports $(PYTHON_FILES)
.PHONY: sort-check
sort-check:
poetry run isort --force-single-line-imports $(PYTHON_FILES) --check-only
.PHONY: bandit
bandit:
poetry run bandit -r $(PYTHON_FILES) --quiet --configfile=.bandit
.PHONY: bandit-check
bandit-check:
poetry run bandit -r $(PYTHON_FILES) --configfile=.bandit
# ACTIONS_RUNNER_DEBUG is used in github actions
.PHONY: test
test:
@if [ "$(DEBUG)" = "true" ] || [ "$(CI)" = "true" ]; then \
export DEBUG=true; \
LOG_LEVEL="--log-cli-level=debug"; \
echo "Running tests with debug output"; \
else \
LOG_LEVEL=""; \
fi; \
poetry run pytest -s -o log_cli=True $$LOG_LEVEL -n ${MAX_CONCURRENCY} tests
.PHONY: coverage
coverage:
@if [ "$(DEBUG)" = "true" ] || [ "$(CI)" = "true" ]; then \
export DEBUG=true; \
LOG_LEVEL="--log-cli-level=debug"; \
echo "Running tests with debug output"; \
else \
LOG_LEVEL=""; \
fi; \
poetry run pytest -r -o log_cli=True $$LOG_LEVEL -n ${MAX_CONCURRENCY} --cov-report term-missing --cov=pantos tests