-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (49 loc) · 1.44 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
export PATH:=./venv/bin/:$(PATH)
SONAR_PROJETKEY=template-python # TODO Change this!
.PHONY: all
all: verify
.PHONY: verify
verify: lint test
.PHONY: pipeline
pipeline: pip-install verify
.PHONY: setup-venv
setup-venv:
python3 -m venv venv
.PHONY: pip-install
pip-install: .pip-install-timestamp
.pip-install-timestamp: requirements.txt
pip install -r requirements.txt
touch $@
.PHONY: pip-freeze
pip-freeze:
pip freeze >requirements.txt
.PHONY: test
test: .coverage
.PHONY: lint
lint: pip-install
mypy *.py
prospector -M *.py
coverage-reports/unit-test.coverage: pip-install
COVERAGE_FILE=$@ coverage run --omit "venv/*" -m unittest discover
coverage-reports/acceptance-test.coverage: pip-install
COVERAGE_FILE=$@ coverage run --omit "venv/*" -m behave
.coverage: coverage-reports/acceptance-test.coverage coverage-reports/unit-test.coverage
coverage combine coverage-reports/*.coverage
coverage report --fail-under 100.0
coverage-reports/coverage-.xml: .coverage
coverage xml -o coverage-reports/coverage-.xml
.PHONY: sonarqube
sonarqube: coverage-reports/coverage-.xml
docker run --network host --rm -v "$$(pwd):/usr/src" sonarsource/sonar-scanner-cli -Dsonar.projectKey=$(SONAR_PROJETKEY)
.PHONY: sonard
## Runs a Sonar server locally.
sonard:
docker start sonarqube || docker run -d --name sonarqube sonarqube
.PHONY: checkUpdates
checkUpdates:
pip list --outdated
.PHONY: clean
clean::
coverage erase
clean::
$(RM) -r coverage-reports