Skip to content

Commit fd90d17

Browse files
author
Guillaume Lemaitre
committed
Add circle ci for the documentation
1 parent d60c411 commit fd90d17

File tree

3 files changed

+110
-1
lines changed

3 files changed

+110
-1
lines changed

build_tools/circle/push_doc.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
# This script is meant to be called in the "deploy" step defined in
3+
# circle.yml. See https://circleci.com/docs/ for more details.
4+
# The behavior of the script is controlled by environment variable defined
5+
# in the circle.yml in the top level folder of the project.
6+
7+
MSG="Pushing the docs for revision for branch: $CIRCLE_BRANCH, commit $CIRCLE_SHA1"
8+
9+
cd $HOME
10+
# Copy the build docs to a temporary folder
11+
rm -rf tmp
12+
mkdir tmp
13+
cp -R $HOME/$DOC_REPO/doc/_build/html/* ./tmp/
14+
15+
# Clone the docs repo if it isnt already there
16+
if [ ! -d $DOC_REPO ];
17+
then git clone "[email protected]:$USERNAME/"$DOC_REPO".git";
18+
fi
19+
20+
cd $DOC_REPO
21+
git branch gh-pages
22+
git checkout -f gh-pages
23+
git reset --hard origin/gh-pages
24+
git clean -dfx
25+
26+
for name in $(ls -A $HOME/$DOC_REPO); do
27+
case $name in
28+
.nojekyll) # So that github does not build this as a Jekyll website.
29+
;;
30+
circle.yml) # Config so that build gh-pages branch.
31+
;;
32+
*)
33+
git rm -rf $name
34+
;;
35+
esac
36+
done
37+
38+
# Copy the new build docs
39+
mkdir $DOC_URL
40+
cp -R $HOME/tmp/* ./$DOC_URL/
41+
42+
git config --global user.email $EMAIL
43+
git config --global user.name $USERNAME
44+
git add -f ./$DOC_URL/
45+
git commit -m "$MSG"
46+
git push -f origin gh-pages
47+
if [ $? -ne 0 ]; then
48+
echo "Pushing docs failed"
49+
echo
50+
exit 1
51+
fi
52+
53+
echo $MSG

circle.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
machine:
2+
environment:
3+
# The github organization or username of the repository which hosts the
4+
# project and documentation.
5+
USERNAME: "glemaitre"
6+
7+
# The repository where the documentation will be hosted
8+
DOC_REPO: "UnbalancedDataset"
9+
10+
# The base URL for the Github page where the documentation will be hosted
11+
DOC_URL: ""
12+
13+
# The email is to be used for commits in the Github Page
14+
15+
16+
dependencies:
17+
18+
# Various dependencies
19+
pre:
20+
- sudo -E apt-get -yq remove texlive-binaries --purge
21+
- sudo apt-get update
22+
- sudo apt-get install libatlas-dev libatlas3gf-base
23+
- sudo apt-get install build-essential python-dev python-setuptools
24+
# install numpy first as it is a compile time dependency for other packages
25+
- pip install --upgrade numpy
26+
- pip install --upgrade scipy matplotlib setuptools nose coverage sphinx pillow sphinx-gallery sphinx_rtd_theme
27+
# Installing required packages for `make -C doc check command` to work.
28+
- sudo -E apt-get -yq update
29+
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install dvipng texlive-latex-base texlive-latex-extra
30+
- pip install --upgrade cython numpydoc
31+
- pip install --upgrade scikit-learn
32+
33+
# The --user is needed to let sphinx see the source and the binaries
34+
# The pipefail is requested to propagate exit code
35+
override:
36+
- python setup.py clean
37+
- python setup.py develop
38+
- set -o pipefail && cd doc && make html 2>&1 | tee ~/log.txt
39+
test:
40+
# Grep error on the documentation
41+
override:
42+
- cat ~/log.txt && if grep -q "Traceback (most recent call last):" ~/log.txt; then false; else true; fi
43+
deployment:
44+
push:
45+
branch: master
46+
commands:
47+
- bash build_tools/circle/push_doc.sh
48+
general:
49+
# Open the doc to the API
50+
artifacts:
51+
- "doc/_build/html"
52+
- "~/log.txt"
53+
# Restric the build to the branch master only
54+
branches:
55+
ignore:
56+
- gh-pages

doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
77
PAPER =
8-
BUILDDIR = ../../UnbalancedDataset-docs
8+
BUILDDIR = _build
99

1010
# User-friendly check for sphinx-build
1111
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)

0 commit comments

Comments
 (0)