From e55d230faf9d0dcf54df5f216794da84262b6222 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Wed, 25 Nov 2015 18:35:13 -0800 Subject: [PATCH] Improved travis deploy to build in a branch --- .travis.yml | 79 +++++++++++------- docs/{assets => css/images}/edit.png | Bin docs/{assets => css/images}/edit@2x.png | Bin docs/{assets => css/images}/starwars-icon.png | Bin .../images}/starwars-icon@2x.png | Bin docs/css/main.styl | 4 +- docs/gatsby.config.js | 26 ++++++ docs/html.js | 2 +- docs/package.json | 2 + docs/patched-react.js | 10 +++ docs/static/CNAME | 1 + docs/static/favicon.png | Bin 0 -> 1451 bytes 12 files changed, 91 insertions(+), 33 deletions(-) rename docs/{assets => css/images}/edit.png (100%) rename docs/{assets => css/images}/edit@2x.png (100%) rename docs/{assets => css/images}/starwars-icon.png (100%) rename docs/{assets => css/images}/starwars-icon@2x.png (100%) create mode 100644 docs/patched-react.js create mode 100644 docs/static/CNAME create mode 100644 docs/static/favicon.png diff --git a/.travis.yml b/.travis.yml index 0e3b1f10..c1827fdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,44 +8,63 @@ python: - pypy cache: directories: - - .cache/pip/ - - $HOME/.cache/pip - - docs/node_modules/ - - $HOME/docs/node_modules + - .cache/pip/ + - $HOME/.cache/pip + - docs/node_modules/ + - $HOME/docs/node_modules + - $(npm config get prefix)/bin/gatsby 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 - elif [ "$TEST_TYPE" = lint ]; then - pip install --download-cache $HOME/.cache/pip/ flake8 - fi + 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 + elif [ "$TEST_TYPE" = lint ]; then + pip install --download-cache $HOME/.cache/pip/ flake8 + fi script: - | - if [ "$TEST_TYPE" = build_website ]; then - echo "Building the web." - nvm install 4.1 && cd docs && npm run deploy - exit - elif [ "$TEST_TYPE" = lint ]; then - echo "Checking Python code lint." - flake8 - exit - elif [ "$TEST_TYPE" = build ]; then - py.test --cov=graphene - fi + if [ "$TEST_TYPE" = build_website ]; 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-seg --depth=50 \ + https://graphql-python-bot@github.com/graphql-python/graphene.git \ + $GH_PAGES_DIR + cd docs + npm run build + cd $GH_PAGES_DIR + git status + 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-seg + fi + exit + elif [ "$TEST_TYPE" = lint ]; then + echo "Checking Python code lint." + flake8 + exit + elif [ "$TEST_TYPE" = build ]; then + py.test --cov=graphene + fi after_success: - | - if [ "$TEST_TYPE" = build ]; then - coveralls - fi + if [ "$TEST_TYPE" = build ]; then + coveralls + fi env: + matrix: - TEST_TYPE=build + global: + secure: SQC0eCWCWw8bZxbLE8vQn+UjJOp3Z1m779s9SMK3lCLwJxro/VCLBZ7hj4xsrq1MtcFO2U2Kqf068symw4Hr/0amYI3HFTCFiwXAC3PAKXeURca03eNO2heku+FtnQcOjBanExTsIBQRLDXMOaUkf3MIztpLJ4LHqMfUupKmw9YSB0v40jDbSN8khBnndFykmOnVVHznFp8USoN5F0CiPpnfEvHnJkaX76lNf7Kc9XNShBTTtJsnsHMhuYQeInt0vg9HSjoIYC38Tv2hmMj1myNdzyrHF+LgRjI6ceGi50ApAnGepXC/DNRhXROfECKez+LON/ZSqBGdJhUILqC8A4WmWmIjNcwitVFp3JGBqO7LULS0BI96EtSLe8rD1rkkdTbjivajkbykM1Q0Tnmg1adzGwLxRUbTq9tJQlTTkHBCuXIkpKb1mAtb/TY7A6BqfnPi2xTc/++qEawUG7ePhscdTj0IBrUfZsUNUYZqD8E8XbSWKIuS3SHE+cZ+s/kdAsm4q+FFAlpZKOYGxIkwvgyfu4/Plfol4b7X6iAP9J3r1Kv0DgBVFst5CXEwzZs19/g0CgokQbCXf1N+xeNnUELl6/fImaR3RKP22EaABoil4z8vzl4EqxqVoH1nfhE+WlpryXsuSaF/1R+WklR7aQ1FwoCk8V8HxM2zrj4tI8k= matrix: fast_finish: true include: - - python: "2.7" - env: TEST_TYPE=build_website - secure: e0iu1FvUcGNcsKEDsGQiGTJZMJ8tJMAQ+c+KCuh7I11likoJbninI9FX85efMglG93Xu4GtND1rUwKWnANM94Cz5IrLrT9ga62Cg1sinbzD+JUOG9EobtmcYcLbfNvA1ybkZf4K0KvkYfH1XUxtL3v6jFI6lLjZ1vKa2M6i5t/38pjgUOOh9KlVGi+rqSp2TUsCyjZkMxE2Wwceen5N/B1yZJDn9yHPA+kiV2ScOMgZOuVMqQd0IAPcjhqTbNdaW2VjNQFtS8CQ8FOjJh9NepRAyA42oII7Aq65YzZbifzYL1eSPKKfUHHdc7Bs+vq1kGuaWz+XBqByZAQvw7OtpkecG+KrcO7XDV38y6z33vgCC5MPu9e0BZwITIvyuUOKmFA9vTAx/w963vBDSzHgskgqYtYswxzOoE55TS9tHsc5rgoSatEGW2VXyI8ytWpgkuluCNwT+/ZvNaQ33SCPTwN7mQGWx+DC+eyMBjI1sP9s4aYCaTggCSFNtwhRpQqqM/0HFa7hHDksK/zJhl4fhFUrbmyrJo6wm6Z7/s/WiSulk+zZkrLC9eBs1+XNtU7PzcmgfFmcsJnPGBmBF8WOa8WiX9hOn9DutBT4mLtlOod3YvU22U0Vwj2TjzhDvx8uyYCpDA03a/q9QjE4+klcI2Mw5UNhJsmTpCZQE06aHDKg= - - python: "2.7" - env: TEST_TYPE=lint + - python: '2.7' + env: TEST_TYPE=build_website + - python: '2.7' + env: TEST_TYPE=lint diff --git a/docs/assets/edit.png b/docs/css/images/edit.png similarity index 100% rename from docs/assets/edit.png rename to docs/css/images/edit.png diff --git a/docs/assets/edit@2x.png b/docs/css/images/edit@2x.png similarity index 100% rename from docs/assets/edit@2x.png rename to docs/css/images/edit@2x.png diff --git a/docs/assets/starwars-icon.png b/docs/css/images/starwars-icon.png similarity index 100% rename from docs/assets/starwars-icon.png rename to docs/css/images/starwars-icon.png diff --git a/docs/assets/starwars-icon@2x.png b/docs/css/images/starwars-icon@2x.png similarity index 100% rename from docs/assets/starwars-icon@2x.png rename to docs/css/images/starwars-icon@2x.png diff --git a/docs/css/main.styl b/docs/css/main.styl index 31049be9..e982b922 100644 --- a/docs/css/main.styl +++ b/docs/css/main.styl @@ -198,7 +198,7 @@ html, body top 20px height 32px width 32px - image '~!file-loader!../assets/starwars-icon.png' 32px 32px + // image 'images/starwars-icon.png' 32px 32px &:hover transform translateY(-3px) @@ -230,7 +230,7 @@ html, body top 8px height 16px width 16px - image '~!file-loader!../assets/edit.png' 16px 16px + // image 'images/edit.png' 16px 16px &:hover transform: rotate(270deg) translateX(100%) background #666 diff --git a/docs/gatsby.config.js b/docs/gatsby.config.js index 8aa39cdf..bbfddb16 100644 --- a/docs/gatsby.config.js +++ b/docs/gatsby.config.js @@ -1,18 +1,38 @@ var nib = require("nib"); var jeet = require("jeet"); var rupture = require("rupture"); +var path = require("path"); var ExtractTextPlugin = require("extract-text-webpack-plugin"); +var CopyWebpackPlugin = require('copy-webpack-plugin'); module.exports = function(config, env) { var IS_STATIC = env === 'static'; config.merge({ stylus: { use: [nib(), jeet(), rupture()] + }, + resolveLoader: { + root: path.join(__dirname, "node_modules"), + modulesDirectories: ['./'], + alias: { + 'copy': 'file-loader?name=[path][name].[ext]&context=./static', + } + }, + resolve: { + root: path.join(__dirname, "node_modules"), + alias: { + 'original-react': path.join(__dirname, "node_modules", "react"), + 'react/lib': path.join(__dirname, "node_modules", "react", "lib"), + 'react': path.join(__dirname, 'patched-react.js') + }, + modulesDirectories: ['./'] } }); if (IS_STATIC) { config.plugin('extract-css', ExtractTextPlugin, ["app.css"]); } + config.plugin('static', CopyWebpackPlugin, [[{ from: '../static'}]]); + config.loader('stylus', function(cfg) { cfg.test = /\.styl$/; if (IS_STATIC) { @@ -23,5 +43,11 @@ module.exports = function(config, env) { } return cfg }); + config.removeLoader('png'); + config.loader('png', function(cfg) { + cfg.test = /\.png$/; + cfg.loader = 'file-loader' + return cfg + }) return config; }; diff --git a/docs/html.js b/docs/html.js index e93eda04..0b96a36d 100644 --- a/docs/html.js +++ b/docs/html.js @@ -11,7 +11,7 @@ export default class Html extends React.Component { {title} - + diff --git a/docs/package.json b/docs/package.json index 79e04946..79172095 100644 --- a/docs/package.json +++ b/docs/package.json @@ -13,8 +13,10 @@ ], "license": "MIT", "dependencies": { + "copy-webpack-plugin": "^0.2.0", "extract-text-webpack-plugin": "^0.9.1", "jeet": "^6.1.2", + "lodash": "^3.10.1", "nib": "^1.1.0", "react": "^0.14.3", "react-document-title": "^2.0.1", diff --git a/docs/patched-react.js b/docs/patched-react.js new file mode 100644 index 00000000..8b05d3e1 --- /dev/null +++ b/docs/patched-react.js @@ -0,0 +1,10 @@ +// 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"; + }; +} + +module.exports = require('original-react'); diff --git a/docs/static/CNAME b/docs/static/CNAME new file mode 100644 index 00000000..3e3b78e4 --- /dev/null +++ b/docs/static/CNAME @@ -0,0 +1 @@ +graphene-python.org \ No newline at end of file diff --git a/docs/static/favicon.png b/docs/static/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..aad799666d30ae5f25c53828c7e1982fed5a41a9 GIT binary patch literal 1451 zcmV;c1yuTpP)STp?49E` z7cR>_xZO*cWbe$J_ndR)oLLg{7~!glTsTt;p@k#|w^}9E`$JTglYOqEs1KMoFx4jiXG%NUx4krM_})fMhOBCSH+p zElbNWk_k%&>k0UZ3?Z8kw32u{v$$=NIvNj8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