-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (63 loc) · 1.94 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
## Game of Life in Pythonn
##
export PATH:=./venv/bin/:$(PATH)
.PHONY: all
## all: Verifies the Game of Life program.
all: verify
.PHONY: verify
## verify: Performs all verification (lint and test).
verify: lint test
.PHONY: pipeline
## pipeline: Whatever the CI/CD Pipeline is supposed to run.
pipeline: pip-install verify
.PHONY: setup-venv
## setup-venv: Setup a virtual environment.
setup-venv:
python3 -m venv venv
.PHONY: pip-install
## pip-install: Install requirements.
pip-install: .pip-install-timestamp
.pip-install-timestamp: requirements.txt
pip install -r requirements.txt
touch $@
.PHONY: pip-freeze
## pip-freeze: Update requirements.txt.
pip-freeze:
pip freeze >requirements.txt
.PHONY: test
## test: Run tests (including coverage).
test: .coverage
.PHONY: lint
## lint: Run static code analyzers (mypy and prospector).
lint: pip-install
mypy *.py
prospector *.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=gameoflife-python
.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: Removes generated files (in this case, coverage reports).
clean::
coverage erase
clean::
$(RM) -r coverage-reports
.PHONY: help
## help: Prints this help text.
help:
@sed -n 's/^## \?//p' $(MAKEFILE_LIST)