Skip to content

Commit

Permalink
Merge pull request #486 from denar90/grunt-psi
Browse files Browse the repository at this point in the history
Make PageSpeed Insights part of CI
Thanks to @denar90
  • Loading branch information
peterblazejewicz committed Nov 29, 2016
2 parents cec240d + 61fddbc commit e0b410d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
7 changes: 6 additions & 1 deletion grunt/aliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,10 @@ module.exports = {
'compile-docs',
'compile-annotated-src',
'compile-downloads'
],

'pagespeed': [
'psiNgrok',
'connect:server:keepalive'
]
}
};
4 changes: 4 additions & 0 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ module.exports = function(grunt) {
output: 'dist/data'
}
}
},

psiNgrok: {
marionette: {}
}
});
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"compile-docs": "grunt dev-docs",
"compile-all": "grunt compile-all",
"compile-downloads": "grunt compile-downloads",
"pagespeed": "grunt pagespeed",
"deploy": "./ship.sh",
"setup": "./setup.sh",
"lint": "grunt lint",
Expand Down Expand Up @@ -68,6 +69,7 @@
"load-grunt-tasks": "^0.6.0",
"marked": "^0.3.2",
"mkdirp": "^0.5.0",
"psi-ngrok": "^0.1.0",
"semver": "^4.2.0",
"underscore": "^1.6.0"
}
Expand Down
25 changes: 25 additions & 0 deletions tasks/psi-ngrok.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var psiNgrok = require('psi-ngrok');

module.exports = function(grunt) {
grunt.registerMultiTask('psiNgrok', function() {
var async = this.async;

grunt.event.once('connect.server.listening', function(host, port) {
psiNgrok({
pages: ['/', 'additional-resources', 'downloads', 'docs/current', 'updates'],
onError: function(error) {
grunt.fatal(error)
},
port: port,
options: {
//@todo up it to 85-90 when pages speed will be fixed
threshold: 10
}
}).then(function() {
var done = async();

done();
});
});
});
};
2 changes: 1 addition & 1 deletion travis-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ then
git commit -m "deploy"
git push --force --quiet "https://${GH_TOKEN}@github.com/marionettejs/marionettejs.com.git" master:gh-pages > /dev/null 2>&1
else
npm run lint && npm run test
npm run lint && npm run test && npm run pagespeed
fi

0 comments on commit e0b410d

Please sign in to comment.