forked from mdn/kuma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
160 lines (120 loc) · 4.39 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
150
151
152
153
154
155
156
157
158
159
160
VERSION ?= $(shell git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD)
BASE_IMAGE_NAME ?= kuma_base
KUMA_IMAGE_NAME ?= kuma
REGISTRY ?= quay.io/
IMAGE_PREFIX ?= mozmar
BASE_IMAGE ?= ${REGISTRY}${IMAGE_PREFIX}/${BASE_IMAGE_NAME}\:${VERSION}
BASE_IMAGE_LATEST ?= ${REGISTRY}${IMAGE_PREFIX}/${BASE_IMAGE_NAME}\:latest
IMAGE ?= $(BASE_IMAGE_LATEST)
KUMA_IMAGE ?= ${REGISTRY}${IMAGE_PREFIX}/${KUMA_IMAGE_NAME}\:${VERSION}
KUMA_IMAGE_LATEST ?= ${REGISTRY}${IMAGE_PREFIX}/${KUMA_IMAGE_NAME}\:latest
TEST ?= test #other options in docker-compose.test.yml
DEIS_PROFILE ?= dev-usw
DEIS_APP ?= mdn-dev
DEIS_BIN ?= deis
WORKERS ?= 1
DB_PASS ?= kuma # default for ephemeral demo DBs
target = kuma
requirements = -r requirements/local.txt
# set Django settings module if not already set as env var
export DJANGO_SETTINGS_MODULE ?= kuma.settings.testing
# Note: these targets should be run from the kuma vm
test:
py.test $(target)
coveragetest: clean
py.test --cov=$(target) $(target)
coveragetesthtml: coveragetest
coverage html
locust:
locust -f tests/performance/smoke.py --host=https://developer.allizom.org
compilecss:
@ echo "## Compiling Stylus files to CSS ##"
@ ./scripts/compile-stylesheets
compilejsi18n:
@ echo "## Generating JavaScript translation catalogs ##"
@ mkdir -p build/locale
@ python manage.py compilejsi18n
collectstatic:
@ echo "## Collecting and building static files ##"
@ mkdir -p build/assets
@ python manage.py collectstatic --noinput
build-static: compilecss compilejsi18n collectstatic
install:
@ echo "## Installing $(requirements) ##"
@ pip install $(requirements)
# Note: this target should be run from the host machine with selenium running
intern:
pushd tests/ui ; ./node_modules/.bin/intern-runner config=intern-local d=developer.allizom.org b=firefox; popd
clean:
rm -rf .coverage build/
find kuma -name '*.pyc' -exec rm {} \;
mkdir -p build/assets
mkdir -p build/locale
locale:
# For generating a new file to let locales name localizable
python manage.py translate_locales_name
@mkdir -p locale/$(LOCALE)/LC_MESSAGES && \
for pot in locale/templates/LC_MESSAGES/* ; do \
msginit --no-translator -l $(LOCALE) -i $$pot -o locale/$(LOCALE)/LC_MESSAGES/`basename -s .pot $$pot`.po ; \
done
localetest:
dennis-cmd lint --errorsonly locale/
localeextract:
python manage.py extract
python manage.py merge
localecompile:
cd locale; ./compile-mo.sh .
localerefresh: localeextract localetest localecompile compilejsi18n collectstatic
@echo
@echo Commit the new files with:
@echo git add --all locale\; git commit -m \"MDN string update $(shell date +%Y-%m-%d)\"
pull-base:
docker pull ${BASE_IMAGE}
pull-kuma:
docker pull ${KUMA_IMAGE}
pull-base-latest:
docker pull ${BASE_IMAGE_LATEST}
pull-kuma-latest:
docker pull ${KUMA_IMAGE_LATEST}
pull-latest: pull-base-latest pull-kuma-latest
build-base:
docker build -f Dockerfile-base -t ${BASE_IMAGE} .
build-kuma:
docker build -t ${KUMA_IMAGE} .
build: build-base build-kuma
push-base:
docker push ${BASE_IMAGE}
push-kuma:
docker push ${KUMA_IMAGE}
push: push-base push-kuma
deis-create:
DEIS_PROFILE=${DEIS_PROFILE} ${DEIS_BIN} create ${DEIS_APP} --no-remote && \
sleep 5 && ${DEIS_BIN} config:push -p .env-dist -a ${DEIS_APP} || \
${DEIS_BIN} apps | grep -q ${DEIS_APP}
deis-pull:
DEIS_PROFILE=${DEIS_PROFILE} ${DEIS_BIN} pull ${KUMA_IMAGE} -a ${DEIS_APP}
deis-scale-worker:
DEIS_PROFILE=${DEIS_PROFILE} ${DEIS_BIN} ps:scale worker=${WORKERS} -a ${DEIS_APP}
k8s-migrate:
kubectl --namespace ${DEIS_APP} exec \
$(shell kubectl --namespace ${DEIS_APP} get pods | grep ${DEIS_APP}-cmd | awk '{print $$1}') \
python manage.py migrate
deis-migrate:
DEIS_PROFILE=${DEIS_PROFILE} ${DEIS_BIN} run -a ${DEIS_APP} python manage.py migrate
tag-latest:
docker tag ${BASE_IMAGE} ${BASE_IMAGE_LATEST}
docker tag ${KUMA_IMAGE} ${KUMA_IMAGE_LATEST}
push-latest: push tag-latest
docker push ${BASE_IMAGE_LATEST}
docker push ${KUMA_IMAGE_LATEST}
up:
docker-compose up -d
bash: up
docker exec -it kuma_web_1 bash
shell_plus: up
docker exec -it kuma_web_1 ./manage.py shell_plus
compose-test:
docker-compose -f docker-compose.yml -f docker-compose.test.yml run $(TEST)
docker-compose -f docker-compose.yml -f docker-compose.test.yml stop
# Those tasks don't have file targets
.PHONY: test coveragetest intern locust clean locale install compilecss compilejsi18n collectstatic localetest localeextract localecompile localerefresh