forked from insitro/redun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (63 loc) · 1.62 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
PACKAGE_NAME=redun
VENV_DIR?=.venv
VENV_ACTIVATE=$(VENV_DIR)/bin/activate
WITH_VENV=. $(VENV_ACTIVATE);
.PHONY: venv
venv: $(VENV_ACTIVATE)
$(VENV_ACTIVATE):
test -f $@ || python3 -m venv $(VENV_DIR)
$(WITH_VENV) python -m pip install --upgrade pip
$(WITH_VENV) python -m pip install -e .[postgres]
$(WITH_VENV) python -m pip install -r requirements-dev.txt -r docs/requirements.txt
.PHONY: setup
setup: venv
$(WITH_VENV) pre-commit install
.PHONY: test
test: venv
$(WITH_VENV) tox
make test-postgres
.PHONY: test-postgres
test-postgres: venv
bin/test_postgres.sh
.PHONY: lint
lint: venv
$(WITH_VENV) pre-commit run --all-files
.PHONY: format
format: venv
$(WITH_VENV) pre-commit run isort --all-files
$(WITH_VENV) pre-commit run black --all-files
# Migrate example database to latest version.
.PHONY: upgrade
upgrade:
$(WITH_VENV) alembic -c redun/backends/db/alembic.ini upgrade head
# Autogenerate a new migration
.PHONY: revision
revision:
$(WITH_VENV) alembic -c redun/backends/db/alembic.ini revision --autogenerate -m "$(MESSAGE)"
.PHONY: build
build: setup
.venv/bin/python setup.py sdist
.PHONY: test-build
test-build:
python3 -m venv build/venv
build/venv/bin/pip install dist/redun-$(shell python3 setup.py --version).tar.gz
bin/test_build.sh
.PHONY: publish
publish: lint test build
bin/publish-packages.sh
.PHONY: docs
docs: venv
$(WITH_VENV) cd docs; make clean api html
.PHONY: docs
pub-docs:
bin/publish-docs.sh
.PHONY: clean
clean:
rm -rf build
rm -rf dist
rm -rf *.egg*/
find $(PACKAGE_NAME) -type f -name '*.pyc' -delete
.PHONY: teardown
teardown:
rm -rf $(VENV_DIR)/
rm -rf .tox/