forked from pimutils/vdirsyncer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·90 lines (77 loc) · 2.09 KB
/
build.sh
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
#!/bin/sh
set -e
_davserver() {
# Maybe tmpfs is mounted on /tmp/, can't harm anyway.
if [ ! -d $TESTSERVER_BASE$1/ ]; then
git clone --depth=1 \
https://github.com/vdirsyncer/$1-testserver.git \
/tmp/$1-testserver
ln -s /tmp/$1-testserver $TESTSERVER_BASE$1
fi
(cd $TESTSERVER_BASE$1 && sh install.sh)
}
install_build_tests() {
$PIP_INSTALL \
coverage \
pytest \
pytest-xprocess
_davserver $DAV_SERVER
if [ "$TRAVIS" = "true" ]; then
export CFLAGS=-O0 # speed up builds of packages which don't have wheels
$PIP_INSTALL --upgrade pip
$PIP_INSTALL wheel
PIP_INSTALL="pip install --use-wheel --find-links=http://travis-wheels.unterwaditzer.net/wheels/"
$PIP_INSTALL coveralls
fi
$PIP_INSTALL --editable .
}
run_build_tests() {
if [ "$TRAVIS" = "true" ]; then
coverage run --source=vdirsyncer/,tests/ --module pytest
coveralls
else
py.test
fi
}
install_build_style() {
$PIP_INSTALL flake8
}
run_build_style() {
flake8 vdirsyncer tests
! git grep -il syncroniz $(ls | grep -v 'build.sh')
}
install_build_docs() {
$PIP_INSTALL sphinx sphinx_rtd_theme
$PIP_INSTALL -e .
}
run_build_docs() {
cd docs
make html
}
[ -n "$BUILD" ] || BUILD=tests
[ -n "$DAV_SERVER" ] || DAV_SERVER=radicale
[ -n "$REQUIREMENTS" ] || REQUIREMENTS=release
COMMAND="$1"
if [ -z "$COMMAND" ]; then
echo "Usage:"
echo "build.sh run # run build"
echo "build.sh install # install dependencies"
echo
echo "Environment variable combinations:"
echo "BUILD=tests # install and run tests"
echo " # (using Radicale, see .travis.yml for more)"
echo "BUILD=style # install and run stylechecker (flake8)"
echo "BUILD=docs # install sphinx and build HTML docs"
exit 1
fi
TESTSERVER_BASE=./tests/storage/dav/servers/
install_builds() {
echo "Installing for $BUILD"
PIP_INSTALL="pip install"
install_build_$BUILD
}
run_builds() {
echo "Running $BUILD"
run_build_$BUILD
}
${COMMAND}_builds