-
Notifications
You must be signed in to change notification settings - Fork 2
/
ci.bash
42 lines (34 loc) · 861 Bytes
/
ci.bash
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
#!/bin/bash
set -eo pipefail
function lint () {
echo "Checking the code syntax"
pylama chaossaltstack
}
function build () {
echo "Building the chaostoolkit-saltstack package"
python setup.py build
}
function run-test () {
echo "Running the tests"
python setup.py test
}
function release () {
echo "Releasing the package"
python setup.py release
echo "Publishing to PyPI"
pip install twine
twine upload dist/* -u ${PYPI_USER_NAME} -p ${PYPI_PWD}
}
function main () {
lint || return 1
build || return 1
run-test || return 1
if [[ $TRAVIS_PYTHON_VERSION =~ ^3\.5+$ ]]; then
if [[ $TRAVIS_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Releasing tag $TRAVIS_TAG with Python $TRAVIS_PYTHON_VERSION"
release || return 1
fi
fi
}
main "$@" || exit 1
exit 0