|
| 1 | +# This script is mostly adopted from https://github.com/openml/openml-python/blob/develop/ci_scripts/create_doc.sh |
| 2 | + |
| 3 | +set -euo pipefail |
| 4 | + |
| 5 | +# Check if DOCPUSH is set |
| 6 | +if ! [[ -z ${DOCPUSH+x} ]]; then |
| 7 | + |
| 8 | + if [[ "$DOCPUSH" == "true" ]]; then |
| 9 | + |
| 10 | + # install documentation building dependencies |
| 11 | + pip install --upgrade matplotlib seaborn setuptools nose coverage sphinx pillow sphinx-gallery sphinx_bootstrap_theme cython numpydoc nbformat nbconvert mock |
| 12 | + |
| 13 | + # $1 is the branch name |
| 14 | + # $2 is the global variable where we set the script status |
| 15 | + |
| 16 | + if ! { [ $1 = "master" ] || [ $1 = "development" ]; }; then |
| 17 | + { echo "Not one of the allowed branches"; exit 0; } |
| 18 | + fi |
| 19 | + |
| 20 | + # delete any previous documentation folder |
| 21 | + if [ -d doc/$1 ]; then |
| 22 | + rm -rf doc/$1 |
| 23 | + fi |
| 24 | + |
| 25 | + # create the documentation |
| 26 | + cd doc && make html 2>&1 |
| 27 | + |
| 28 | + # create directory with branch name |
| 29 | + # the documentation for dev/stable from git will be stored here |
| 30 | + mkdir $1 |
| 31 | + |
| 32 | + # get previous documentation from github |
| 33 | + git clone https://github.com/automl/auto-sklearn.git --branch gh-pages --single-branch |
| 34 | + |
| 35 | + # copy previous documentation |
| 36 | + cp -r auto-sklearn/. $1 |
| 37 | + rm -rf auto-sklearn |
| 38 | + |
| 39 | + # if the documentation for the branch exists, remove it |
| 40 | + if [ -d $1/$1 ]; then |
| 41 | + rm -rf $1/$1 |
| 42 | + fi |
| 43 | + |
| 44 | + # copy the updated documentation for this branch |
| 45 | + mkdir $1/$1 |
| 46 | + cp -r build/html/. $1/$1 |
| 47 | + |
| 48 | + # takes a variable name as an argument and assigns the script outcome to a |
| 49 | + # variable with the given name. If it got this far, the script was successful |
| 50 | + function set_return() { |
| 51 | + # $1 is the variable where we save the script outcome |
| 52 | + local __result=$1 |
| 53 | + local status='success' |
| 54 | + eval $__result="'$status'" |
| 55 | + } |
| 56 | + |
| 57 | + set_return "$2" |
| 58 | + fi |
| 59 | +fi |
| 60 | +# Workaround for travis failure |
| 61 | +set +u |
0 commit comments