ci: use `sudo: false` on Travis (#21641)
Related to #21422. PR Close #21641
This commit is contained in:
parent
b2e902deb4
commit
8e8924ac7c
|
@ -1,7 +1,5 @@
|
|||
language: node_js
|
||||
# Work-around for https://github.com/travis-ci/travis-ci/issues/8836#issuecomment-356362524.
|
||||
# (Restore `sudo: false` once that is resolved.)
|
||||
sudo: required
|
||||
sudo: false
|
||||
dist: trusty
|
||||
node_js:
|
||||
- '8.9.1'
|
||||
|
|
|
@ -30,8 +30,14 @@ module.exports = function (config) {
|
|||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
browsers: ['CustomChrome'],
|
||||
browserNoActivityTimeout: 60000,
|
||||
singleRun: false
|
||||
singleRun: false,
|
||||
customLaunchers: {
|
||||
CustomChrome: {
|
||||
base: 'Chrome',
|
||||
flags: process.env.TRAVIS && ['--no-sandbox']
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -12,7 +12,8 @@ exports.config = {
|
|||
browserName: 'chrome',
|
||||
// For Travis
|
||||
chromeOptions: {
|
||||
binary: process.env.CHROME_BIN
|
||||
binary: process.env.CHROME_BIN,
|
||||
args: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
|
|
|
@ -17,11 +17,15 @@ const printer = require('lighthouse/lighthouse-cli/printer');
|
|||
const config = require('lighthouse/lighthouse-core/config/default.js');
|
||||
|
||||
// Constants
|
||||
const CHROME_LAUNCH_OPTS = {};
|
||||
const SKIPPED_HTTPS_AUDITS = ['redirects-http'];
|
||||
const VIEWER_URL = 'https://googlechrome.github.io/lighthouse/viewer/';
|
||||
|
||||
// Specify the path to Chrome on Travis
|
||||
|
||||
// Specify the path and flags for Chrome on Travis
|
||||
if (process.env.TRAVIS) {
|
||||
process.env.LIGHTHOUSE_CHROMIUM_PATH = process.env.CHROME_BIN;
|
||||
CHROME_LAUNCH_OPTS.chromeFlags = ['--no-sandbox'];
|
||||
}
|
||||
|
||||
// Run
|
||||
|
@ -54,18 +58,8 @@ function evaluateScore(expectedScore, actualScore) {
|
|||
}
|
||||
}
|
||||
|
||||
function skipHttpsAudits(config) {
|
||||
const httpsAudits = [
|
||||
'redirects-http'
|
||||
];
|
||||
|
||||
console.info(`Skipping HTTPS-related audits (${httpsAudits.join(', ')})...`);
|
||||
|
||||
config.settings.skipAudits = httpsAudits;
|
||||
}
|
||||
|
||||
function launchChromeAndRunLighthouse(url, flags, config) {
|
||||
return chromeLauncher.launch().then(chrome => {
|
||||
return chromeLauncher.launch(CHROME_LAUNCH_OPTS).then(chrome => {
|
||||
flags.port = chrome.port;
|
||||
return lighthouse(url, flags, config).
|
||||
then(results => chrome.kill().then(() => results)).
|
||||
|
@ -108,3 +102,8 @@ function processResults(results, logFile) {
|
|||
|
||||
return promise.then(() => Math.round(results.score));
|
||||
}
|
||||
|
||||
function skipHttpsAudits(config) {
|
||||
console.info(`Skipping HTTPS-related audits (${SKIPPED_HTTPS_AUDITS.join(', ')})...`);
|
||||
config.settings.skipAudits = SKIPPED_HTTPS_AUDITS;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@ exports.config = {
|
|||
'browserName': 'chrome',
|
||||
// For Travis CI only
|
||||
chromeOptions: {
|
||||
binary: process.env.CHROME_BIN
|
||||
binary: process.env.CHROME_BIN,
|
||||
args: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
|
|
|
@ -23,7 +23,8 @@ exports.config = {
|
|||
'browserName': 'chrome',
|
||||
// For Travis
|
||||
chromeOptions: {
|
||||
binary: process.env.CHROME_BIN
|
||||
binary: process.env.CHROME_BIN,
|
||||
args: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue