-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
100 lines (80 loc) · 3 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
SHELL = /bin/bash
VERSION = 0.7.32
.PHONY: build docs check-venv
# Make Python wheels
default: build
# Prepare VirtualEnv by installing project dependencies
venv/bin/activate: web/requirements.txt executor/requirements.txt
test -d venv || python3 -m venv venv
venv/bin/pip install -r requirements.txt
venv/bin/pip install -r executor/requirements.txt
venv/bin/pip install -r web/requirements.txt
touch venv/bin/activate
# Shortcut for preparation of VirtualEnv
venv: venv/bin/activate
check-venv:
ifndef VIRTUAL_ENV
$(error Please create a VirtualEnv with 'make venv' and activate it)
endif
# Create an OpenSubmit config file for the development server
web/opensubmit/settings_dev.ini: check-venv
python -m web.opensubmit.cmdline -c web/opensubmit/settings_dev.ini configcreate --debug --login_demo
# Run the OpenSubmit development server
runserver: check-venv web/opensubmit/settings_dev.ini
pushd web; python ./manage.py migrate; popd
pushd web; python ./manage.py runserver; popd
# Build the Python wheel install packages.
build: check-venv
pushd web; python ./setup.py bdist_wheel; popd
pushd executor; python ./setup.py bdist_wheel; popd
# Build the HTML documentation from the sources.
docs: check-venv
pushd docs; make html; popd
# Run all tests.
tests: check-venv web/opensubmit/settings_dev.ini
pushd web; python ./manage.py test; popd
# Run all tests and obtain coverage information.
coverage: check-venv web/opensubmit/settings_dev.ini
coverage run ./web/manage.py test opensubmit.tests; coverage html
docker-test-build: clean build
docker-compose -f deployment/docker-compose-test.yml build
# Run docker container with current code for interactive smoke testing
# Mounts the sources in the Docker container - so, as long as Apache
# detects the source code change, you should be able to do live patching
docker-test: docker-test-build
docker-compose -f deployment/docker-compose-test.yml up
# Update version numbers, commit and tag
bumpversion:
bumpversion --verbose patch
# Re-create docker images and upload into registry
docker-push: clean build
docker login --username=troeger
pushd web; docker build -t troeger/opensubmit-web:$(VERSION) .; popd
docker push troeger/opensubmit-web:$(VERSION)
pushd executor; docker build -t troeger/opensubmit-exec:$(VERSION) .; popd
docker push troeger/opensubmit-exec:$(VERSION)
# Upload built packages to PyPI.
# Assumes valid credentials in ~/.pypirc
pypi-push: check-venv build
twine upload web/dist/opensubmit_web-$(VERSION)-py3-none-any.whl
twine upload executor/dist/opensubmit_exec-$(VERSION)-py3-none-any.whl
# Clean temporary files
clean:
rm -fr web/build
rm -fr web/dist
rm -fr executor/build
rm -fr executor/dist
rm -fr web/*egg-info
rm -fr executor/*egg-info
rm -f ./.coverage
rm -rf ./htmlcov
find . -name "*.bak" -delete
find . -name "__pycache__" -delete
# Clean HTML version of the documentation
clean-docs:
rm -rf docs/formats
# Clean cached Docker data and state
clean-docker:
docker container prune
docker volume prune
docker system prune