forked from chaostoolkit/chaostoolkit-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci.bash
51 lines (42 loc) · 1.31 KB
/
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
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -eo pipefail
function lint () {
echo "Checking the code syntax"
pycodestyle --first chaosk8s
}
function build () {
echo "Building the choastoolkit package"
python setup.py build
}
function run-test () {
echo "Running the tests"
python setup.py test
}
function release () {
echo "Releasing the pachaage"
python setup.py release
echo "Publishing to PyPI"
pip install twine
twine upload dist/* -u ${PYPI_USER_NAME} -p ${PYPI_PWD}
echo "Creating a new binary bundle of the toolkit and all known drivers/plugins"
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token "$TRAVIS_CI_TOKEN"" \
-d '{"request": {"branch":"master", "message": "Rebuilding after new chaostoolkit-kubernetes release"}}' \
https://api.travis-ci.org/repo/chaostoolkit%2Fchaostoolkit-bundler/requests
}
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