Skip to content

Commit

Permalink
Merge pull request #318 from dart-lang/travis-runner2
Browse files Browse the repository at this point in the history
Speed Travis CI up with some caching & faster fails
  • Loading branch information
vsmenon committed Sep 17, 2015
2 parents 4c43f3f + 56a534a commit 265f76e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pkg/dev_compiler/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
language: dart
sudo: false
dart:
- dev
cache:
directories:
- $HOME/.npm
- $HOME/.nvm
- $HOME/.pub-cache/hosted
- $HOME/.chrome/canary
- node_modules
before_install:
- pub global activate dart_coveralls
- export CHROME_URL=https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64
- export CHROME_REV=$(curl -s ${CHROME_URL}/LAST_CHANGE)
- curl ${CHROME_URL}/${CHROME_REV}/chrome-linux.zip --create-dirs -o out/chrome-linux.zip
- unzip out/chrome-linux.zip -d out
- export CHROME_CANARY_BIN=$PWD/out/chrome-linux/chrome
- export CHROME_CANARY_BIN=`./tool/get_chrome_canary.sh`
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
before_script:
- npm install
script:
- ./tool/presubmit.sh
- ./tool/coverage.sh
- ./tool/presubmit.sh && ./tool/coverage.sh
42 changes: 42 additions & 0 deletions pkg/dev_compiler/tool/get_chrome_canary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
#
# Ensures the latest Chrome Canary is available, downloading it
# if necessary.
#
# Directory ~/.chrome/canary can safely be cached as the existing
# version will be checked before reusing a previously downloaded
# canary.
#

set -eu

readonly CHROME_URL=https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64
readonly CHROME_REV=$(curl -s ${CHROME_URL}/LAST_CHANGE)

readonly CHROME_CANARY_DIR=$HOME/.chrome/canary
readonly CHROME_CANARY_BIN=$CHROME_CANARY_DIR/chrome-linux/chrome
readonly CHROME_CANARY_REV_FILE=$CHROME_CANARY_DIR/VERSION

function getCanary() {
local existing_version=""
if [[ -f $CHROME_CANARY_REV_FILE && -x $CHROME_CANARY_BIN ]]; then
existing_version=`cat $CHROME_CANARY_REV_FILE`
echo "Found cached Chrome Canary version: $existing_version"
fi

if [[ "$existing_version" != "$CHROME_REV" ]]; then
echo "Downloading Chrome Canary version: $CHROME_REV"
rm -fR $CHROME_CANARY_DIR
mkdir -p $CHROME_CANARY_DIR

local file=chrome-linux.zip
curl ${CHROME_URL}/${CHROME_REV}/$file -o $file
unzip $file -d $CHROME_CANARY_DIR
rm $file
echo $CHROME_REV > $CHROME_CANARY_REV_FILE
fi
}

getCanary >&2

echo $CHROME_CANARY_BIN

0 comments on commit 265f76e

Please sign in to comment.