Skip to content

Commit 265f76e

Browse files
committed
Merge pull request #318 from dart-lang/travis-runner2
Speed Travis CI up with some caching & faster fails
2 parents 4c43f3f + 56a534a commit 265f76e

File tree

2 files changed

+51
-8
lines changed

2 files changed

+51
-8
lines changed

pkg/dev_compiler/.travis.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
language: dart
2-
sudo: false
32
dart:
43
- dev
4+
cache:
5+
directories:
6+
- $HOME/.npm
7+
- $HOME/.nvm
8+
- $HOME/.pub-cache/hosted
9+
- $HOME/.chrome/canary
10+
- node_modules
511
before_install:
612
- pub global activate dart_coveralls
7-
- export CHROME_URL=https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64
8-
- export CHROME_REV=$(curl -s ${CHROME_URL}/LAST_CHANGE)
9-
- curl ${CHROME_URL}/${CHROME_REV}/chrome-linux.zip --create-dirs -o out/chrome-linux.zip
10-
- unzip out/chrome-linux.zip -d out
11-
- export CHROME_CANARY_BIN=$PWD/out/chrome-linux/chrome
13+
- export CHROME_CANARY_BIN=`./tool/get_chrome_canary.sh`
1214
- export DISPLAY=:99.0
1315
- sh -e /etc/init.d/xvfb start
1416
before_script:
1517
- npm install
1618
script:
17-
- ./tool/presubmit.sh
18-
- ./tool/coverage.sh
19+
- ./tool/presubmit.sh && ./tool/coverage.sh
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
#
3+
# Ensures the latest Chrome Canary is available, downloading it
4+
# if necessary.
5+
#
6+
# Directory ~/.chrome/canary can safely be cached as the existing
7+
# version will be checked before reusing a previously downloaded
8+
# canary.
9+
#
10+
11+
set -eu
12+
13+
readonly CHROME_URL=https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64
14+
readonly CHROME_REV=$(curl -s ${CHROME_URL}/LAST_CHANGE)
15+
16+
readonly CHROME_CANARY_DIR=$HOME/.chrome/canary
17+
readonly CHROME_CANARY_BIN=$CHROME_CANARY_DIR/chrome-linux/chrome
18+
readonly CHROME_CANARY_REV_FILE=$CHROME_CANARY_DIR/VERSION
19+
20+
function getCanary() {
21+
local existing_version=""
22+
if [[ -f $CHROME_CANARY_REV_FILE && -x $CHROME_CANARY_BIN ]]; then
23+
existing_version=`cat $CHROME_CANARY_REV_FILE`
24+
echo "Found cached Chrome Canary version: $existing_version"
25+
fi
26+
27+
if [[ "$existing_version" != "$CHROME_REV" ]]; then
28+
echo "Downloading Chrome Canary version: $CHROME_REV"
29+
rm -fR $CHROME_CANARY_DIR
30+
mkdir -p $CHROME_CANARY_DIR
31+
32+
local file=chrome-linux.zip
33+
curl ${CHROME_URL}/${CHROME_REV}/$file -o $file
34+
unzip $file -d $CHROME_CANARY_DIR
35+
rm $file
36+
echo $CHROME_REV > $CHROME_CANARY_REV_FILE
37+
fi
38+
}
39+
40+
getCanary >&2
41+
42+
echo $CHROME_CANARY_BIN

0 commit comments

Comments
 (0)