-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
79 lines (64 loc) · 2.04 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
# Convenience makefile to build the dev env and run common commands
# Based on https://github.com/teamniteo/Makefile
.EXPORT_ALL_VARIABLES:
PIPENV_VENV_IN_PROJECT = 1
PIPENV_IGNORE_VIRTUALENVS=1
.PHONY: all
all: .installed
.PHONY: install
install:
@rm -f .installed # force re-install
@make .installed
.installed: Pipfile Pipfile.lock
@echo "Pipfile(.lock) is newer than .installed, (re)installing"
@pipenv install --dev
@pipenv run pre-commit install -f --hook-type pre-commit
@pipenv run pre-commit install -f --hook-type pre-push
@echo "This file is used by 'make' for keeping track of last install time. If Pipfile or Pipfile.lock are newer then this file (.installed) then all 'make *' commands that depend on '.installed' know they need to run pipenv install first." \
> .installed
# Testing and linting targets
.PHONY: lint
lint: .installed
@pipenv run pre-commit run --all-files --hook-stage push
.PHONY: type
type: types
.PHONY: types
types: .installed
@pipenv run mypy pyramid_mixpanel
@cat ./typecov/linecount.txt
@pipenv run typecov 100 ./typecov/linecount.txt
.PHONY: sort
sort: .installed
@pipenv run isort --atomic pyramid_mixpanel
@pipenv run isort --atomic setup.py
.PHONY: fmt
fmt: format
.PHONY: black
black: format
.PHONY: format
format: .installed sort
@pipenv run black pyramid_mixpanel
@pipenv run black setup.py
# anything, in regex-speak
filter = "."
# additional arguments for pytest
args = ""
pytest_args = -k $(filter) $(args)
coverage_args = ""
ifeq ($(filter),".")
coverage_args = --junitxml junit.xml --cov=pyramid_mixpanel --cov-branch --cov-report html --cov-report xml:cov.xml --cov-report term-missing --cov-fail-under=100
endif
.PHONY: unit
unit: .installed
@pipenv run pytest pyramid_mixpanel/ $(coverage_args) $(pytest_args)
.PHONY: test
test: tests
.PHONY: tests
tests: format lint types unit
.PHONY: clean
clean:
@if [ -d ".venv/" ]; then pipenv --rm; fi
@rm -rf .coverage htmlcov/ pyramid_mixpanel.egg-info xunit.xml \
htmltypecov typecov \
.git/hooks/pre-commit .git/hooks/pre-push
@rm -f .installed