-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
78 lines (60 loc) · 2.17 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
INSTALL_STAMP := .install.stamp
TEST_STAMP := .test.stamp
REPORTS := docs/reports
DOCKER_STAMP := .docker_stamp
DOCKER_CONTEXT := docker/.docker-context
VERSION := $(shell poetry run flatehr --version)
.PHONY: install
install: $(INSTALL_STAMP)
$(INSTALL_STAMP): poetry.lock
poetry install
touch $(INSTALL_STAMP)
.PHONY: test
test: $(TEST_STAMP)
$(TEST_STAMP): $(INSTALL_STAMP) tests flatehr
poetry run pytest --junitxml=$(REPORTS)/junit/junit.xml tests
poetry run tests/test_cli.sh
touch $(TEST_STAMP)
.PHONY: badges
badges: $(REPORTS)/tests-badge.svg $(REPORTS)/coverage-badge.svg $(REPORTS)/flake8-badge.svg
$(REPORTS)/tests-badge.svg: $(TEST_STAMP)
genbadge tests -i $(REPORTS)/junit/junit.xml -o $(REPORTS)/tests-badge.svg
$(REPORTS)/coverage-badge.svg: $(TEST_STAMP) $(REPORTS)/coverage/coverage.xml
genbadge coverage -i $(REPORTS)/coverage/coverage.xml -o $(REPORTS)/coverage-badge.svg
$(REPORTS)/flake8-badge.svg: $(TEST_STAMP) docs/reports/flake8stats.txt
genbadge flake8 -i docs/reports/flake8stats.txt -o $(REPORTS)/flake8-badge.svg
.PHONY: clean
clean:
rm -rf $(INSTALL_STAMP)
rm -rf $(TEST_STAMP)
rm -rf $(REPORTS)
rm -rf $(DOCKER_STAMP)
rm -rf $(DOCKER_CONTEXT)
.PHONY: coverage
coverage: $(REPORTS)/coverage.xml
$(REPORTS)/coverage/coverage.xml:
coverage run --source=flatehr/ -m pytest
coverage report
coverage xml -o $(REPORTS)/coverage/coverage.xml
docs/reports/flake8stats.txt:
flake8 flatehr/ --exit-zero --statistics --tee --output-file $(REPORTS)/flake8stats.txt
$(DOCKER_STAMP): flatehr poetry.lock docker/Dockerfile
mkdir -p $(DOCKER_CONTEXT)
cp -r flatehr docker/.docker-context
cp poetry.lock docker/.docker-context
cp pyproject.toml docker/.docker-context
cp README.md docker/.docker-context
docker build -f docker/Dockerfile docker/.docker-context -t flatehr:$(VERSION)
docker tag flatehr:$(VERSION) flatehr
touch $(DOCKER_STAMP)
.PHONY: docker
docker: $(DOCKER_STAMP)
.PHONY: docker-test tests/test_docker.sh
docker-test: docker
tests/test_docker.sh
.PHONY: docker-push
docker-push: docker-test
docker tag flatehr:$(VERSION) crs4/flatehr:$(VERSION)
docker tag flatehr crs4/flatehr
docker push crs4/flatehr:$(VERSION)
docker push crs4/flatehr