diff --git a/.travis.yml b/.travis.yml index b54ccc2151..5aeeec17f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,21 +9,20 @@ env: - LOGS_DIR=/tmp/angular-build/logs - ARCH=linux-x64 matrix: - - CHANNEL=stable - - CHANNEL=dev + - MODE=js DART_CHANNEL=stable + - MODE=dart DART_CHANNEL=stable + - MODE=dart DART_CHANNEL=dev before_install: - export DISPLAY=:99.0 - export GIT_SHA=$(git rev-parse HEAD) - ./scripts/ci/init_android.sh -- ./scripts/ci/install_dart.sh +- ./scripts/ci/install_dart.sh ${DART_CHANNEL} ${ARCH} - 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/ci/build.sh -- ./scripts/ci/test_unit.sh -- ./scripts/ci/test_e2e.sh +- ./scripts/ci/build_and_test.sh ${MODE} after_script: - ./scripts/ci/print-logs.sh diff --git a/scripts/ci/build_and_test.sh b/scripts/ci/build_and_test.sh new file mode 100755 index 0000000000..7a276a8b68 --- /dev/null +++ b/scripts/ci/build_and_test.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +MODE=$1 + +echo ============================================================================= +# go to project dir +SCRIPT_DIR=$(dirname $0) +cd $SCRIPT_DIR/../.. + +${SCRIPT_DIR}/build_$MODE.sh +${SCRIPT_DIR}/test_unit_$MODE.sh +${SCRIPT_DIR}/test_e2e_$MODE.sh diff --git a/scripts/ci/build.sh b/scripts/ci/build_dart.sh similarity index 81% rename from scripts/ci/build.sh rename to scripts/ci/build_dart.sh index 5d1c49d4a9..3e8500d5d6 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build_dart.sh @@ -7,6 +7,6 @@ SCRIPT_DIR=$(dirname $0) source $SCRIPT_DIR/env_dart.sh cd $SCRIPT_DIR/../.. -./node_modules/.bin/gulp build +./node_modules/.bin/gulp build.js.cjs build.dart pub install diff --git a/scripts/ci/test_unit.sh b/scripts/ci/build_js.sh similarity index 67% rename from scripts/ci/test_unit.sh rename to scripts/ci/build_js.sh index c49eed7550..d64280c6e3 100755 --- a/scripts/ci/test_unit.sh +++ b/scripts/ci/build_js.sh @@ -4,7 +4,8 @@ set -e echo ============================================================================= # go to project dir SCRIPT_DIR=$(dirname $0) +# this is needed because we're running JS tests in Dartium too source $SCRIPT_DIR/env_dart.sh cd $SCRIPT_DIR/../.. -./node_modules/.bin/gulp ci --browsers=$KARMA_BROWSERS +./node_modules/.bin/gulp build.js diff --git a/scripts/ci/install_dart.sh b/scripts/ci/install_dart.sh index f0b17be3ff..098508d095 100755 --- a/scripts/ci/install_dart.sh +++ b/scripts/ci/install_dart.sh @@ -1,13 +1,16 @@ #!/bin/bash -set -e +set -e -x -AVAILABLE_DART_VERSION=$(curl "https://storage.googleapis.com/dart-archive/channels/$CHANNEL/release/latest/VERSION" | python -c \ +DART_CHANNEL=$1 +ARCH=$2 + +AVAILABLE_DART_VERSION=$(curl "https://storage.googleapis.com/dart-archive/channels/${DART_CHANNEL}/release/latest/VERSION" | python -c \ 'import sys, json; print(json.loads(sys.stdin.read())["version"])') -echo Fetch Dart channel: $CHANNEL +echo Fetch Dart channel: ${DART_CHANNEL} -URL_PREFIX=https://storage.googleapis.com/dart-archive/channels/$CHANNEL/release/latest +URL_PREFIX=https://storage.googleapis.com/dart-archive/channels/${DART_CHANNEL}/release/latest DART_SDK_URL="$URL_PREFIX/sdk/dartsdk-$ARCH-release.zip" DARTIUM_URL="$URL_PREFIX/dartium/dartium-$ARCH-release.zip" diff --git a/scripts/ci/test_e2e.sh b/scripts/ci/test_e2e_dart.sh similarity index 76% rename from scripts/ci/test_e2e.sh rename to scripts/ci/test_e2e_dart.sh index b5fa3e97aa..f97c16d5f9 100755 --- a/scripts/ci/test_e2e.sh +++ b/scripts/ci/test_e2e_dart.sh @@ -13,7 +13,7 @@ function killServer () { kill $serverPid } -./node_modules/.bin/gulp serve.js.prod serve.js.dart2js& +./node_modules/.bin/gulp serve.js.dart2js& serverPid=$! trap killServer EXIT @@ -21,5 +21,4 @@ trap killServer EXIT # wait for server to come up! sleep 10 -./node_modules/.bin/protractor protractor-e2e-js.conf.js --browsers=$E2E_BROWSERS ./node_modules/.bin/protractor protractor-e2e-dart2js.conf.js --browsers=$E2E_BROWSERS \ No newline at end of file diff --git a/scripts/ci/test_e2e_js.sh b/scripts/ci/test_e2e_js.sh new file mode 100755 index 0000000000..59b1eec99f --- /dev/null +++ b/scripts/ci/test_e2e_js.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -e + +echo ============================================================================= +# go to project dir +SCRIPT_DIR=$(dirname $0) +source $SCRIPT_DIR/env_dart.sh +cd $SCRIPT_DIR/../.. + +./node_modules/.bin/webdriver-manager update + +function killServer () { + kill $serverPid +} + +./node_modules/.bin/gulp serve.js.prod& +serverPid=$! + +trap killServer EXIT + +# wait for server to come up! +sleep 10 + +./node_modules/.bin/protractor protractor-e2e-js.conf.js --browsers=$E2E_BROWSERS diff --git a/scripts/ci/test_unit_dart.sh b/scripts/ci/test_unit_dart.sh new file mode 100755 index 0000000000..7d767b415d --- /dev/null +++ b/scripts/ci/test_unit_dart.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +echo ============================================================================= +# go to project dir +SCRIPT_DIR=$(dirname $0) +source $SCRIPT_DIR/env_dart.sh +cd $SCRIPT_DIR/../.. + +./node_modules/.bin/gulp test.transpiler.unittest +./node_modules/.bin/gulp test.dart/ci --browsers=$KARMA_BROWSERS diff --git a/scripts/ci/test_unit_js.sh b/scripts/ci/test_unit_js.sh new file mode 100755 index 0000000000..5b940aa117 --- /dev/null +++ b/scripts/ci/test_unit_js.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +echo ============================================================================= +# go to project dir +SCRIPT_DIR=$(dirname $0) +source $SCRIPT_DIR/env_dart.sh +cd $SCRIPT_DIR/../.. + +./node_modules/.bin/gulp test.transpiler.unittest +./node_modules/.bin/gulp test.js/ci --browsers=$KARMA_BROWSERS