-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
107 lines (83 loc) · 2.79 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
project-packages=easy_sdm
project-name=easy_sdm
project-minimum-coverage=65.0
time-stamp=$(shell date"+%Y-%m-%d-%H%M%S")
WORKSPACE_TMP=reports
DOCKER_IMAGE_NAME=${project-name}
DOCKERFILE=dockerfile
ENVIRON=production
.DEFAULT_GOAL = help
.PHONY = help
help:
@echo "available commands"
@echo " - install : installs all requirements"
@echo " - dev : installs all development requirements"
@echo " - test-code : run all unit tests"
@echo " - clean : cleans up all folders"
@echo " - flake : runs flake8 style checks"
@echo "Other functionalities check Makefile targets"
install:
poetry install --no-dev
install-full:
poetry install
dev: install-full
poetry run pre-commit install
s2i-mac-install:
brew install source-to-image
.PHONY = test-code
test-code:
pytest --disable-pytest-warnings --junit-xml ${WORKSPACE_TMP}/unit_tests.xml
.PHONY = hadolint
hadolint:
docker run --rm -i hadolint/hadolint < ${DOCKERFILE}
.PHONY = flake
flake:
flake8 .
.PHONY = black
black:
black ${project-packages}
.PHONY = isort
isort:
isort ${project-packages}
.PHONY = code-complexity
code-complexity:
radon mi --sort --json --output-file ${WORKSPACE_TMP}/mi_report.json .
radon cc --json --total-average --output-file ${WORKSPACE_TMP}/cc_report.json .
xenon --max-absolute B --max-modules B --max-average A .
.PHONY = codefresh-test
codefresh-test:
pytest --disable-pytest-warnings --cov-report=xml:coverage.xml --cov=${project-packages} --cov-fail-under=${project-minimum-coverage}
.PHONY = test-coverage
test-coverage:
poetry run pytest --disable-pytest-warnings --cov-report=xml:coverage.xml --cov-report html:cov_html --cov=${project-packages} --cov-fail-under=${project-minimum-coverage}
.PHONY = clean
clean:
rm -rf coverage .coverage*
find . -name '__pycache__' -exec rm -rf {} +
find . -name '.pytest_cache' -exec rm -rf {} +
find . -name '.project' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*.pyc' -exec rm -f {} +
rm -rf dist
coverage: ${WORKSPACE_TMP} test-coverage
static-analysis: ${WORKSPACE_TMP} code-complexity flake
patch:
poetry run bumpver update --patch --commit-message "[patch-version] {old_version} -> {new_version}"
minor:
poetry run bumpver update --minor --commit-message "[minor-version] {old_version} -> {new_version}"
major:
poetry run bumpver update --major --commit-message "[major-version] {old_version} -> {new_version}"
cli-docs:
typer hermod.console utils docs --output README-cli.md --name hermod
#Docker
docker-build:
docker build --progress plain --build-arg ENVIRON=${ENVIRON} -f ${DOCKERFILE} -t ${DOCKER_IMAGE_NAME} .
test-builder-image:
IMAGE_NAME=${DOCKER_IMAGE_NAME} tests/s2i/run
builder-usage:
s2i usage ${DOCKER_IMAGE_NAME}
# git
commit: black
git add .
PRE_COMMIT_ALLOW_NO_CONFIG=1 git commit -m "$t" -m "$b"
git push