Skip to content

Commit 6d6606d

Browse files
Merge pull request #299 from watson-developer-cloud/codecov
Update codecov and sphinx script
2 parents d8bc4ea + 8e006ce commit 6d6606d

3 files changed

Lines changed: 38 additions & 37 deletions

File tree

.travis.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
language: python
22
sudo: false
3-
43
python:
54
- '2.7'
65
- '3.4'
76
- '3.5'
87
- '3.6'
9-
108
cache: pip
11-
129
before_install:
1310
- openssl aes-256-cbc -K $encrypted_6e98b3e8e789_key -iv $encrypted_6e98b3e8e789_iv
1411
-in .env.enc -out .env -d
15-
1612
install: pip install tox-travis
1713
script: tox
18-
19-
after_success:
20-
- codecov
21-
- docs/publish.sh
14+
before_deploy:
15+
- pip install -r requirements-dev.txt
16+
- pip install --editable .
17+
deploy:
18+
provider: script
19+
script: docs/publish.sh
20+
skip_cleanup: true
21+
on:
22+
python: '2.7'
23+
all_branches: true

docs/publish.sh

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,30 @@
22
# checking the build/job numbers allows it to only
33
# publish once even though we test against multiple python versions
44

5-
cd $(dirname $0)
6-
7-
if [ "$TRAVIS_REPO_SLUG" == "watson-developer-cloud/python-sdk" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" ] && [ "$TRAVIS_BUILD_NUMBER.1" == "$TRAVIS_JOB_NUMBER" ]; then
8-
9-
echo "Create Docs"
10-
make document
11-
echo "Publishing Docs..."
5+
[[ -z "$TRAVIS_BRANCH" ]] && { echo "TRAVIS_BRANCH cannot be null" ; exit 1; }
6+
[[ -z "$GH_TOKEN" ]] && { echo "GH_TOKEN cannot be null" ; exit 1; }
127

13-
git config --global user.email "travis@travis-ci.org"
14-
git config --global user.name "travis-ci"
15-
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/watson-developer-cloud/python-sdk.git gh-pages > /dev/null
16-
17-
pushd gh-pages
18-
# on tagged builds, $TRAVIS_BRANCH is the tag (e.g. v1.2.3), otherwise it's the branch name (e.g. master)
19-
rm -rf $TRAVIS_BRANCH
20-
cp -Rf ../_build/html/ $TRAVIS_BRANCH
21-
../generate_index_html.sh > index.html
8+
cd $(dirname $0)
9+
pwd
2210

23-
git add -f .
24-
git commit -m "Docs for $TRAVIS_BRANCH ($TRAVIS_COMMIT)"
25-
git push -fq origin gh-pages > /dev/null
11+
echo "Create Docs"
12+
make document
13+
echo "Publishing Docs..."
2614

27-
popd
15+
git config --global user.email "travis@travis-ci.org"
16+
git config --global user.name "travis-ci"
17+
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/watson-developer-cloud/python-sdk.git gh-pages > /dev/null
2818

29-
echo -e "Published Docs for $TRAVIS_BRANCH to gh-pages.\n"
19+
pushd gh-pages
20+
# on tagged builds, $TRAVIS_BRANCH is the tag (e.g. v1.2.3), otherwise it's the branch name (e.g. master)
21+
rm -rf $TRAVIS_BRANCH
22+
cp -Rf ../_build/html/ $TRAVIS_BRANCH
23+
../generate_index_html.sh > index.html
3024

31-
else
25+
git add -f .
26+
git commit -m "Docs for $TRAVIS_BRANCH ($TRAVIS_COMMIT)"
27+
git push -fq origin gh-pages > /dev/null
28+
popd
3229

33-
echo -e "Not publishing docs for build $TRAVIS_BUILD_NUMBER ($TRAVIS_JOB_NUMBER) on branch $TRAVIS_BRANCH of repo $TRAVIS_REPO_SLUG"
30+
echo -e "Published Docs for $TRAVIS_BRANCH to gh-pages.\n"
3431

35-
fi

tox.ini

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
envlist = lint, py27, py34, py35, py36
33

44
[testenv:lint]
5-
basepython=python2.7
6-
deps=pylint
7-
commands=pylint watson_developer_cloud
5+
basepython = python2.7
6+
deps = pylint
7+
commands = pylint watson_developer_cloud
88

99
[testenv]
10-
commands = py.test --rerun 5 --cov=watson_developer_cloud
10+
passenv = TOXENV CI TRAVIS*
11+
commands =
12+
py.test --rerun 5 --cov=watson_developer_cloud
13+
codecov -e TOXENV
1114
deps =
1215
-r{toxinidir}/requirements.txt
1316
-r{toxinidir}/requirements-dev.txt
14-
exclude = .venv,.git,.tox,docs
17+
exclude = .venv,.git,.tox,docs

0 commit comments

Comments
 (0)