forked from edx/portal-designer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
149 lines (112 loc) · 5.8 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
.DEFAULT_GOAL := test
.PHONY: clean compile_translations dummy_translations extract_translations fake_translations help html_coverage \
migrate pull_translations push_translations quality pii_check requirements test update_translations validate \
dev_requirements test_requirements quality_requirements doc_requirements prod_requirements
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " clean delete generated byte code and coverage reports"
@echo " compile_translations compile translation files, outputting .po files for each supported language"
@echo " dummy_translations generate dummy translation (.po) files"
@echo " extract_translations extract strings to be translated, outputting .mo files"
@echo " fake_translations generate and compile dummy translation files"
@echo " help display this help message"
@echo " html_coverage generate and view HTML coverage report"
@echo " migrate apply database migrations"
@echo " dev_requirements install requirements for local development"
@echo " test_requirements install requirements for testing"
@echo " quality_requirements install requirements for quality"
@echo " doc_requirements install requirements for documentation"
@echo " prod_requirements install requirements for production"
@echo " pull_translations pull translations from Transifex"
@echo " push_translations push source translation files (.po) from Transifex"
@echo " quality run Pycodestyle and Pylint"
@echo " pii_check check for PII annotations on all Django models"
@echo " requirements install requirements for local development"
@echo " test run tests and generate coverage report"
@echo " validate run tests, quality, and PII annotation checks"
@echo " start-devstack run a local development copy of the server"
@echo " open-devstack open a shell on the server started by start-devstack"
@echo " pkg-devstack build the designer image from the latest configuration and code"
@echo " detect_changed_source_translations check if translation files are up-to-date"
@echo " validate_translations install fake translations and check if translation files are up-to-date"
@echo ""
clean:
find . -name '*.pyc' -delete
coverage erase
rm -rf assets
rm -rf pii_report
requirements: dev_requirements
static:
python manage.py collectstatic --noinput
dev_requirements:
pip install -qr requirements/dev.txt --exists-action w
test_requirements:
pip install -qr requirements/test.txt --exists-action w
quality_requirements:
pip install -qr requirements/quality.txt --exists-action w
doc_requirements:
pip install -qr requirements/doc.txt --exists-action w
production-requirements:
pip install -qr requirements.txt --exists-action w
test: clean test_requirements
coverage run ./manage.py test designer --settings=designer.settings.test
coverage report
quality: quality_requirements
pycodestyle designer *.py
pylint --rcfile=pylintrc designer *.py
pii_check:
DJANGO_SETTINGS_MODULE=designer.settings.test \
code_annotations django_find_annotations --config_file .pii_annotations.yml --lint --report --coverage
validate: test quality pii_check
migrate:
python manage.py migrate
html_coverage:
coverage html && open htmlcov/index.html
upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -qr requirements/pip-tools.txt
# Make sure to compile files after any other files they include!
pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
pip-compile --upgrade -o requirements/base.txt requirements/base.in
pip-compile --upgrade -o requirements/test.txt requirements/test.in
pip-compile --upgrade -o requirements/doc.txt requirements/doc.in
pip-compile --upgrade -o requirements/quality.txt requirements/quality.in
pip-compile --upgrade -o requirements/dev.txt requirements/dev.in
pip-compile --upgrade -o requirements/production.txt requirements/production.in
extract_translations:
python manage.py makemessages -l en -v1 -d django
python manage.py makemessages -l en -v1 -d djangojs
dummy_translations:
cd designer && i18n_tool dummy
compile_translations:
python manage.py compilemessages
fake_translations: extract_translations dummy_translations compile_translations
pull_translations:
tx pull -af --mode reviewed
push_translations:
tx push -s
detect_changed_source_translations:
cd designer && i18n_tool changed
validate_translations: fake_translations detect_changed_source_translations
# Docker commands below
dev.provision:
bash ./provision-designer.sh
dev.init: dev.up dev.migrate
dev.makemigrations:
docker exec -it designer.app bash -c 'cd /edx/app/designer/designer && python manage.py makemigrations'
dev.migrate: # Migrates databases. Application and DB server must be up for this to work.
docker exec -it designer.app bash -c 'cd /edx/app/designer/designer && make migrate'
dev.up: # Starts all containers
docker-compose up -d --build
dev.down: # Kills containers and all of their data that isn't in volumes
docker-compose down
dev.destroy: dev.down #Kills containers and destroys volumes. If you get an error after running this, also run: docker volume rm portal-designer_designer_mysql
docker volume rm designer_designer_mysql
dev.stop: # Stops containers so they can be restarted
docker-compose stop
%-shell: ## Run a shell on the specified service container
docker exec -it designer.$* bash
%-logs: ## View the logs of the specified service container
docker-compose logs -f --tail=500 $*
attach:
docker attach designer.app