-
Notifications
You must be signed in to change notification settings - Fork 73
/
Makefile
87 lines (68 loc) · 2.42 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
install:
pip install --upgrade pip && \
pip install -e . --no-build-isolation
setup-ci:
pip install pre-commit && \
pre-commit install
black:
pre-commit run black -a
interrogate:
# pre-commit run interrogate -a
echo "Interrogate CI stage not currently implemented"
lint:
# pre-commit run markdownlint -a
echo "Lint CI stage not currently implemented"
license:
pre-commit run license -a
doctest:
# coverage run \
# --rcfile='test/coverage.docstring.rc' \
# -m pytest \
# --doctest-modules modulus/ --ignore-glob=*internal*
echo "Doctest CI stage not currently implemented"
pytest:
coverage run \
--rcfile='test/coverage.pytest.rc' \
-m pytest test/
coverage:
coverage combine && \
coverage report --show-missing --omit=*test* --omit=*internal* --fail-under=50 && \
coverage html
# ============================================================================ #
# CLEAN COMMANDS
# ============================================================================ #
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage*
rm -fr htmlcov/
rm -fr .pytest_cache
# For arch naming conventions, refer
# https://docs.docker.com/build/building/multi-platform/
# https://github.com/containerd/containerd/blob/v1.4.3/platforms/platforms.go#L86
ARCH := $(shell uname -p)
ifeq ($(ARCH), x86_64)
TARGETPLATFORM := "linux/amd64"
else ifeq ($(ARCH), aarch64)
TARGETPLATFORM := "linux/arm64"
else
$(error Unknown CPU architecture ${ARCH} detected)
endif
MODULUS_SYM_GIT_HASH = $(shell git rev-parse --short HEAD)
container-deploy:
docker build -t modulus-sym:deploy --build-arg TARGETPLATFORM=${TARGETPLATFORM} --build-arg MODULUS_SYM_GIT_HASH=${MODULUS_SYM_GIT_HASH} --target deploy -f Dockerfile .
container-ci:
docker build -t modulus-sym:ci --build-arg TARGETPLATFORM=${TARGETPLATFORM} --target ci -f Dockerfile .
container-docs:
docker build -t modulus-sym:docs --build-arg TARGETPLATFORM=${TARGETPLATFORM} --target docs -f Dockerfile .