Improved travis deploy to build in a branch

This commit is contained in:
Syrus Akbary 2015-11-25 18:35:13 -08:00
parent 1345ea873a
commit e55d230faf
12 changed files with 91 additions and 33 deletions

View File

@ -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

View File

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 372 B

View File

Before

Width:  |  Height:  |  Size: 688 B

After

Width:  |  Height:  |  Size: 688 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -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

View File

@ -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;
};

View File

@ -11,7 +11,7 @@ export default class Html extends React.Component {
<meta httpEquiv="X-UA-Compatible" content="IE=edge"/>
<meta name='viewport' content='width=device-width, initial-scale=1.0 maximum-scale=1.0'/>
<title>{title}</title>
<link rel="shortcut icon" href={this.props.favicon}/>
<link rel="shortcut icon" href="/favicon.png"/>
<link href='https://fonts.googleapis.com/css?family=Raleway:400,600,200,100' rel='stylesheet' type='text/css' />
<link href='/app.css' rel='stylesheet' type='text/css' />
</head>

View File

@ -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",

10
docs/patched-react.js Normal file
View File

@ -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');

1
docs/static/CNAME vendored Normal file
View File

@ -0,0 +1 @@
graphene-python.org

BIN
docs/static/favicon.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB