summaryrefslogtreecommitdiff
path: root/Makefile
blob: 153d6130934f547fbcc8c6fb819df4d7270e7016 (plain)
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
DIST=dist/bitmask
NEXT_VERSION = $(shell cat pkg/next-version)
DIST_VERSION = $(DIST)-$(NEXT_VERSION)/

HEADLESS_DIST=dist/bitmask-nox
HEADLESS_DIST_VERSION = $(HEADLESS_DIST)-$(NEXT_VERSION)/

ANONVPN_DIST=dist/anonvpn
ANONVPN_DIST_VERSION = $(ANONVPN_DIST)-$(NEXT_VERSION)/

BITMASK_ROOT = src/leap/bitmask/vpn/helpers/linux/bitmask-root
POLKIT_POLICY = src/leap/bitmask/vpn/helpers/linux/se.leap.bitmask.bundle.policy
SUDO = /usr/bin/sudo

include pkg/bundles/build.mk
include pkg/thirdparty/openvpn/build.mk

dev-bootstrap:
	pkg/tools/bitmask-bootstrap.sh

dev-mail:
	pip install -U -e '.[mail]'

dev-gui: install_pixelated
	pip install -U -e '.[gui]'

dev-backend:
	pip install -U -e '.[backend]'

dev-all: install_pixelated
	pip install -I --install-option="--bundled" pysqlcipher
	pip install -U -e '.[all]'

dev-latest-leap:
	pip install -U -e 'git+https://0xacab.org/leap/leap_pycommon@master#egg=leap.common'
	pip install -U -e 'git+https://0xacab.org/leap/soledad@master#egg=leap.soledad'

dev-latest-backend: dev-backend dev-latest-leap

dev-latest-all: dev-all dev-latest-leap

upgrade-all:
	python pkg/tools/upgrade_all.py

uninstall:
	pip uninstall leap.bitmask

test:
	tox

test_e2e_mail: install_helpers
	tests/e2e/e2e-test-mail.sh

test_e2e_vpn: install_helpers
	tests/e2e/e2e-test-vpn.sh

test_e2e_conditional_downloads: install_helpers
	tests/e2e/conditional_downloads.py

test_functional_setup:
	pip install -U behave selenium

test_functional: install_helpers
	test -f /usr/bin/lxpolkit && lxpolkit &
	xvfb-run --server-args="-screen 0 1280x1024x24" behave --tags ~@wip --tags @smoke tests/functional/features -k --no-capture -D host=localhost

test_functional_graphical:
	behave --tags ~@wip --tags @smoke tests/functional/features -k --no-capture -D host=localhost

test_functional_graphical_wip:
	behave --tags @wip tests/functional/features -k --no-capture -D host=localhost

install_helpers:
	# if there's no sudo, assumming this is running as root by the CI
	test -f $(SUDO) && sudo cp $(BITMASK_ROOT) /usr/local/sbin/ || cp $(BITMASK_ROOT) /usr/local/sbin/
	test -f $(SUDO) && sudo cp $(POLKIT_POLICY) /usr/share/polkit-1/actions/se.leap.bitmask.bundle.policy || cp $(POLKIT_POLICY) /usr/share/polkit-1/actions/se.leap.bitmask.bundle.policy

install_pixelated:
	pip install leap.pixelated leap.pixelated-www

qt-resources:
	pyrcc5 pkg/branding/icons.qrc -o src/leap/bitmask/gui/app_rc.py

doc:
	cd docs && make html

bundle_in_virtualenv:
	pkg/build_bundle_with_venv.sh

bundle_in_virtualenv_osx:
	pkg/build_osx_bundle_with_venv.sh

package_in_docker:
	# needs docker_ce and gitlab-runner from upstream
	gitlab-runner exec docker package:amd64_stretch

bundler_image:
	cd pkg/docker_bundler && make bundler

bundle_in_docker:
	# needs a docker container called 'bitmask-bundler-apt', created with 'make bundler_image'
	# XXX why was it needed to specify -u `id -u` again? if it's something with gilab CI we might need
	# to chown it first.
	cat pkg/bundle_from_docker | docker run -i -v /srv/bitmask-builds:/dist -w /dist -e REPO="$(REPO)" -e BRANCH="$(BRANCH)" bitmask-bundler-apt bash

bundle_riseupvpn:
	# needs a docker container called 'bitmask-bundler-apt', created with 'make bundler_image'
	# XXX why was it needed to specify -u `id -u` again? if it's something with gilab CI we might need
	# to chown it first.
	cat pkg/bundle_riseupvpn_from_docker | docker run -i -v /srv/bitmask-builds:/dist -w /dist -e REPO="$(REPO)" -e BRANCH="$(BRANCH)" bitmask-bundler-apt bash

bundle_riseupvpn_osx_in_virtualenv:
	pkg/build_osx_bundle_riseupvpn_with_venv.sh

bundle_in_docker_virtualenv:
	# this runs bundles inside a virtualenv. it is kind of slow because it compiles all python extensions in dependencies each time.
	cat pkg/bundle_from_docker_venv | docker run -i -v ~/leap/bitmask-dev:/dist -w /dist -u `id -u` -e REPO="$(REPO)" -e BRANCH="$(BRANCH)" bitmask-bundler-venv bash
	mkdir -p dist/
	cp -r bitmaskbuild/$(DIST_VERSION) dist/
	rm -rf bitmaskbuild

snap_in_docker:
	cd pkg/riseupvpn && ./pack_installers && cd ..
	sudo docker run -v $(PWD):$(PWD) -w $(PWD) snapcore/snapcraft snapcraft

snap_clean:
	sudo rm -rf stage prime parts

upload:
	python setup.py sdist bdist_wheel --universal upload --sign -i kali@leap.se -r pypi

clean:
	find . -type f -name "*.py[co]" -delete
	find . -type d -name "__pycache__" -delete