forked from chaostoolkit/chaostoolkit-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci.bash
More file actions
74 lines (62 loc) · 2.02 KB
/
ci.bash
File metadata and controls
74 lines (62 loc) · 2.02 KB
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
#!/bin/bash
set -eo pipefail
function fetch-and-install-chaostoolkit-packages() {
cd extensions-doc-builder
mkdir deps
pip --quiet install --pre -U chaostoolkit-lib chaostoolkit
pip --quiet install httplib2 uritemplate pytzdata
# collect all the dependencies for our drivers
pip --quiet install -U -r requirements-toolkit.txt
# now let's get them as archives for building their docs
pip download \
--no-deps \
--no-cache-dir \
--dest deps \
--no-binary=chaostoolkit-aws,chaostoolkit-azure,chaostoolkit-cloud-foundry,chaostoolkit-google-cloud-platform,chaostoolkit-humio,chaostoolkit-kubernetes,chaostoolkit-prometheus,chaostoolkit-spring,chaostoolkit-toxiproxy,chaostoolkit-opentracing,chaostoolkit-service-fabric,chaostoolkit-istio,chaostoolkit-wiremock \
-r requirements-toolkit.txt
cd deps
for archive in *.tar.gz;
do
tar zxvf "$archive"
dirname=$(basename $archive .tar.gz)
cd $dirname
pip install -e .
cd ..
done
cd ../..
}
function build-drivers-doc () {
cd extensions-doc-builder
if python ext2md.py; then
echo "Extension documentation built"
fi
cd ..
}
function build-docs () {
echo "Building the documentation"
mkdir /tmp/site
cd /tmp/site
git clone https://$GH_USER_NAME:$GH_USER_PWD@github.com/chaostoolkit/chaostoolkit-documentation.git .
git checkout gh-pages
cd -
mkdocs build --strict -d /tmp/site
}
function publish-docs () {
echo "Publishing the documentation"
cd /tmp/site
echo "docs.chaostoolkit.org" > CNAME
git add .
git commit -a -m "Built from ${TRAVIS_COMMIT}"
git push
}
function main () {
fetch-and-install-chaostoolkit-packages || return 1
build-drivers-doc || return 1
build-docs || return 1
if [[ "$TRAVIS_BRANCH" == "master" ]] && [[ "$TRAVIS_PULL_REQUEST" == false ]]; then
# build docs on each commit but only from master
publish-docs || return 1
fi
}
main "$@" || exit 1
exit 0