From 2574ee2976a44ce36b65382bed1e96ddef2e879b Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Wed, 25 Nov 2015 21:00:13 -0800 Subject: [PATCH] Added before install to travis for stopping build if only docs changed --- .travis.yml | 27 ++++++++++++++++++--------- docs/package.json | 3 ++- docs/pages/_header.js | 1 - docs/patched-react.js | 1 - 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index c1827fdb..48fd46be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,19 +12,27 @@ cache: - $HOME/.cache/pip - docs/node_modules/ - $HOME/docs/node_modules - - $(npm config get prefix)/bin/gatsby +before_install: +- | + if [ "$TEST_TYPE" != build_website ] && \ + ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs))/' + then + echo "Only docs were updated, stopping build process." + exit + fi install: - | if [ "$TEST_TYPE" = build ]; then - pip install --download-cache $HOME/.cache/pip/ pytest pytest-cov coveralls six pytest-django - pip install --download-cache $HOME/.cache/pip/ -e .[django] - python setup.py develop + pip install --download-cache $HOME/.cache/pip/ pytest pytest-cov coveralls six pytest-django + pip install --download-cache $HOME/.cache/pip/ -e .[django] + python setup.py develop elif [ "$TEST_TYPE" = lint ]; then - pip install --download-cache $HOME/.cache/pip/ flake8 + pip install --download-cache $HOME/.cache/pip/ flake8 fi script: - | if [ "$TEST_TYPE" = build_website ]; then + if [ "$TRAVIS_BRANCH" = "docs" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then echo "Building the web." nvm install 4.0 @@ -44,12 +52,13 @@ script: git push "https://${GITHUB_TOKEN}@github.com/graphql-python/graphene.git" gh-pages-seg fi exit + fi elif [ "$TEST_TYPE" = lint ]; then - echo "Checking Python code lint." - flake8 - exit + echo "Checking Python code lint." + flake8 + exit elif [ "$TEST_TYPE" = build ]; then - py.test --cov=graphene + py.test --cov=graphene fi after_success: - | diff --git a/docs/package.json b/docs/package.json index 79172095..207603ea 100644 --- a/docs/package.json +++ b/docs/package.json @@ -5,7 +5,7 @@ "main": "n/a", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "npm install -g gatsby && npm install && gatsby build", + "build": "npm install && ./node_modules/.bin/gatsby build", "deploy": "npm run build" }, "keywords": [ @@ -15,6 +15,7 @@ "dependencies": { "copy-webpack-plugin": "^0.2.0", "extract-text-webpack-plugin": "^0.9.1", + "gatsby": "^0.7.2", "jeet": "^6.1.2", "lodash": "^3.10.1", "nib": "^1.1.0", diff --git a/docs/pages/_header.js b/docs/pages/_header.js index 845a081d..7fca1af6 100644 --- a/docs/pages/_header.js +++ b/docs/pages/_header.js @@ -6,7 +6,6 @@ if (IN_BROWSER) { navigator.userAgent && !navigator.userAgent.match('CriOS'); var browser_supported = !isSafari; } -console.log(browser_supported); if (IN_BROWSER && browser_supported) { var glfx = require('../vendor/glfx.optim') var particlesJS = require('../vendor/particles.js') diff --git a/docs/patched-react.js b/docs/patched-react.js index 8b05d3e1..d8253895 100644 --- a/docs/patched-react.js +++ b/docs/patched-react.js @@ -1,7 +1,6 @@ // React patched version for render in server side always with same ids if (typeof window === "undefined") { var ServerReactRootIndex = require('react/lib/ServerReactRootIndex'); - console.log(ServerReactRootIndex); ServerReactRootIndex.createReactRootIndex = function(){ return "graphene"; };