This repository has been archived by the owner on Apr 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
/
Makefile
133 lines (102 loc) · 4.29 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
121
122
123
124
125
126
127
128
129
130
131
132
133
help:
@echo "[DEV ENV SETUP]"
@echo "install-docker-ubuntu - installs docker and docker-compose on Ubuntu"
@echo "install-docker-osx - installs homebrew (you can skip this at runtime), docker and docker-compose on OSX"
@echo "init-env - builds the container, sets up the database and fixtures"
@echo "build - builds the container"
@echo "init-db - sets up the database and fixtures"
@echo "drop-db - drops the database"
@echo "redo-db - drops the database, then sets up the database and fixtures"
@echo "\n[UTILS]"
@echo "update-requirements - run pip compile and rebuild the requirements files"
@echo "migrations - generate migrations in a clean container"
@echo "shell - start a django shell"
@echo "bash - start a bash shell in a running container"
@echo "urls - print url routes"
@echo "\n[TEST]"
@echo "test - run all tests"
@echo "test-lf - rerun tests that failed last time"
@echo "test-no-warnings - run tests without printing warning messages"
@echo "test-pdb - run tests and enter debugger on failed assert or error"
@echo "test-n - run all tests using multiple processes"
@echo "test-n-lf - rerun using multiple processes tests that failed last time"
@echo "test-n-no-warnings - run tests without printing warning messages"
@echo "\n[CLEAN]"
@echo "clean - remove all build, test, coverage and Python artifacts"
@echo "clean-docker - stop docker containers and remove orphaned images and volumes"
@echo "clean-py - remove test, coverage and Python file artifacts"
@echo "\n[PRODUCTION]"
@echo "deployment-requirements - run pip compile and rebuild the production requirements files"
@echo "install - install production dependencies"
install-docker-ubuntu:
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(shell lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(shell uname -s)-$(shell uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
install-docker-osx:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew cask install docker
brew install docker-compose
init-env: build init-db
build:
docker-compose build --pull epcon
run:
docker-compose up
init-db:
docker-compose down -t 60
mkdir -p data/site
docker-compose run --rm epcon "./manage.py migrate --no-input"
docker-compose run --rm epcon "./manage.py create_initial_data_for_dev"
drop-db:
docker-compose down -t 60
rm -f data/site/epcon.db
redo-db: drop-db init-db
update-requirements: build
docker-compose run --rm epcon "pip install pip-tools -U && pip-compile -U requirements.in -o requirements.txt && chmod a+r requirements.txt && pip-compile -U requirements-dev.in -o requirements-dev.txt && chmod a+r requirements-dev.txt"
migrations: build
docker-compose run --rm epcon "./manage.py makemigrations"
shell:
docker-compose run --rm epcon "./manage.py shell_plus"
bash:
docker-compose exec epcon /bin/bash
urls:
docker-compose run --rm epcon "./manage.py show_urls"
test: build
docker-compose run --rm epcon "pytest"
test-pdb:
docker-compose run --rm epcon "pytest --pdb"
test-lf:
docker-compose run --rm epcon "pytest --lf"
test-no-warnings:
docker-compose run --rm epcon "pytest --disable-warnings"
test-n:
docker-compose run --rm epcon "pytest -n auto"
test-n-lf:
docker-compose run --rm epcon "pytest -n auto -lf"
test-n-no-warnings:
docker-compose run --rm epcon "pytest --disable-warnings -n auto"
clean: clean-docker clean-py
clean-docker:
docker-compose down -t 60
docker system prune -f
clean-py:
find . -name '*.pyc' -delete
find . -name '*.pyo' -delete
find . -name '.coverage' -delete
deployment-requirements:
pip install -U pip==19.3.1
pip install -U pip-tools
pip-compile --upgrade requirements.in -o requirements.txt
chmod a+r requirements.txt
install:
pip install -U pip
pip install -U pip-tools
pip-sync requirements.txt
-include Makefile.local