Removes deployment step from circle ci
[pixelated-user-agent.git] / Makefile
1 VIRTUALENV=~/.venvs/pixua
2
3 .PHONY: setup requirements install requirements_py install_py requirements_js install_js create_virtualenv
4 .PHONY: test test_py test_js test_all linters linters_py linters_js coverage unit_tests_py unit_tests_js
5 .PHONY: integration_tests_py functional_tests functional_tests_ci ensure_virtualenv_installed clean
6 .PHONY: clean_all clean_py clean_js clean_cache remove_virtualenv remove_javascript_packages run
7 setup: install
8
9 requirements: requirements_py requirements_js
10
11 install: requirements install_py install_js
12
13 requirements_py: create_virtualenv
14         @. $(VIRTUALENV)/bin/activate;\
15         pip install --upgrade pip setuptools
16
17 install_py: service/requirements.txt service/test_requirements.txt
18         @. $(VIRTUALENV)/bin/activate;\
19         cd service;\
20         pip install pysqlcipher --upgrade --force-reinstall --install-option="--bundled";\
21         pip install --exists-action s -r requirements.txt -r test_requirements.txt
22
23 requirements_js:
24         @cd web-ui;\
25         npm install;\
26         node_modules/.bin/bower install
27
28 install_js:
29         @cd web-ui;\
30         npm rebuild node-sass;\
31         npm run build
32
33 create_virtualenv: ensure_virtualenv_installed
34         @if [ ! -e $(VIRTUALENV)/bin/activate ]; then\
35                 echo "Pixelated virtualenv doesn't exist, creating now";\
36                 virtualenv --python=python2 $(VIRTUALENV);\
37         fi
38
39 test: clean install test_py test_js coverage
40 test_py: linters_py unit_tests_py integration_tests_py
41 test_js: linters_js unit_tests_js
42 test_all: test functional_tests
43 linters: clean install linters_py linters_js
44
45 linters_py:
46         @. $(VIRTUALENV)/bin/activate;\
47         cd service;\
48         pep8 --ignore=E501 pixelated test
49
50 linters_js:
51         @cd web-ui;\
52         npm run lint
53
54 coverage:
55         @. $(VIRTUALENV)/bin/activate;\
56         cd service;\
57         export PYTHONPATH=$(PYTHONPATH):`pwd`;\
58         coverage run -p --source=pixelated `which trial` test.unit;\
59         coverage run -p --source=pixelated `which trial` test.integration;\
60         coverage combine;\
61         coverage html
62
63 unit_tests_py:
64         @. $(VIRTUALENV)/bin/activate;\
65         cd service;\
66         export PYTHONPATH=$(PYTHONPATH):`pwd`;\
67         trial --reporter=text test.unit
68
69 unit_tests_js:
70         @cd web-ui;\
71         npm run test
72
73 integration_tests_py:
74         @. $(VIRTUALENV)/bin/activate;\
75         cd service;\
76         export PYTHONPATH=$(PYTHONPATH):`pwd`;\
77         trial --reporter=text test.integration
78
79 functional_tests: clean requirements install
80         @. $(VIRTUALENV)/bin/activate;\
81         export PATH=$(PATH):/usr/lib/chromium/;\
82         cd service;\
83         xvfb-run --server-args="-screen 0 1280x1024x24" behave --tags ~@wip --tags ~@smoke test/functional/features
84
85 smoke_tests: clean install
86         @. $(VIRTUALENV)/bin/activate;\
87         export PATH=$(PATH):/usr/lib/chromium/;\
88         cd service;\
89         xvfb-run --server-args="-screen 0 1280x1024x24" behave --tags ~@wip --tags @smoke test/functional/features -k -D host=$(provider)
90
91 functional_tests_ci: clean requirements install
92         @. $(VIRTUALENV)/bin/activate;\
93         cd service;\
94         behave --tags ~@wip --tags ~@smoke test/functional/features
95
96 functional_tests_wip:
97         @. $(VIRTUALENV)/bin/activate;\
98         export PATH=$(PATH):/usr/lib/chromium/;\
99         cd service;\
100         xvfb-run --server-args="-screen 0 1280x1024x24" behave --tags @wip test/functional/features
101
102 ensure_virtualenv_installed:
103         @if [ ! `which virtualenv` ]; then\
104                 echo "Virtualenv must be installed";\
105                 exit 1;\
106         fi
107
108 clean: clean_py clean_js clean_cache
109 clean_all: clean remove_javascript_packages remove_virtualenv
110
111 clean_py:
112         rm -rf service/_trial_temp
113         find . -name "*.pyc" -delete
114         rm -rf service/.coverage
115         rm -rf service/htmlcov
116
117 clean_js:
118         rm -rf web-ui/dist
119         rm -rf web-ui/.sass-cache
120
121 clean_cache:
122         rm -rf ~/.config/leap
123         rm -rf ~/.leap
124         rm -rf service/ghostdriver.log
125
126 remove_virtualenv:
127         rm -rf $(VIRTUALENV)
128
129 remove_javascript_packages:
130         rm -rf web-ui/node_modules
131         rm -rf web-ui/app/bower_components
132
133 diagrams:
134         @. $(VIRTUALENV)/bin/activate;\
135         pip install plantuml;\
136         cd service/diagrams/png;\
137         python -m plantuml *.txt
138
139 run:
140         @. $(VIRTUALENV)/bin/activate;\
141         pixelated-user-agent --host 0.0.0.0 --multi-user --provider=$(provider)