revert: ci: use chrome stable (#18307)

This reverts commit 8bcb268140.
This commit is contained in:
Filipe Silva 2017-10-19 19:15:44 +01:00 committed by Alex Rickabaugh
parent 230b98d4dd
commit 820bb7bd8c
6 changed files with 111 additions and 8 deletions

View File

@ -1,12 +1,10 @@
language: node_js
sudo: false
# force trusty as Google Chrome addon is not supported on Precise
dist: trusty
node_js:
- '6.9.5'
addons:
chrome: stable
# firefox: "38.0"
apt:
sources:

View File

@ -19,6 +19,11 @@ const config = require('lighthouse/lighthouse-core/config/default.js');
// Constants
const VIEWER_URL = 'https://googlechrome.github.io/lighthouse/viewer/';
// Specify the path to Chrome on Travis
if (process.env.TRAVIS) {
process.env.LIGHTHOUSE_CHROMIUM_PATH = process.env.CHROME_BIN;
}
// Run
_main(process.argv.slice(2));

View File

@ -20,7 +20,11 @@ exports.config = {
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
'browserName': 'chrome',
// For Travis
chromeOptions: {
binary: process.env.CHROME_BIN
}
},
// Framework to use. Jasmine is recommended.

View File

@ -36,6 +36,7 @@ fi
setEnvVar NODE_VERSION 6.9.5
setEnvVar YARN_VERSION 1.0.2
setEnvVar CHROMIUM_VERSION 499098 # Chrome 62 linux stable, see https://www.chromium.org/developers/calendar
setEnvVar BAZEL_VERSION 0.5.4
setEnvVar SAUCE_CONNECT_VERSION 4.4.9
setEnvVar ANGULAR_CLI_VERSION 1.4.0-rc.2
@ -103,6 +104,7 @@ if [[ ${TRAVIS:-} ]]; then
setEnvVar BROWSER_STACK_USERNAME angularteam1
# not using use setEnvVar so that we don't print the key
export BROWSER_STACK_ACCESS_KEY=BWCd4SynLzdDcv8xtzsB
setEnvVar CHROME_BIN ${HOME}/.chrome/chromium/chrome-linux/chrome
setEnvVar BROWSER_PROVIDER_READY_FILE /tmp/angular-build/browser-provider-tunnel-init.lock
fi

84
scripts/ci/install-chromium.sh Executable file
View File

@ -0,0 +1,84 @@
#!/usr/bin/env bash
set -u -e -o pipefail
# Setup environment
readonly thisDir=$(cd $(dirname $0); pwd)
source ${thisDir}/_travis-fold.sh
# This script basically follows the instructions to download an old version of Chromium: https://www.chromium.org/getting-involved/download-chromium
# 1) It retrieves the current stable version number from https://www.chromium.org/developers/calendar (via the https://omahaproxy.appspot.com/all file), e.g. 359700 for Chromium 48.
# 2) It checks the Travis cache for this specific version
# 3) If not available, it downloads and caches it, using the "decrement commit number" trick.
#Build version read from the OmahaProxy CSV Viewer at https://www.chromium.org/developers/calendar
#Let's use the following version of Chromium, and inform about availability of newer build from https://omahaproxy.appspot.com/all
#
# CHROMIUM_VERSION <<< this variable is now set via env.sh
PLATFORM="$(uname -s)"
case "$PLATFORM" in
(Darwin)
ARCHITECTURE=Mac
DIST_FILE=chrome-mac.zip
;;
(Linux)
ARCHITECTURE=Linux_x64
DIST_FILE=chrome-linux.zip
;;
(*)
echo Unsupported platform $PLATFORM. Exiting ... >&2
exit 3
;;
esac
TMP=$(curl -s "https://omahaproxy.appspot.com/all") || true
oldIFS="$IFS"
IFS='
'
IFS=${IFS:0:1}
lines=( $TMP )
IFS=','
for line in "${lines[@]}"
do
lineArray=($line);
if [ "${lineArray[0]}" = "linux" ] && [ "${lineArray[1]}" = "stable" ] ; then
LATEST_CHROMIUM_VERSION="${lineArray[7]}"
fi
done
IFS="$oldIFS"
CHROMIUM_DIR=$HOME/.chrome/chromium
CHROMIUM_BIN=$CHROMIUM_DIR/chrome-linux/chrome
CHROMIUM_VERSION_FILE=$CHROMIUM_DIR/VERSION
EXISTING_VERSION=""
if [[ -f $CHROMIUM_VERSION_FILE && -x $CHROMIUM_BIN ]]; then
EXISTING_VERSION=`cat $CHROMIUM_VERSION_FILE`
echo Found cached Chromium version: ${EXISTING_VERSION}
fi
if [[ "$EXISTING_VERSION" != "$CHROMIUM_VERSION" ]]; then
echo Downloading Chromium version: ${CHROMIUM_VERSION}
rm -fR $CHROMIUM_DIR
mkdir -p $CHROMIUM_DIR
NEXT=$CHROMIUM_VERSION
FILE="chrome-linux.zip"
STATUS=404
while [[ $STATUS == 404 && $NEXT -ge 0 ]]
do
echo Fetch Chromium version: ${NEXT}
STATUS=$(curl "https://storage.googleapis.com/chromium-browser-snapshots/${ARCHITECTURE}/${NEXT}/${DIST_FILE}" -s -w %{http_code} --create-dirs -o $FILE) || true
NEXT=$[$NEXT-1]
done
unzip $FILE -d $CHROMIUM_DIR
rm $FILE
echo $CHROMIUM_VERSION > $CHROMIUM_VERSION_FILE
fi
if [[ "$CHROMIUM_VERSION" != "$LATEST_CHROMIUM_VERSION" ]]; then
echo "New version of Chromium available. Update install-chromium.sh with build number: ${LATEST_CHROMIUM_VERSION}"
fi

View File

@ -72,11 +72,21 @@ if [[ ${TRAVIS} && (${CI_MODE} == "bazel" || ${CI_MODE} == "e2e_2") ]]; then
travisFoldEnd "bazel-install"
fi
# Start xvfb for local Chrome testing
if [[ ${TRAVIS} && (${CI_MODE} == "js" || ${CI_MODE} == "e2e" || ${CI_MODE} == "e2e_2" || ${CI_MODE} == "aio" || ${CI_MODE} == "aio_e2e") ]]; then
travisFoldStart "xvfb-start"
sh -e /etc/init.d/xvfb start
travisFoldEnd "xvfb-start"
# Install Chromium
if [[ ${TRAVIS} && ${CI_MODE} == "js" || ${CI_MODE} == "e2e" || ${CI_MODE} == "e2e_2" || ${CI_MODE} == "aio" || ${CI_MODE} == "aio_e2e" ]]; then
travisFoldStart "install-chromium"
(
${thisDir}/install-chromium.sh
# Start xvfb for local Chrome used for testing
if [[ ${TRAVIS} ]]; then
travisFoldStart "install-chromium.xvfb-start"
sh -e /etc/init.d/xvfb start
travisFoldEnd "install-chromium.xvfb-start"
fi
)
travisFoldEnd "install-chromium"
fi