diff --git a/.circleci/config.yml b/.circleci/config.yml index 897816f86c3..a90eecafef4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -140,6 +140,23 @@ jobs: - run: ./scripts/circleci/run-browserstack-tests.sh + # ---------------------------------------------------------------------------- + # Job that runs the unit tests on Saucelabs. The browsers that will be used + # to run the unit tests on Saucelabs are set in: test/browser-providers.js + # ---------------------------------------------------------------------------- + tests_saucelabs: + <<: *job_defaults + resource_class: xlarge + environment: + SAUCE_USERNAME: "angular-ci" + SAUCE_ACCESS_KEY: "9b988f434ff8-fbca-8aa4-4ae3-35442987" + steps: + - *checkout_code + - *restore_cache + - *yarn_install + + - run: ./scripts/circleci/run-saucelabs-tests.sh + # ----------------------------------------------------------------------------------------- # Job that builds the demo-app with AOT. In order to speed up this job, the release output # from the workspace storage will be attached to this job. @@ -268,6 +285,7 @@ workflows: jobs: - tests_local_browsers - tests_browserstack + - tests_saucelabs integration_tests: jobs: diff --git a/.github/angular-robot.yml b/.github/angular-robot.yml index a657862f96a..c7ba5f97e94 100644 --- a/.github/angular-robot.yml +++ b/.github/angular-robot.yml @@ -55,12 +55,11 @@ merge: # list of PR statuses that need to be successful requiredStatuses: - # TODO(josephperrott): reenable once CI flakiness is addressed - # - "continuous-integration/travis-ci/pr" - "ci/circleci: lint" - "ci/circleci: bazel_build_test" - "ci/circleci: tests_local_browsers" - "ci/circleci: tests_browserstack" + - "ci/circleci: tests_saucelabs" - "ci/circleci: build_release_packages" # the comment that will be added when the merge label is added despite failing checks, leave empty or set to false to disable diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5253334bbb6..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,54 +0,0 @@ -language: node_js -dist: trusty -sudo: false - -node_js: - # Use the explicit NodeJS LTS version 8.9.4 to avoid any automatic upgrade of the version. - # This ensures that all Travis jobs run consistently and don't have different Node versions. - - '8.12.0' - -addons: - chrome: stable - firefox: latest - -branches: - only: - - master - # 5.2.x, 6.0.x, etc - - /\d+\.\d+\.x/ - # 5.x, 6.x, etc - - /\d+\.x/ - -jobs: - include: - - env: "MODE=saucelabs_required" - -env: - global: - # Keep Yarn version in sync with Yarn version within Bazel WORKSPACE. - - YARN_VERSION=1.9.4 - - LOGS_DIR=/tmp/angular-material2-build/logs - - SAUCE_USERNAME=angular-ci - - SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987 - - BROWSER_STACK_USERNAME=angularteam1 - - BROWSER_STACK_ACCESS_KEY=CaXMeMHD9pr5PHg8N7Jq - - BROWSER_PROVIDER_READY_FILE=/tmp/angular-material2-build/readyfile - - BROWSER_PROVIDER_ERROR_FILE=/tmp/angular-material2-build/errorfile - -before_install: - - source ./scripts/ci/install-yarn.sh - -install: - - ./scripts/ci/travis-install.sh - - if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then ./scripts/install-angular-snapshot.sh --only-save; fi - -before_script: - - mkdir -p $LOGS_DIR - -script: - - ./scripts/ci/travis-script.sh - -cache: - yarn: true - directories: - - ./node_modules/ diff --git a/README.md b/README.md index d3e7e9ec14e..818bbe45af0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Material Design for Angular [![npm version](https://badge.fury.io/js/%40angular%2Fmaterial.svg)](https://www.npmjs.com/package/%40angular%2Fmaterial) -[![Build Status](https://travis-ci.org/angular/material2.svg?branch=master)](https://travis-ci.org/angular/material2) +[![Build status](https://circleci.com/gh/angular/material2.svg?style=svg)](https://circleci.com/gh/angular/material2) [![Gitter](https://badges.gitter.im/angular/material2.svg)](https://gitter.im/angular/material2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) This is the home for the Angular team's Material Design components built for and with Angular. diff --git a/WORKSPACE b/WORKSPACE index 7cbcc3de9b7..2a82660fdcb 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -67,8 +67,7 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_reposi check_bazel_version("0.18.0") node_repositories( - # For deterministic builds, specify explicit NodeJS and Yarn versions. Keep the Yarn version - # in sync with the version of Travis. + # For deterministic builds, specify explicit NodeJS and Yarn versions. node_version = "10.10.0", yarn_version = "1.9.4", ) diff --git a/scripts/browserstack/start-tunnel.sh b/scripts/browserstack/start-tunnel.sh index 0d4368dbb31..2ae2e0b74b4 100755 --- a/scripts/browserstack/start-tunnel.sh +++ b/scripts/browserstack/start-tunnel.sh @@ -11,7 +11,7 @@ tunnelReadyFile="${tunnelTmpDir}/readyfile" tunnelErrorFile="${tunnelTmpDir}/errorfile" # Cleanup and create the folder structure for the tunnel connector. -rm -rf ${tunnelTmpDir} ${tunnelReadyFile} ${tunnelErrorFile} +rm -rf ${tunnelTmpDir} mkdir -p ${tunnelTmpDir} touch ${tunnelLogFile} diff --git a/scripts/ci/README.md b/scripts/ci/README.md deleted file mode 100644 index 840fbf881f7..00000000000 --- a/scripts/ci/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Continuous Integration Scripts - -This directory contains scripts that are related to CI only. - -| Script | Description | -| ----------------- | --------------------------------------------------------------------- | -| travis-env.sh | Runs at the beginning of a Travis build to set up the environment. | -| travis-script.sh | Main script that Travis will always execute for every job and mode. | -| travis-testing.sh | Script that controls all jobs inside of the testing build stage. | -| travis-deploy.sh | Script that controls all jobs inside of the deploy build stage. | diff --git a/scripts/ci/install-yarn.sh b/scripts/ci/install-yarn.sh deleted file mode 100644 index 0cc58aa0d49..00000000000 --- a/scripts/ci/install-yarn.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Fetch the install script and setup Yarn with the version from the Travis config. -curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION} - -# Ensure that the profile-based Yarn installation is available within Bash as executable. -export PATH=$HOME/.yarn/bin:$PATH diff --git a/scripts/ci/sources/mode.sh b/scripts/ci/sources/mode.sh deleted file mode 100644 index c06161126c7..00000000000 --- a/scripts/ci/sources/mode.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -source ./scripts/ci/sources/tunnel.sh - -is_e2e() { - [[ "${MODE}" = e2e ]] -} - -is_lint() { - [[ "${MODE}" = lint ]] -} - -is_aot() { - [[ "${MODE}" = aot ]] -} - -is_unit() { - [[ "${MODE}" =~ ^.*_(optional|required)$ ]] -} - -is_prerender() { - [[ "$MODE" = prerender ]] -} diff --git a/scripts/ci/sources/tunnel.sh b/scripts/ci/sources/tunnel.sh deleted file mode 100644 index 18384f56eb3..00000000000 --- a/scripts/ci/sources/tunnel.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# Load the retry-call utility function. -source ./scripts/retry-call.sh - -# Variable the specifies how often the wait script should be invoked if it fails. -WAIT_RETRIES=2 - -start_tunnel() { - case "$MODE" in - saucelabs*) - ./scripts/saucelabs/start-tunnel.sh - ;; - browserstack*) - ./scripts/browserstack/start-tunnel.sh - ;; - *) - ;; - esac -} - -wait_for_tunnel() { - case "$MODE" in - saucelabs*) - retryCall ${WAIT_RETRIES} ./scripts/saucelabs/wait-tunnel.sh - ;; - browserstack*) - retryCall ${WAIT_RETRIES} ./scripts/browserstack/wait-tunnel.sh - ;; - *) - ;; - esac -} - -teardown_tunnel() { - case "$MODE" in - saucelabs*) - ./scripts/saucelabs/stop-tunnel.sh - ;; - browserstack*) - ./scripts/browserstack/stop-tunnel.sh - ;; - *) - ;; - esac -} - diff --git a/scripts/ci/travis-deploy.sh b/scripts/ci/travis-deploy.sh deleted file mode 100755 index 4000837cc64..00000000000 --- a/scripts/ci/travis-deploy.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Script that runs in the deploy stage after the testing stage of Travis passed. -# Build artifacts and docs content will be published to different repositories. - -# The script should immediately exit if any command in the script fails. -set -e - -# Go to the project root directory -cd $(dirname $0)/../.. - -# Load the retry-call utility function. -source scripts/retry-call.sh - -# Variable the specifies how often the deploy script should be invoked if it fails. -DEPLOY_RETRIES=1 - -echo "" -echo "Starting the deployment script. Running mode: ${DEPLOY_MODE}" -echo "" - -if [[ "${DEPLOY_MODE}" == "build-artifacts" ]]; then - retryCall ${DEPLOY_RETRIES} ./scripts/deploy/publish-build-artifacts.sh -elif [[ "${DEPLOY_MODE}" == "docs-content" ]]; then - retryCall ${DEPLOY_RETRIES} ./scripts/deploy/publish-docs-content.sh -fi diff --git a/scripts/ci/travis-install.sh b/scripts/ci/travis-install.sh deleted file mode 100755 index 7b0fb4878a7..00000000000 --- a/scripts/ci/travis-install.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# Script that installs the project node module dependencies within Travis. The script also ensures that the cached -# node modules are in sync with the lock file and also checks that if the lock file is in sync with the -# project `package.json` file. - -# Go to the project root directory -cd $(dirname $0)/../.. - -# Yarn's integrity check command throws in the following scenarios: -# 1) Cached node modules are not in sync with lock file -# 2) Lock file is not in sync with `package.json` - -# In case the integrity check passes, we just use the cached/locked node modules. If it fails, we want to purge the -# node modules and run Yarn with `--frozen-lockfile`. Running with a frozen lockfile ensures that outdated/cached node -# modules will be refreshed to **match** the actual lock file. Otherwise, if the `package.json` does not match with -# the lock file, Yarn automatically throws an error due to the `--frozen-lockfile` option. -if ! (yarn check --integrity &> /dev/null); then - echo "Cached node modules are not in sync. Purging and refreshing..." - rm -rf ./node_modules/ - yarn install --frozen-lockfile --non-interactive -else - echo "Cached node modules have been checked and are in sync with the lock file." -fi \ No newline at end of file diff --git a/scripts/ci/travis-script.sh b/scripts/ci/travis-script.sh deleted file mode 100755 index 27ba0da4c21..00000000000 --- a/scripts/ci/travis-script.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# Script that runs in every Travis CI container. The script is responsible for delegating -# to the different scripts that should run for specific Travis jobs in a build stage. - -# The script should immediately exit if any command in the script fails. -set -e - -# Go to project directory -cd $(dirname $0)/../.. - -if [[ "${MODE}" ]]; then - ./scripts/ci/travis-testing.sh -elif [[ "${DEPLOY_MODE}" ]]; then - ./scripts/ci/travis-deploy.sh -fi diff --git a/scripts/ci/travis-testing.sh b/scripts/ci/travis-testing.sh deleted file mode 100755 index 34e4fdcba1c..00000000000 --- a/scripts/ci/travis-testing.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -# Script that runs in the testing build stage of Travis and is responsible for testing -# the project in different Travis jobs of the current build stage. - -# The script should immediately exit if any command in the script fails. -set -e - -echo "" -echo "Building sources and running tests. Running mode: ${MODE}" -echo "" - -# Go to project dir -cd $(dirname $0)/../.. - -# Include sources. -source scripts/ci/sources/mode.sh -source scripts/ci/sources/tunnel.sh - -# Get the commit diff and skip the build if only .md files have changed. -# Should not apply to master builds. -if [ "$TRAVIS_PULL_REQUEST" = "true" ]; then - fileDiff=$(git diff --name-only $TRAVIS_BRANCH...HEAD) - - if [[ ${fileDiff} =~ ^(.*\.md\s*)*$ ]]; then - echo "Skipping tests because only markdown files changed." - exit 0 - fi -fi - -start_tunnel -wait_for_tunnel - -if is_lint; then - $(npm bin)/gulp ci:lint -elif is_e2e; then - # Run e2e tests inside of Xvfb because we need to test the HTML Fullscreen API's that cannot - # be tested within Chrome headless. - xvfb-run -a --server-args='-screen 0, 1024x768x16' $(npm bin)/gulp ci:e2e -elif is_aot; then - $(npm bin)/gulp ci:aot -elif is_unit; then - $(npm bin)/gulp ci:test -elif is_prerender; then - $(npm bin)/gulp ci:prerender -fi - -teardown_tunnel diff --git a/scripts/circleci/run-saucelabs-tests.sh b/scripts/circleci/run-saucelabs-tests.sh new file mode 100755 index 00000000000..659b15494a1 --- /dev/null +++ b/scripts/circleci/run-saucelabs-tests.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# In case any command failed, we want to immediately exit the script with the +# proper exit code. +set -e + +# Go to project directory. +cd $(dirname ${0})/../.. + +# Decode access token and make it accessible for child processes. +export SAUCE_ACCESS_KEY=`echo ${SAUCE_ACCESS_KEY} | rev` + +# Start tunnel and wait for it being ready. +./scripts/saucelabs/start-tunnel.sh +./scripts/saucelabs/wait-tunnel.sh + +# Setup the test platform environment variable that will be read +# by the Karma configuration script. +export TEST_PLATFORM="saucelabs" + +# Run the unit tests on Saucelabs with Karma. +yarn gulp ci:test + +# Kill the Saucelabs tunnel. This is necessary in order to avoid rate-limit +# errors that cause the unit tests to be flaky. +./scripts/saucelabs/stop-tunnel.sh diff --git a/scripts/saucelabs/start-tunnel.sh b/scripts/saucelabs/start-tunnel.sh index bf8bc7528cd..21da8866938 100755 --- a/scripts/saucelabs/start-tunnel.sh +++ b/scripts/saucelabs/start-tunnel.sh @@ -2,40 +2,39 @@ set -e -o pipefail -TUNNEL_FILE="sc-4.5.1-linux.tar.gz" -TUNNEL_URL="https://saucelabs.com/downloads/${TUNNEL_FILE}" -TUNNEL_DIR="/tmp/saucelabs-connect" +tunnelFileName="sc-4.5.1-linux.tar.gz" +tunnelUrl="https://saucelabs.com/downloads/${tunnelFileName}" -TUNNEL_LOG="${LOGS_DIR}/saucelabs-tunnel.log" - -SAUCE_ACCESS_KEY=`echo ${SAUCE_ACCESS_KEY} | rev` +tunnelTmpDir="/tmp/material-saucelabs" +tunnelLogFile="${tunnelTmpDir}/saucelabs-connect.log" +tunnelReadyFile="${tunnelTmpDir}/readyfile" +tunnelPidFile="${tunnelTmpDir}/pidfile" # Cleanup and create the folder structure for the tunnel connector. -rm -rf ${TUNNEL_DIR} ${BROWSER_PROVIDER_READY_FILE} -mkdir -p ${TUNNEL_DIR} +rm -rf ${tunnelTmpDir} +mkdir -p ${tunnelTmpDir} -cd ${TUNNEL_DIR} +# Go into the temporary tunnel directory. +cd ${tunnelTmpDir} # Download the saucelabs connect binaries. -curl ${TUNNEL_URL} -o ${TUNNEL_FILE} 2> /dev/null 1> /dev/null +curl ${tunnelUrl} -o ${tunnelFileName} 2> /dev/null 1> /dev/null # Extract the saucelabs connect binaries from the tarball. mkdir -p sauce-connect -tar --extract --file=${TUNNEL_FILE} --strip-components=1 --directory=sauce-connect > /dev/null +tar --extract --file=${tunnelFileName} --strip-components=1 --directory=sauce-connect > /dev/null # Cleanup the download directory. -rm ${TUNNEL_FILE} +rm ${tunnelFileName} -ARGS="" +# Command arguments that will be passed to sauce-connect. +sauceArgs="--readyfile ${tunnelReadyFile} --pidfile ${tunnelPidFile}" -# Set tunnel-id only on Travis, to make local testing easier. -if [ ! -z "${TRAVIS_JOB_ID}" ]; then - ARGS="${ARGS} --tunnel-identifier ${TRAVIS_JOB_ID}" -fi -if [ ! -z "${BROWSER_PROVIDER_READY_FILE}" ]; then - ARGS="${ARGS} --readyfile ${BROWSER_PROVIDER_READY_FILE}" +if [ ! -z "${CIRCLE_BUILD_NUM}" ]; then + sauceArgs="${sauceArgs} --tunnel-identifier ${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_INDEX}" fi -echo "Starting Sauce Connect in the background, logging into: ${TUNNEL_LOG}" +echo "Starting Sauce Connect in the background, logging into: ${tunnelLogFile}" -sauce-connect/bin/sc -u ${SAUCE_USERNAME} -k ${SAUCE_ACCESS_KEY} ${ARGS} 2>&1 >> ${TUNNEL_LOG} & +sauce-connect/bin/sc -u ${SAUCE_USERNAME} -k ${SAUCE_ACCESS_KEY} ${sauceArgs} 2>&1 >> \ + ${tunnelLogFile} & diff --git a/scripts/saucelabs/stop-tunnel.sh b/scripts/saucelabs/stop-tunnel.sh index 91b918a485e..8123fa04b5d 100755 --- a/scripts/saucelabs/stop-tunnel.sh +++ b/scripts/saucelabs/stop-tunnel.sh @@ -2,12 +2,24 @@ set -e -o pipefail +tunnelTmpDir="/tmp/material-saucelabs" +tunnelPidFile="${tunnelTmpDir}/pidfile" + +if [[ ! -f ${tunnelPidFile} ]]; then + echo "Could not find Saucelabs tunnel PID file. Cannot stop tunnel.." + exit 1 +fi echo "Shutting down Sauce Connect tunnel" -killall sc +# The process id for the sauce-connect instance is stored inside of the pidfile. +tunnelProcessId=$(cat ${tunnelPidFile}) -while [[ -n `ps -ef | grep "sauce-connect-" | grep -v "grep"` ]]; do +# Kill the process by using the PID that has been read from the pidfile. Note that +# we cannot use killall because CircleCI base container images don't have it installed. +kill ${tunnelProcessId} + +while (ps -p ${tunnelProcessId} &> /dev/null); do printf "." sleep .5 done diff --git a/scripts/saucelabs/wait-tunnel.sh b/scripts/saucelabs/wait-tunnel.sh index 1c0aa0cdee1..6c2582e1fd0 100755 --- a/scripts/saucelabs/wait-tunnel.sh +++ b/scripts/saucelabs/wait-tunnel.sh @@ -1,20 +1,23 @@ #!/bin/bash -TUNNEL_LOG="$LOGS_DIR/saucelabs-tunnel.log" +tunnelTmpDir="/tmp/material-saucelabs" +tunnelLogFile="${tunnelTmpDir}/saucelabs-connect.log" +tunnelReadyFile="${tunnelTmpDir}/readyfile" + WAIT_DELAY=30 # Method that prints the logfile output of the saucelabs tunnel. printLog() { - echo "Logfile output of Saucelabs tunnel (${TUNNEL_LOG}):" + echo "Logfile output of Saucelabs tunnel (${tunnelLogFile}):" echo "" - cat ${TUNNEL_LOG} + cat ${tunnelLogFile} } # Wait for Saucelabs Connect to be ready before exiting # Time out if we wait for more than 2 minutes, so the process won't run forever. let "counter=0" -while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do +while [ ! -f ${tunnelReadyFile} ]; do let "counter++" # Counter needs to be multiplied by two because the while loop only sleeps a half second. diff --git a/test/browser-providers.js b/test/browser-providers.js index 87722c1a9d2..239776b8ec7 100644 --- a/test/browser-providers.js +++ b/test/browser-providers.js @@ -19,7 +19,7 @@ const browserConfig = { 'IE9': { unitTest: {target: null, }}, 'IE10': { unitTest: {target: null, }}, 'IE11': { unitTest: {target: null, }}, - 'Edge': { unitTest: {target: 'BS', }}, + 'Edge': { unitTest: {target: 'browserstack', }}, 'Android4.1': { unitTest: {target: null, }}, 'Android4.2': { unitTest: {target: null, }}, 'Android4.3': { unitTest: {target: null, }}, @@ -28,24 +28,22 @@ const browserConfig = { 'Safari7': { unitTest: {target: null, }}, 'Safari8': { unitTest: {target: null, }}, 'Safari9': { unitTest: {target: null, }}, - 'Safari10': { unitTest: {target: 'BS', }}, + 'Safari10': { unitTest: {target: 'browserstack', }}, 'iOS7': { unitTest: {target: null, }}, 'iOS8': { unitTest: {target: null, }}, 'iOS9': { unitTest: {target: null, }}, 'iOS10': { unitTest: {target: null, }}, - // Don't use Browserstack until our open-source license includes automate testing on - // mobile devices. For now, we need to use Saucelabs to keep our coverage. - 'iOS11': { unitTest: {target: 'SL', }}, + 'iOS11': { unitTest: {target: 'saucelabs', }}, 'WindowsPhone': { unitTest: {target: null, }} }; -/** Exports all available remote browsers. */ -exports.customLaunchers = require('./remote_browsers.json'); +/** Exports all available custom Karma browsers. */ +exports.customLaunchers = require('./karma-browsers.json'); /** Exports a map of configured browsers, which should run in the given platform. */ exports.platformMap = { - 'saucelabs': buildConfiguration('unitTest', 'SL'), - 'browserstack': buildConfiguration('unitTest', 'BS'), + 'saucelabs': buildConfiguration('unitTest', 'saucelabs'), + 'browserstack': buildConfiguration('unitTest', 'browserstack'), 'local': buildConfiguration('unitTest', 'local'), }; @@ -63,16 +61,7 @@ function buildConfiguration(type, target) { return targetBrowsers; } - return targetBrowsers.map(browserName => `${target}_${browserName.toUpperCase()}`); -} - -/** Decode the token for Travis to use. */ -function decodeToken(token) { - return (token || '').split('').reverse().join(''); -} - -/** Ensures that the Saucelabs and Browserstack access keys work properly. */ -if (process.env.TRAVIS) { - process.env.SAUCE_ACCESS_KEY = decodeToken(process.env.SAUCE_ACCESS_KEY); - process.env.BROWSER_STACK_ACCESS_KEY = decodeToken(process.env.BROWSER_STACK_ACCESS_KEY); + return targetBrowsers.map(browserName => { + return `${target.toUpperCase()}_${browserName.toUpperCase()}`; + }); } diff --git a/test/remote_browsers.json b/test/karma-browsers.json similarity index 81% rename from test/remote_browsers.json rename to test/karma-browsers.json index 3e2d4c8706d..4c048f2316d 100644 --- a/test/remote_browsers.json +++ b/test/karma-browsers.json @@ -1,5 +1,5 @@ { - "ChromeHeadlessLocal": { + "ChromeHeadlesSAUCELABSocal": { "base": "ChromeHeadless", "flags": [ "--window-size=1024,768" @@ -18,176 +18,176 @@ "-headless" ] }, - "SL_CHROME": { + "SAUCELABS_CHROME": { "base": "SauceLabs", "browserName": "chrome", "version": "latest" }, - "SL_CHROMEBETA": { + "SAUCELABS_CHROMEBETA": { "base": "SauceLabs", "browserName": "chrome", "version": "beta" }, - "SL_CHROMEDEV": { + "SAUCELABS_CHROMEDEV": { "base": "SauceLabs", "browserName": "chrome", "version": "dev" }, - "SL_FIREFOX": { + "SAUCELABS_FIREFOX": { "base": "SauceLabs", "browserName": "firefox", "version": "latest" }, - "SL_FIREFOXBETA": { + "SAUCELABS_FIREFOXBETA": { "base": "SauceLabs", "browserName": "firefox", "version": "beta" }, - "SL_FIREFOXDEV": { + "SAUCELABS_FIREFOXDEV": { "base": "SauceLabs", "browserName": "firefox", "version": "dev" }, - "SL_SAFARI7": { + "SAUCELABS_SAFARI7": { "base": "SauceLabs", "browserName": "safari", "platform": "OS X 10.9", "version": "7" }, - "SL_SAFARI8": { + "SAUCELABS_SAFARI8": { "base": "SauceLabs", "browserName": "safari", "platform": "OS X 10.10", "version": "8" }, - "SL_SAFARI9": { + "SAUCELABS_SAFARI9": { "base": "SauceLabs", "browserName": "safari", "platform": "OS X 10.11", "version": "9.0" }, - "SL_SAFARI10": { + "SAUCELABS_SAFARI10": { "base": "SauceLabs", "browserName": "safari", "platform": "OS X 10.12", "version": "10.0" }, - "SL_IOS7": { + "SAUCELABS_IOS7": { "base": "SauceLabs", "browserName": "iphone", "platform": "OS X 10.10", "version": "7.1" }, - "SL_IOS8": { + "SAUCELABS_IOS8": { "base": "SauceLabs", "browserName": "iphone", "platform": "OS X 10.10", "version": "8.4" }, - "SL_IOS9": { + "SAUCELABS_IOS9": { "base": "SauceLabs", "browserName": "iphone", "platform": "OS X 10.10", "version": "9.1" }, - "SL_IOS11": { + "SAUCELABS_IOS11": { "base": "SauceLabs", "browserName": "iphone", "platform": "Mac 10.12", "version": "11.2" }, - "SL_IE9": { + "SAUCELABS_IE9": { "base": "SauceLabs", "browserName": "internet explorer", "platform": "Windows 2008", "version": "9" }, - "SL_IE10": { + "SAUCELABS_IE10": { "base": "SauceLabs", "browserName": "internet explorer", "platform": "Windows 2012", "version": "10" }, - "SL_IE11": { + "SAUCELABS_IE11": { "base": "SauceLabs", "browserName": "internet explorer", "platform": "Windows 8.1", "version": "11" }, - "SL_EDGE": { + "SAUCELABS_EDGE": { "base": "SauceLabs", "browserName": "microsoftedge", "platform": "Windows 10", "version": "17" }, - "SL_ANDROID4.1": { + "SAUCELABS_ANDROID4.1": { "base": "SauceLabs", "browserName": "android", "platform": "Linux", "version": "4.1" }, - "SL_ANDROID4.2": { + "SAUCELABS_ANDROID4.2": { "base": "SauceLabs", "browserName": "android", "platform": "Linux", "version": "4.2" }, - "SL_ANDROID4.3": { + "SAUCELABS_ANDROID4.3": { "base": "SauceLabs", "browserName": "android", "platform": "Linux", "version": "4.3" }, - "SL_ANDROID4.4": { + "SAUCELABS_ANDROID4.4": { "base": "SauceLabs", "browserName": "android", "platform": "Linux", "version": "4.4" }, - "SL_ANDROID5": { + "SAUCELABS_ANDROID5": { "base": "SauceLabs", "browserName": "android", "platform": "Linux", "version": "5.1" }, - "BS_CHROME": { + "BROWSERSTACK_CHROME": { "base": "BrowserStack", "browser": "chrome", "os": "OS X", "os_version": "Yosemite" }, - "BS_FIREFOX": { + "BROWSERSTACK_FIREFOX": { "base": "BrowserStack", "browser": "firefox", "os": "Windows", "os_version": "10" }, - "BS_SAFARI7": { + "BROWSERSTACK_SAFARI7": { "base": "BrowserStack", "browser": "safari", "os": "OS X", "os_version": "Mavericks" }, - "BS_SAFARI8": { + "BROWSERSTACK_SAFARI8": { "base": "BrowserStack", "browser": "safari", "os": "OS X", "os_version": "Yosemite" }, - "BS_SAFARI9": { + "BROWSERSTACK_SAFARI9": { "base": "BrowserStack", "browser": "safari", "os": "OS X", "os_version": "El Capitan" }, - "BS_SAFARI10": { + "BROWSERSTACK_SAFARI10": { "base": "BrowserStack", "browser": "safari", "browser_version": "10.1", "os": "OS X", "os_version": "Sierra" }, - "BS_IOS7": { + "BROWSERSTACK_IOS7": { "base": "BrowserStack", "device": "iPhone 5S", "os": "ios", @@ -195,7 +195,7 @@ "real_mobile": true, "resolution": "1024x768" }, - "BS_IOS8": { + "BROWSERSTACK_IOS8": { "base": "BrowserStack", "device": "iPhone 6", "os": "ios", @@ -203,7 +203,7 @@ "real_mobile": true, "resolution": "1024x768" }, - "BS_IOS9": { + "BROWSERSTACK_IOS9": { "base": "BrowserStack", "device": "iPhone 6S", "os": "ios", @@ -211,84 +211,84 @@ "real_mobile": true, "resolution": "1024x768" }, - "BS_IOS10": { + "BROWSERSTACK_IOS10": { "base": "BrowserStack", "device": "iPhone 7", "os": "ios", "real_mobile": true, "os_version": "10.0" }, - "BS_IOS11": { + "BROWSERSTACK_IOS11": { "base": "BrowserStack", "device": "iPhone 8", "os": "ios", "os_version": "11.0", "real_mobile": true }, - "BS_IE9": { + "BROWSERSTACK_IE9": { "base": "BrowserStack", "browser": "ie", "browser_version": "9.0", "os": "Windows", "os_version": "7" }, - "BS_IE10": { + "BROWSERSTACK_IE10": { "base": "BrowserStack", "browser": "ie", "browser_version": "10.0", "os": "Windows", "os_version": "8" }, - "BS_IE11": { + "BROWSERSTACK_IE11": { "base": "BrowserStack", "browser": "ie", "browser_version": "11.0", "os": "Windows", "os_version": "10" }, - "BS_EDGE": { + "BROWSERSTACK_EDGE": { "base": "BrowserStack", "browser": "Edge", "browser_version": "17.0", "os": "Windows", "os_version": "10" }, - "BS_WINDOWSPHONE": { + "BROWSERSTACK_WINDOWSPHONE": { "base": "BrowserStack", "device": "Nokia Lumia 930", "os": "winphone", "real_mobile": true, "os_version": "8.1" }, - "BS_ANDROID5": { + "BROWSERSTACK_ANDROID5": { "base": "BrowserStack", "device": "Google Nexus 5", "os": "android", "real_mobile": true, "os_version": "5.0" }, - "BS_ANDROID4.4": { + "BROWSERSTACK_ANDROID4.4": { "base": "BrowserStack", "device": "HTC One M8", "os": "android", "real_mobile": true, "os_version": "4.4" }, - "BS_ANDROID4.3": { + "BROWSERSTACK_ANDROID4.3": { "base": "BrowserStack", "device": "Samsung Galaxy S4", "os": "android", "real_mobile": true, "os_version": "4.3" }, - "BS_ANDROID4.2": { + "BROWSERSTACK_ANDROID4.2": { "base": "BrowserStack", "device": "Google Nexus 4", "os": "android", "real_mobile": true, "os_version": "4.2" }, - "BS_ANDROID4.1": { + "BROWSERSTACK_ANDROID4.1": { "base": "BrowserStack", "device": "Google Nexus 7", "os": "android", diff --git a/test/karma.conf.js b/test/karma.conf.js index 07eb60436ce..5d4eb6253aa 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -103,6 +103,9 @@ module.exports = (config) => { if (testPlatform === 'browserstack') { config.browserStack.build = buildIdentifier; config.browserStack.tunnelIdentifier = tunnelIdentifier; + } else if (testPlatform === 'saucelabs') { + config.sauceLabs.build = buildIdentifier; + config.sauceLabs.tunnelIdentifier = tunnelIdentifier; } const platformBrowsers = platformMap[testPlatform]; @@ -113,35 +116,6 @@ module.exports = (config) => { // and instance. config.browsers = browserInstanceChunks[instanceIndex]; } - - if (process.env['TRAVIS']) { - const buildId = `TRAVIS #${process.env.TRAVIS_BUILD_NUMBER} (${process.env.TRAVIS_BUILD_ID})`; - - // The MODE variable is the indicator of what row in the test matrix we're running. - // It will look like _, where platform is one of 'saucelabs', 'browserstack' - // or 'travis'. The target is a reference to different collections of browsers that can run - // in the previously specified platform. - // TODO(devversion): when moving Saucelabs and Browserstack to Circle, remove the target part. - const [platform] = process.env.MODE.split('_'); - - if (platform === 'saucelabs') { - config.sauceLabs.build = buildId; - config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_ID; - } else if (platform === 'browserstack') { - config.browserStack.build = buildId; - config.browserStack.tunnelIdentifier = process.env.TRAVIS_JOB_ID; - } else if (platform !== 'travis') { - throw new Error(`Platform "${platform}" unknown, but Travis specified. Exiting.`); - } - - if (platform !== 'travis') { - // To guarantee a better stability for tests running on external browsers, we disable - // concurrency. Stability is compared to speed more important. - config.concurrency = 1; - } - - config.browsers = platformMap[platform]; - } }; /** diff --git a/tools/gulp/tasks/ci.ts b/tools/gulp/tasks/ci.ts index ea22b5a8b39..e1a701affab 100644 --- a/tools/gulp/tasks/ci.ts +++ b/tools/gulp/tasks/ci.ts @@ -4,7 +4,8 @@ import {allBuildPackages} from '../packages'; task('ci:lint', ['lint']); -// Travis sometimes does not exit the process and times out. This is to prevent that. +// Gulp sometimes does not exit properly on CI. This is to prevent that. +// TODO(devversion): look if there is some blocking child process. task('ci:test', ['test:single-run'], () => process.exit(0)); task('ci:e2e', ['e2e']); diff --git a/tools/gulp/util/travis-ci.ts b/tools/gulp/util/travis-ci.ts deleted file mode 100644 index 7267fd99029..00000000000 --- a/tools/gulp/util/travis-ci.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** Whether gulp currently runs inside of Travis as a push. */ -export function isTravisMasterBuild() { - return process.env['TRAVIS_PULL_REQUEST'] === 'false'; -} - -export function isTravisBuild() { - return process.env['TRAVIS'] === 'true'; -}