Fixed travis

This commit is contained in:
Syrus Akbary 2016-08-06 19:28:09 -07:00
parent 05a48c634d
commit 05144487ce
2 changed files with 7 additions and 46 deletions

1
.gitignore vendored
View File

@ -78,3 +78,4 @@ target/
# Databases # Databases
*.sqlite3 *.sqlite3
.vscode

View File

@ -9,62 +9,24 @@ cache:
directories: directories:
- .cache/pip/ - .cache/pip/
- $HOME/.cache/pip - $HOME/.cache/pip
- docs/node_modules/
- $HOME/docs/node_modules
before_install:
- |
git_diff=$(git diff --name-only $TRAVIS_COMMIT_RANGE)
if [ "$?" == 0 ] && [ "$TEST_TYPE" != build_website ] && \
! echo "$git_diff" | grep -qvE '(\.md$)|(^(docs))/'
then
echo "Only docs were updated, stopping build process."
exit
fi
install: install:
- | - |
if [ "$TEST_TYPE" = build ]; then if [ "$TEST_TYPE" = build ]; then
pip install --download-cache $HOME/.cache/pip/ pytest pytest-cov coveralls six pip install pytest pytest-cov coveralls six
pip install --download-cache $HOME/.cache/pip psycopg2 > /dev/null 2>&1 pip install psycopg2 > /dev/null 2>&1
pip install --download-cache $HOME/.cache/pip/ -e . pip install -e .
python setup.py develop
elif [ "$TEST_TYPE" = build_website ]; then
pip install --download-cache $HOME/.cache/pip/ -e .
python setup.py develop python setup.py develop
elif [ "$TEST_TYPE" = lint ]; then elif [ "$TEST_TYPE" = lint ]; then
pip install --download-cache $HOME/.cache/pip/ flake8 pip install flake8
fi fi
script: script:
- | - |
if [ "$TEST_TYPE" = build_website ]; then if [ "$TEST_TYPE" = lint ]; then
if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then
echo "Building the web."
nvm install 4.0
GH_PAGES_DIR="$TRAVIS_BUILD_DIR"/docs/public
git config --global user.name "Travis CI"
git config --global user.email "travis@graphene-python.org"
git clone --branch gh-pages --depth=50 \
https://graphql-python-bot@github.com/graphql-python/graphene.git \
$GH_PAGES_DIR
cd docs
./playground/graphene-js/build.sh
npm run deploy
cd $GH_PAGES_DIR
git status
git add --intent-to-add .
if ! git diff-index --quiet HEAD --; then
git add -A .
git commit -m "Rebuild website"
git push "https://${GITHUB_TOKEN}@github.com/graphql-python/graphene.git" gh-pages
fi
exit
fi
elif [ "$TEST_TYPE" = lint ]; then
echo "Checking Python code lint." echo "Checking Python code lint."
flake8 flake8
exit exit
elif [ "$TEST_TYPE" = build ]; then elif [ "$TEST_TYPE" = build ]; then
py.test graphene examples --cov=graphene py.test --cov=graphene
fi fi
after_success: after_success:
- | - |
@ -79,7 +41,5 @@ env:
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
- python: '2.7'
env: TEST_TYPE=build_website
- python: '2.7' - python: '2.7'
env: TEST_TYPE=lint env: TEST_TYPE=lint