feat: travis-ci integration
This commit is contained in:
parent
1907c590c8
commit
85b5543f62
|
@ -0,0 +1,20 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
||||
env:
|
||||
stable:
|
||||
- CHANNEL=stable
|
||||
- BROWSERS=DartiumWithWebPlatform
|
||||
- LOGS_DIR=/tmp/angular-build/logs
|
||||
|
||||
before_install:
|
||||
- export DISPLAY=:99.0
|
||||
- ./scripts/travis/install.sh
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- if [[ -e SKIP_TRAVIS_TESTS ]]; then { cat SKIP_TRAVIS_TESTS ; exit 0; } fi
|
||||
before_script:
|
||||
- mkdir -p $LOGS_DIR
|
||||
script:
|
||||
- ./scripts/travis/build.sh
|
||||
after_script:
|
||||
- ./scripts/travis/print-logs.sh
|
|
@ -1,3 +1,5 @@
|
|||
[![Build Status](https://travis-ci.org/angular/angular.svg?branch=master)](https://travis-ci.org/angular/angular)
|
||||
|
||||
## Build
|
||||
|
||||
### Prerequisites:
|
||||
|
|
33
gulpfile.js
33
gulpfile.js
|
@ -1,7 +1,6 @@
|
|||
var gulp = require('gulp');
|
||||
var rename = require('gulp-rename');
|
||||
var watch = require('gulp-watch');
|
||||
var shell = require('gulp-shell');
|
||||
var mergeStreams = require('event-stream').merge;
|
||||
var connect = require('gulp-connect');
|
||||
var clean = require('gulp-rimraf');
|
||||
|
@ -11,6 +10,8 @@ var ejs = require('gulp-ejs');
|
|||
var path = require('path');
|
||||
var through2 = require('through2');
|
||||
var file2moduleName = require('./file2modulename');
|
||||
var exec = require('child_process').exec;
|
||||
var Q = require('q');
|
||||
|
||||
var js2es5Options = {
|
||||
annotations: true, // parse annotations
|
||||
|
@ -30,6 +31,14 @@ var js2dartOptions = {
|
|||
|
||||
var gulpTraceur = require('./tools/transpiler/gulp-traceur');
|
||||
|
||||
function execWithLog(command, options, done) {
|
||||
exec(command, options, function (err, stdout, stderr) {
|
||||
stdout && console.log(stdout);
|
||||
stderr && console.log(stderr);
|
||||
done(err);
|
||||
});
|
||||
}
|
||||
|
||||
// ---------
|
||||
// traceur runtime
|
||||
|
||||
|
@ -52,10 +61,10 @@ var sourceTypeConfigs = {
|
|||
mimeType: 'application/dart',
|
||||
postProcess: function(file, done) {
|
||||
if (file.path.match(/pubspec\.yaml/)) {
|
||||
console.log(file.path);
|
||||
shell.task(['pub get'], {
|
||||
console.log('pub get ' + file.path);
|
||||
execWithLog('pub get', {
|
||||
cwd: path.dirname(file.path)
|
||||
})().on('end', done);
|
||||
}, done);
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
|
@ -68,9 +77,7 @@ var sourceTypeConfigs = {
|
|||
copySrc: ['modules/**/*.es5'],
|
||||
outputDir: 'build/js',
|
||||
outputExt: 'js',
|
||||
postProcess: function() {
|
||||
|
||||
}
|
||||
postProcess: null
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -92,10 +99,11 @@ gulp.task('modules/build.dart/analyzer', function() {
|
|||
files = files.filter(function(fileName) {
|
||||
return fileName.match(/(\w+)\/lib\/\1/);
|
||||
});
|
||||
var commands = files.map(function(fileName) {
|
||||
return 'dartanalyzer '+baseDir+'/'+fileName
|
||||
});
|
||||
return shell.task(commands)();
|
||||
return Q.all(files.map(function(fileName) {
|
||||
var deferred = Q.defer();
|
||||
execWithLog('dartanalyzer '+baseDir+'/'+fileName, {}, deferred.makeNodeResolver());
|
||||
return deferred.promise;
|
||||
}));
|
||||
});
|
||||
|
||||
gulp.task('modules/build.dart', function(done) {
|
||||
|
@ -129,6 +137,9 @@ function createModuleTask(sourceTypeConfig) {
|
|||
.pipe(gulp.dest(sourceTypeConfig.outputDir));
|
||||
|
||||
var s = mergeStreams(transpile, copy, html);
|
||||
if (!sourceTypeConfig.postProcess) {
|
||||
return s;
|
||||
}
|
||||
return s.pipe(through2.obj(function(file, enc, done) {
|
||||
sourceTypeConfig.postProcess(file, done);
|
||||
}));
|
||||
|
|
|
@ -40,7 +40,12 @@ module.exports = function(config) {
|
|||
}
|
||||
},
|
||||
|
||||
browsers: ['Dartium']
|
||||
customLaunchers: {
|
||||
DartiumWithWebPlatform: {
|
||||
base: 'Dartium',
|
||||
flags: ['--enable-experimental-web-platform-features'] }
|
||||
},
|
||||
browsers: ['DartiumWithWebPlatform'],
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,12 @@ module.exports = function(config) {
|
|||
}
|
||||
},
|
||||
|
||||
browsers: ['Chrome']
|
||||
customLaunchers: {
|
||||
DartiumWithWebPlatform: {
|
||||
base: 'Dartium',
|
||||
flags: ['--enable-experimental-web-platform-features'] }
|
||||
},
|
||||
browsers: ['DartiumWithWebPlatform'],
|
||||
});
|
||||
|
||||
config.plugins.push(require('./tools/transpiler/karma-traceur-preprocessor'));
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
"dependencies": {
|
||||
"gulp": "^3.8.8",
|
||||
"gulp-rename": "^1.2.0",
|
||||
"gulp-shell": "^0.2.9",
|
||||
"gulp-watch": "^1.0.3",
|
||||
"karma-cli": "^0.0.4",
|
||||
"karma": "^0.12.23",
|
||||
"karma-chrome-launcher": "^0.1.4",
|
||||
"karma-dart": "^0.2.8",
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue