forked from Mickael-Roger/chaostoolkit-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci.bash
executable file
·42 lines (34 loc) · 874 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"
pycodestyle --first chaosansible
}
function build () {
echo "Building the chaostoolkit-ansible package"
python3 setup.py build
}
function run-test () {
echo "Running the tests"
python3 setup.py test
}
function release () {
echo "Releasing the package"
python3 setup.py release
echo "Publishing to PyPI"
pip3 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