feat: travis-ci integration

This commit is contained in:
Tobias Bosch
2014-09-29 14:20:23 -07:00
parent 1907c590c8
commit 85b5543f62
10 changed files with 220 additions and 14 deletions

97
scripts/env.sh Normal file
View File

@ -0,0 +1,97 @@
#!/bin/false
set -e -o pipefail
if [[ -z $ENV_SET ]]; then
export ENV_SET=1
# Map DART_SDK and DARTSDK to each other if only one is specified.
#
# TODO(chirayu): Remove this legacy DARTSDK variable support. Check with Misko
# to see if he's using it on this Mac.
if [[ -z "$DART_SDK" ]]; then
: "${DARTSDK:=$DART_SDK}"
else
: "${DART_SDK:=$DARTSDK}"
fi
unset DART
PLATFORM="$(uname -s)"
case "$PLATFORM" in
(Darwin)
path=$(readlink ${BASH_SOURCE[0]}||echo './scripts/env.sh')
export NGDART_SCRIPT_DIR=$(dirname $path)
;;
(Linux)
export NGDART_SCRIPT_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
;;
(*)
echo Unsupported platform $PLATFORM. Exiting ... >&2
exit 3
;;
esac
export NGDART_BASE_DIR=$(dirname $NGDART_SCRIPT_DIR)
# Try to find the SDK alongside the dart command first.
if [[ -z "$DART_SDK" ]]; then
DART=$(which dart) || true
if [[ -x "$DART" ]]; then
DART_SDK="${DART/dart-sdk\/*/dart-sdk}"
if [[ ! -e "$DART_SDK" ]]; then
unset DART DART_SDK
fi
fi
fi
# Fallback: Assume it's alongside the current directory (e.g. Travis).
if [[ -z "$DART_SDK" ]]; then
DART_SDK="$(pwd)/dart-sdk"
fi
: "${DART:=$DART_SDK/bin/dart}"
if [[ ! -x "$DART" ]]; then
echo Unable to locate the dart binary / SDK. Exiting >&2
exit 3
fi
if [[ -z "$DARTIUM" ]]; then
dartiumRoot="$DART_SDK/../chromium"
if [[ -e "$dartiumRoot" ]]; then
case "$PLATFORM" in
(Linux) export DARTIUM="$dartiumRoot/chrome" ;;
(Darwin) export DARTIUM="$dartiumRoot/Chromium.app/Contents/MacOS/Chromium" ;;
(*) echo Unsupported platform $PLATFORM. Exiting ... >&2 ; exit 3 ;;
esac
fi
fi
export DART_SDK
export DARTSDK
export DART
export PUB=${PUB:-"$DART_SDK/bin/pub"}
export DARTANALYZER=${DARTANALYZER:-"$DART_SDK/bin/dartanalyzer"}
export DARTDOC=${DARTDOC:-"$DART_SDK/bin/dartdoc"}
export DART_DOCGEN=${DART_DOCGEN:-"$DART_SDK/bin/docgen"}
export DART_VM_OPTIONS="--old_gen_heap_size=2048"
export DARTIUM_BIN=${DARTIUM_BIN:-"$DARTIUM"}
export CHROME_BIN=${CHROME_BIN:-"google-chrome"}
export PATH=$PATH:$DART_SDK/bin
echo '*********'
echo '** ENV **'
echo '*********'
echo DART_SDK=$DART_SDK
echo DART=$DART
echo PUB=$PUB
echo DARTANALYZER=$DARTANALYZER
echo DARTDOC=$DARTDOC
echo DART_DOCGEN=$DART_DOCGEN
echo DARTIUM_BIN=$DARTIUM_BIN
echo CHROME_BIN=$CHROME_BIN
echo PATH=$PATH
echo NGDART_BASE_DIR=$NGDART_BASE_DIR
echo NGDART_SCRIPT_DIR=$NGDART_SCRIPT_DIR
$DART --version 2>&1
fi

20
scripts/travis/build.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
set -e
echo =============================================================================
# go to project dir
SCRIPT_DIR=$(dirname $0)
cd $SCRIPT_DIR/../..
source ./scripts/env.sh
./node_modules/.bin/gulp build
pub install
./node_modules/karma/bin/karma start karma-js.conf \
--reporters=dots \
--browsers=$BROWSERS --single-run
./node_modules/karma/bin/karma start karma-dart.conf \
--reporters=dots \
--browsers=$BROWSERS --single-run

35
scripts/travis/install.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
set -e
AVAILABLE_DART_VERSION=$(curl "https://storage.googleapis.com/dart-archive/channels/$CHANNEL/release/latest/VERSION" | python -c \
'import sys, json; print(json.loads(sys.stdin.read())["version"])')
echo Fetch Dart channel: $CHANNEL
SVN_REVISION=latest
# TODO(chirayu): Remove this once issue 20896 is fixed.
# Dart 1.7.0-dev.1.0 and 1.7.0-dev.2.0 are both broken so use version
# 1.7.0-dev.0.1 instead.
if [[ "$AVAILABLE_DART_VERSION" == "1.7.0-dev.2.0" ]]; then
SVN_REVISION=39661 # Use version 1.7.0-dev.0.1
fi
URL_PREFIX=https://storage.googleapis.com/dart-archive/channels/$CHANNEL/release/$SVN_REVISION
DART_SDK_URL=$URL_PREFIX/sdk/dartsdk-linux-x64-release.zip
DARTIUM_URL=$URL_PREFIX/dartium/dartium-linux-x64-release.zip
download_and_unzip() {
ZIPFILE=${1/*\//}
curl -O -L $1 && unzip -q $ZIPFILE && rm $ZIPFILE
}
# TODO: do these downloads in parallel
download_and_unzip $DART_SDK_URL
download_and_unzip $DARTIUM_URL
echo Fetched new dart version $(<dart-sdk/version)
if [[ -n $DARTIUM_URL ]]; then
mv dartium-* chromium
fi

11
scripts/travis/print-logs.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
LOG_FILES=$LOGS_DIR/*
for FILE in $LOG_FILES; do
echo -e "\n\n\n"
echo "================================================================================"
echo " $FILE"
echo "================================================================================"
cat $FILE
done