Skip to content

Commit 6ecbc60

Browse files
author
y-p
committed
Merge pull request #6233 from y-p/PR_travis_docs
BLD: Build and publish docs (sans API) as part of Travis jobs
2 parents 4b66c6b + ef9910b commit 6ecbc60

File tree

6 files changed

+86
-9
lines changed

6 files changed

+86
-9
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ env:
88
- secure: "TWGKPL4FGtWjCQ427QrSffaQBSCPy1QzPdhtYKAW9AlDo/agdp9RyZRQr8WTlyZ5AOG18X8MDdi0EcpFnyfDNd4thCLyZOntxwltlVV2yNNvnird3XRKUV1F2DD42L64wna04M2KYxpCKhEQ84gEnCH1DGD4g1NnR6fYuEYNSTU="
99
- secure: "NvgIWe14pv4SJ5BQhw6J0zIpCTFH4fVpzr9pRzM2tD8yf/3cspX3uyXTt4owiqtjoQ3aQGNnhWtVlmSwlgJrwu7KUaE9IPtlsENYDniAj2oJgejjx02d367pHtMB/9e3+4b2fWUsFNJgWw0ordiIT0p1lzHRdQ9ut4l/Yn/lkJs="
1010
- secure: "D3ASNRu32pV79lv/Nl0dBm2ldZiTgbb6boOrN0SzIKsQU3yBwedpqX6EI6KjpVg17lGhhhFXGzL2Gz1qjU3/+m6aMvekxHgpfuc0AlEFCEqenWPxIdDDrUkdfJoCvfQQPd5oxChfHgqaEDLjuqHy1ZEgnJ2/L/6dwZ4fUt62hMk="
11+
# pandas-docs-bot GH
12+
- secure: "PCzUFR8CHmw9lH84p4ygnojdF7Z8U5h7YfY0RyT+5K/aiQ1ZTU3ZkDTPI0/rR5FVMxsEEKEQKMcc5fvqW0PeD7Q2wRmluloKgT9w4EVEJ1ppKf7lITPcvZR2QgVOvjv4AfDtibLHFNiaSjzoqyJVjM4igjOu8WTlF3JfZcmOQjQ="
1113

1214
matrix:
1315
include:
@@ -30,6 +32,7 @@ matrix:
3032
- FULL_DEPS=true
3133
- CLIPBOARD_GUI=gtk2
3234
- JOB_NAME: "27_nslow" # ScatterCI Build name, 20 chars max
35+
- DOC_BUILD=true # if rst files were changed, build docs in parallel with tests
3336
- python: 3.2
3437
env:
3538
- NOSE_ARGS="not slow"
@@ -75,6 +78,7 @@ before_script:
7578
script:
7679
- echo "script"
7780
- ci/script.sh
81+
- if [ -f /tmp/doc.log ]; then cat /tmp/doc.log; fi
7882

7983
after_script:
8084
- ci/print_versions.py

ci/build_docs.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
4+
cd "$TRAVIS_BUILD_DIR"
5+
6+
git show --pretty="format:" --name-only HEAD~5.. --first-parent | grep -P "rst|txt|doc"
7+
8+
if [ "$?" != "0" ]; then
9+
echo "Skipping doc build, none were modified"
10+
# nope, skip docs build
11+
exit 0
12+
fi
13+
14+
15+
if [ x"$DOC_BUILD" != x"" ]; then
16+
# we're running network tests, let's build the docs in the meantim
17+
echo "Will build docs"
18+
pip install sphinx==1.1.3 ipython==1.1.0
19+
20+
mv "$TRAVIS_BUILD_DIR"/doc /tmp
21+
cd /tmp/doc
22+
23+
rm /tmp/doc/source/api.rst # no R
24+
rm /tmp/doc/source/r_interface.rst # no R
25+
26+
echo ############################### > /tmp/doc.log
27+
echo # Log file for the doc build # > /tmp/doc.log
28+
echo ############################### > /tmp/doc.log
29+
echo "" > /tmp/doc.log
30+
echo -e "y\n" | ./make.py --no-api 2>&1
31+
32+
cd /tmp/doc/build/html
33+
git config --global user.email "[email protected]"
34+
git config --global user.name "pandas-docs-bot"
35+
36+
git init
37+
touch README
38+
git add README
39+
git commit -m "Initial commit" --allow-empty
40+
git branch gh-pages
41+
git checkout gh-pages
42+
touch .nojekyll
43+
git add --all .
44+
git commit -m "Version" --allow-empty
45+
git remote add origin https://$GH_TOKEN@github.com/pandas-docs/pandas-docs-travis
46+
git push origin gh-pages -f
47+
fi
48+
49+
exit 0

ci/install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,6 @@ export PATH=/usr/lib/ccache:/usr/lib64/ccache:$PATH
9898
which gcc
9999
ccache -z
100100
time pip install $(find dist | grep gz | head -n 1)
101-
101+
# restore cython
102+
time pip install $PIP_ARGS $(cat ci/requirements-${wheel_box}.txt | grep -i cython)
102103
true

ci/ironcache/get.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,32 @@
99
import base64
1010
from hashlib import sha1
1111
from iron_cache import *
12+
import traceback as tb
1213

1314
key='KEY.%s.%s' %(os.environ.get('TRAVIS_REPO_SLUG','unk'),
1415
os.environ.get('JOB_NAME','unk'))
16+
print(key)
17+
1518
if sys.version_info[0] > 2:
16-
key = sha1(bytes(key,encoding='utf8')).hexdigest()[:8]+'.'
17-
else:
18-
key = sha1(key).hexdigest()[:8]+'.'
19+
key = bytes(key,encoding='utf8')
20+
21+
key = sha1(key).hexdigest()[:8]+'.'
1922

2023
b = b''
2124
cache = IronCache()
2225
for i in range(20):
2326
print("getting %s" % key+str(i))
2427
try:
2528
item = cache.get(cache="travis", key=key+str(i))
26-
b += bytes(base64.b64decode(item.value))
27-
except:
29+
v = item.value
30+
if sys.version_info[0] > 2:
31+
v = bytes(v,encoding='utf8')
32+
b += bytes(base64.b64decode(v))
33+
except Exception as e:
34+
try:
35+
print(tb.format_exc(e))
36+
except:
37+
print("exception during exception, oh my")
2838
break
2939

3040
with open(os.path.join(os.environ.get('HOME',''),"ccache.7z"),'wb') as f:

ci/ironcache/put.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@
1212

1313
key='KEY.%s.%s' %(os.environ.get('TRAVIS_REPO_SLUG','unk'),
1414
os.environ.get('JOB_NAME','unk'))
15+
16+
key='KEY.%s.%s' %(os.environ.get('TRAVIS_REPO_SLUG','unk'),
17+
os.environ.get('JOB_NAME','unk'))
18+
print(key)
19+
1520
if sys.version_info[0] > 2:
16-
key = sha1(bytes(key,encoding='utf8')).hexdigest()[:8]+'.'
17-
else:
18-
key = sha1(key).hexdigest()[:8]+'.'
21+
key = bytes(key,encoding='utf8')
22+
23+
key = sha1(key).hexdigest()[:8]+'.'
1924

2025
os.chdir(os.environ.get('HOME'))
2126

ci/script.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,13 @@ if [ -n "$LOCALE_OVERRIDE" ]; then
1212
cd "$curdir"
1313
fi
1414

15+
# conditionally build and upload docs to GH/pandas-docs/pandas-docs/travis
16+
"$TRAVIS_BUILD_DIR"/ci/build_docs.sh 2>&1 > /tmp/doc.log &
17+
# doc build log will be shown after tests
18+
1519
echo nosetests -v --exe -w /tmp -A "$NOSE_ARGS" pandas --with-xunit --xunit-file=/tmp/nosetests.xml
1620
nosetests -v --exe -w /tmp -A "$NOSE_ARGS" pandas --with-xunit --xunit-file=/tmp/nosetests.xml
21+
22+
23+
# wait until subprocesses finish (build_docs.sh)
24+
wait

0 commit comments

Comments
 (0)