-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (102 loc) · 3.25 KB
/
Makefile
File metadata and controls
142 lines (102 loc) · 3.25 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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
SHELL:=/bin/bash -O globstar
.SHELLFLAGS = -ec
.PHONY: build dist
.DEFAULT_GOAL := list
# this is just to try and supress errors caused by poetry run
export PYTHONWARNINGS=ignore:::setuptools.command.install
list:
@grep '^[^#[:space:]].*:' Makefile
guard-%:
@ if [ "${${*}}" = "" ]; then \
echo "Environment variable $* not set"; \
exit 1; \
fi
########################################################################################################################
##
## Makefile for this project things
##
########################################################################################################################
pwd := ${PWD}
dirname := $(notdir $(patsubst %/,%,$(CURDIR)))
DOCKER_BUILDKIT ?= 1
ifneq (,$(wildcard ./.env))
include .env
export
endif
clean_dist:
rm -r dist/ || true
dist: clean_dist
pip install build
python -m build
delete-hooks:
rm .git/hooks/pre-commit 2>/dev/null || true
rm .git/hooks/commit-msg 2>/dev/null || true
.git/hooks/pre-commit:
cp scripts/hooks/pre-commit.sh .git/hooks/pre-commit
.git/hooks/commit-msg:
cp scripts/hooks/commit-msg.sh .git/hooks/commit-msg
refresh-hooks: delete-hooks .git/hooks/pre-commit .git/hooks/commit-msg
install:
poetry sync
install-ci:
poetry sync --without local
update:
poetry update
mypy:
poetry run mypy . --exclude '(^|/)(build|dist|scripts)/.*\.py'
shellcheck:
@# Only swallow checking errors (rc=1), not fatal problems (rc=2)
docker run --rm -i -v ${PWD}:/mnt:ro koalaman/shellcheck -f gcc -e SC1090,SC1091 `find . \( -path "*/.venv/*" -prune -o -path "*/build/*" -prune -o -path "*/.tox/*" -prune -o -path "*/java_client/*" -prune \) -o -type f -name '*.sh' -print` || test $$? -eq 1
ruff: black
poetry run ruff check --fix --show-fixes .
ruff-check:
poetry run ruff check .
ruff-ci:
poetry run ruff check --output-format=github .
lint: ruff mypy shellcheck
clean: down
rm -rf ./dist || true
rm -rf ./tox || true
rm -rf ./Mesh_Client.egg-info || true
rm -rf ./.venv || true
rm -rf ./reports || true
rm -f .docker.env || true
find . -type d -name '.mypy_cache' | xargs rm -rf || true
find . -type d -name '.pytest_cache' | xargs rm -rf || true
find . -type d -name '__pycache__' | xargs rm -rf || true
find . -type f -name '.coverage' | xargs rm -rf || true
find tests -type f -name '*.pem' | xargs rm -rf || true
purge: clean
rm -rf .venv || true
black-check:
poetry run black . --check
black:
poetry run black .
coverage-cleanup:
rm -f .coverage* || true
coverage-ci-test:
poetry run coverage run -m pytest --color=yes -v --junit-xml=./reports/junit/tests.xml
coverage-report:
@poetry run coverage report; \
poetry run coverage xml;
coverage: coverage-cleanup coverage-test coverage-report
coverage-test:
poetry run coverage run -m pytest
pytest:
poetry run python -m pytest
test: pytest
tox:
poetry run tox
down:
docker compose down --remove-orphans || true
up: create-test-certs-keys
docker compose up -d --remove-orphans --build
coverage-ci: coverage-cleanup coverage-ci-test coverage-report
check-secrets:
scripts/check-secrets.sh
check-secrets-all:
scripts/check-secrets.sh unstaged
export-requirements:
poetry export --only main -f requirements.txt --output ./requirements.txt
create-test-certs-keys:
./scripts/create-test-certs-keys.sh