-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathMakefile
120 lines (91 loc) · 3.33 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
DC_CI = bin/dc.sh
DC = docker compose
all: help
.env:
@touch .env
.make.docker.build:
${MAKE} build
.make.docker.pull:
${MAKE} pull
build: .make.docker.pull
${DC} build --pull web
@touch .make.docker.build
pull: .env
-GIT_COMMIT= ${DC} pull db web builder
@touch .make.docker.pull
run: .make.docker.pull
${DC} up web worker
run-shell:
${DC} run --rm web bash
shell:
${DC} exec web bash
djshell:
${DC} exec web python manage.py shell_plus
stop:
${DC} stop
kill:
${DC} kill
clean:
# python related things
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '__pycache__' -exec rm -rf {} +
# test related things
-rm -f .coverage
# docs files
-rm -rf docs/_build/
# state files
-rm -f .make.*
lint: .make.docker.pull
${DC} run test flake8
test: .make.docker.pull
${DC} run --rm test
test-image: .make.docker.build
${DC} run --rm test-image
docs: .make.docker.pull
${DC} run --rm web make -C docs/ clean html
check-requirements: .make.docker.pull
${DC} run --rm test pip list -o
compile-requirements: .make.docker.pull
${DC} run --rm compile-requirements
###############
# For use in CI
###############
.make.docker.build.ci:
${MAKE} build-ci
clean-ci: clean .env
${DC_CI} down -v
build-ci: .make.docker.pull
${DC_CI} build --pull web
# tag intermediate images using cache
${DC_CI} build builder
@touch .make.docker.build.ci
test-ci: .make.docker.build.ci
${DC_CI} run --rm test-image
push-ci: .make.docker.build.ci
docker/bin/push2dockerhub.sh
######################################################
# For use in local-machine development (not in Docker)
######################################################
install-local-python-deps:
# Dev requirements are a superset of prod requirements
pip install -r requirements/dev.txt
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " run - docker compose up the entire system for dev"
@echo " build - build docker images for dev"
@echo " pull - pull the latest production images from Docker Hub"
@echo " run-shell - open a bash shell in a fresh container"
@echo " shell - open a bash shell in the running app"
@echo " djshell - start the Django Python shell in the running app"
@echo " clean - remove all build, test, coverage and Python artifacts"
@echo " lint - check style with flake8, jshint, and stylelint"
@echo " test - run tests against local files"
@echo " test-image - run tests against files in docker image"
@echo " docs - generate Sphinx HTML documentation"
@echo " build-ci - build docker images for use in our CI pipeline"
@echo " test-ci - run tests against files in docker image built by CI"
@echo " check-requirements - output list of outdated Python requirements"
@echo " compile-requirements - compile pip requirements using pip-compile-multi"
@echo " install-local-python-deps - install Python dependencies onto your development machine"
.PHONY: all clean clean-ci build pull docs lint run run-shell shell test test-image build-ci test-ci push-ci djshell stop kill check-requirements compile-requirements install-local-python-deps