Skip to content

Instantly share code, notes, and snippets.

@lasley
Last active December 17, 2016 23:33
Show Gist options
  • Save lasley/e547cc2f66cff91e9494ad46b69b9571 to your computer and use it in GitHub Desktop.
Save lasley/e547cc2f66cff91e9494ad46b69b9571 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ "${LINT_CHECK}" = "1" ];
then
pip install flake8
flake8 ./
elif [ "${TESTS}" = "1" ];
then
pip install coveralls
pip install --user codecov
pip install codeclimate-test-reporter
if [ -f test_requirements.txt ];
then
pip install -r ./test_requirements.txt
elif [ -f test_requirements.txt ];
then
pip install -r ./requirements.txt
fi
pip install .
coverage run setup.py test
coveralls || true
codecov || true
codeclimate-test-reporter || true
elif [ "${DOCS}" = "1" ];
then
if [ "${TRAVIS_BRANCH}" = "${BRANCH_PROD:=master}" ] \
&& [ "${TRAVIS_PULL_REQUEST}" = "false" ];
then
pip install sphinx sphinx_rtd_theme
[email protected]
set -e
# Create Documentation
sphinx-apidoc -f -F -P -a -o docs/ -H $PROJECT -A "LasLabs Inc." -V $VERSION -R $RELEASE ./
cd ./docs/
make html
# Clone the docs branch outside of the repo and cd into it.
cd ..
git clone -b "${BRANCH_DOC:=gh-pages}" "https://[email protected]/$TRAVIS_REPO_SLUG.git" gh-pages
cd gh-pages
# Copy Documentation HTML from main branch to root of this one.
cp -R ../$REPO/docs/_build/html/* ./
# Add a nojekyll to allow Github parse
touch ./.nojekyll
# Update git configuration in order to push
if [ "$1" != "dry" ]; then
# Update git config.
git config user.name "LasLabs Bot"
git config user.email "$EMAIL"
fi
# Add and commit changes.
git add -A .
git commit -m "[IMP] AutoDoc commit for $TRAVIS_COMMIT."
if [ "$1" != "dry" ]; then
# -q is very important, otherwise you leak your GH_TOKEN
git push -q origin gh-pages
fi
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment