-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
executable file
·50 lines (46 loc) · 1.29 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
#!/usr/bin/env bash
python3 -m venv venv
. ./venv/bin/activate
python3 -m pip install --upgrade pip
function assertPrerequisites {
VERSION=v$(python setup.py --version 2>/dev/null)
TAGGED=$(git describe --tags --exact-match HEAD 2>&1)
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
# check that we are on the master branch where we do releases
if [ "$BRANCH" != "master" ]; then
(echo >&2 "ERROR: not master branch ($BRANCH), aborted.")
exit -1
fi
if [ "$VERSION" != "$TAGGED" ]; then
(echo >&2 "ERROR: version does not match tag: '$VERSION' != '$TAGGED', aborted.")
exit -1
fi
}
case $1 in
build)
pip --no-cache-dir install -r requirements.txt
PYTHONPATH=. python -m compileall ubirch tests examples
;;
test)
pip --no-cache-dir install -r requirements.test.txt
python -m pytest --junit-xml test-report.xml tests
python -c 'import xml.dom.minidom; print(xml.dom.minidom.parse("test-report.xml").toprettyxml())' >/tmp/report.xml
mv /tmp/report.xml test-report.xml
;;
package)
assertPrerequisites
./bin/create_package.sh
;;
upload-testpypi)
assertPrerequisites
./bin/upload_test_pypi.sh
;;
upload-pypi)
assertPrerequisites
./bin/upload_pypi.sh
;;
*)
echo "Usage: $0 { build | test | package | upload-testpypi | upload-pypi }"
exit 1
;;
esac