2018-10-23 09:34:45 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-12-20 08:49:22 -05:00
|
|
|
# Variables
|
2019-02-17 13:38:37 -05:00
|
|
|
readonly projectDir=$(realpath "$(dirname ${BASH_SOURCE[0]})/..")
|
|
|
|
readonly envHelpersPath="$projectDir/.circleci/env-helpers.inc.sh";
|
|
|
|
readonly getCommitRangePath="$projectDir/.circleci/get-commit-range.js";
|
2018-12-20 08:49:22 -05:00
|
|
|
|
|
|
|
# Load helpers and make them available everywhere (through `$BASH_ENV`).
|
2018-10-23 09:34:45 -04:00
|
|
|
source $envHelpersPath;
|
|
|
|
echo "source $envHelpersPath;" >> $BASH_ENV;
|
|
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
# Define PUBLIC environment variables for CircleCI.
|
|
|
|
####################################################################################################
|
2019-01-04 14:58:33 -05:00
|
|
|
# See https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables for more info.
|
|
|
|
####################################################################################################
|
2019-02-17 13:38:37 -05:00
|
|
|
setPublicVar PROJECT_ROOT "$projectDir";
|
2018-10-23 09:34:45 -04:00
|
|
|
setPublicVar CI_AIO_MIN_PWA_SCORE "95";
|
|
|
|
# This is the branch being built; e.g. `pull/12345` for PR builds.
|
|
|
|
setPublicVar CI_BRANCH "$CIRCLE_BRANCH";
|
2019-09-07 11:48:51 -04:00
|
|
|
setPublicVar CI_BUILD_URL "$CIRCLE_BUILD_URL";
|
2019-02-01 16:40:33 -05:00
|
|
|
# ChromeDriver version compatible with the Chrome version included in the docker image used in
|
|
|
|
# `.circleci/config.yml`. See http://chromedriver.chromium.org/downloads for a list of versions.
|
|
|
|
# This variable is intended to be passed as an arg to the `webdriver-manager update` command (e.g.
|
|
|
|
# `"postinstall": "webdriver-manager update $CI_CHROMEDRIVER_VERSION_ARG"`).
|
2019-06-17 13:17:19 -04:00
|
|
|
setPublicVar CI_CHROMEDRIVER_VERSION_ARG "--versions.chrome 75.0.3770.90";
|
2018-10-23 09:34:45 -04:00
|
|
|
setPublicVar CI_COMMIT "$CIRCLE_SHA1";
|
2019-09-07 11:48:51 -04:00
|
|
|
# `CI_COMMIT_RANGE` is only used on push builds (a.k.a. non-PR, non-scheduled builds and rerun
|
|
|
|
# workflows of such builds).
|
|
|
|
# NOTE: With [CircleCI Pipelines](https://circleci.com/docs/2.0/build-processing) enabled,
|
|
|
|
# `CIRCLE_COMPARE_URL` is no longer available and the commit range cannot be reliably
|
|
|
|
# detected. Fall back to only considering the last commit (which is accurate in the majority
|
|
|
|
# of cases for push builds).
|
|
|
|
setPublicVar CI_COMMIT_RANGE "`[[ ${CIRCLE_PR_NUMBER:-false} != false ]] && echo "" || echo "$CIRCLE_SHA1~1...$CIRCLE_SHA1"`";
|
2018-10-23 09:34:45 -04:00
|
|
|
setPublicVar CI_PULL_REQUEST "${CIRCLE_PR_NUMBER:-false}";
|
|
|
|
setPublicVar CI_REPO_NAME "$CIRCLE_PROJECT_REPONAME";
|
|
|
|
setPublicVar CI_REPO_OWNER "$CIRCLE_PROJECT_USERNAME";
|
|
|
|
|
|
|
|
|
2019-04-25 06:59:16 -04:00
|
|
|
####################################################################################################
|
|
|
|
# Define "lazy" PUBLIC environment variables for CircleCI.
|
|
|
|
# (I.e. functions to set an environment variable when called.)
|
|
|
|
####################################################################################################
|
|
|
|
createPublicVarSetter CI_STABLE_BRANCH "\$(npm info @angular/core dist-tags.latest | sed -r 's/^\\s*([0-9]+\\.[0-9]+)\\.[0-9]+.*$/\\1.x/')";
|
|
|
|
|
|
|
|
|
2018-10-23 09:34:45 -04:00
|
|
|
####################################################################################################
|
|
|
|
# Define SECRET environment variables for CircleCI.
|
|
|
|
####################################################################################################
|
|
|
|
setSecretVar CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN "$AIO_DEPLOY_TOKEN";
|
|
|
|
setSecretVar CI_SECRET_PAYLOAD_FIREBASE_TOKEN "$ANGULAR_PAYLOAD_TOKEN";
|
|
|
|
|
|
|
|
|
2019-01-04 14:58:33 -05:00
|
|
|
####################################################################################################
|
|
|
|
# Define SauceLabs environment variables for CircleCI.
|
|
|
|
####################################################################################################
|
|
|
|
# In order to have a meaningful SauceLabs badge on the repo page,
|
|
|
|
# the angular2-ci account is used only when pushing commits to master;
|
|
|
|
# in all other cases, the regular angular-ci account is used.
|
|
|
|
if [ "${CI_PULL_REQUEST}" = "false" ] && [ "${CI_REPO_OWNER}" = "angular" ] && [ "${CI_BRANCH}" = "master" ]; then
|
|
|
|
setPublicVar SAUCE_USERNAME "angular2-ci";
|
|
|
|
setSecretVar SAUCE_ACCESS_KEY "693ebc16208a-0b5b-1614-8d66-a2662f4e";
|
|
|
|
else
|
|
|
|
setPublicVar SAUCE_USERNAME "angular-ci";
|
|
|
|
setSecretVar SAUCE_ACCESS_KEY "9b988f434ff8-fbca-8aa4-4ae3-35442987";
|
|
|
|
fi
|
2019-08-13 13:47:11 -04:00
|
|
|
# TODO(josephperrott): Remove environment variables once all saucelabs tests are via bazel method.
|
2019-03-03 12:36:05 -05:00
|
|
|
setPublicVar SAUCE_LOG_FILE /tmp/angular/sauce-connect.log
|
2019-01-04 14:58:33 -05:00
|
|
|
setPublicVar SAUCE_READY_FILE /tmp/angular/sauce-connect-ready-file.lock
|
|
|
|
setPublicVar SAUCE_PID_FILE /tmp/angular/sauce-connect-pid-file.lock
|
|
|
|
setPublicVar SAUCE_TUNNEL_IDENTIFIER "angular-${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_INDEX}"
|
|
|
|
# Amount of seconds we wait for sauceconnect to establish a tunnel instance. In order to not
|
|
|
|
# acquire CircleCI instances for too long if sauceconnect failed, we need a connect timeout.
|
|
|
|
setPublicVar SAUCE_READY_FILE_TIMEOUT 120
|
|
|
|
|
2019-03-18 14:25:19 -04:00
|
|
|
####################################################################################################
|
|
|
|
# Define environment variables for the Angular Material unit tests job.
|
|
|
|
####################################################################################################
|
|
|
|
# We specifically use a directory within "/tmp" here because we want the cloned repo to be
|
|
|
|
# completely isolated from angular/angular in order to avoid any bad interactions between
|
|
|
|
# their separate build setups.
|
|
|
|
setPublicVar MATERIAL_REPO_TMP_DIR "/tmp/material2"
|
|
|
|
setPublicVar MATERIAL_REPO_URL "https://github.com/angular/material2.git"
|
2019-07-23 16:54:56 -04:00
|
|
|
setPublicVar MATERIAL_REPO_BRANCH "master"
|
|
|
|
# **NOTE**: When updating the commit SHA, also update the cache key in the CircleCI "config.yml".
|
2019-10-03 05:45:44 -04:00
|
|
|
setPublicVar MATERIAL_REPO_COMMIT "361d1cf800641a6e77321c5d43d97ed854310b9a"
|
2019-01-04 14:58:33 -05:00
|
|
|
|
2018-10-23 09:34:45 -04:00
|
|
|
# Source `$BASH_ENV` to make the variables available immediately.
|
|
|
|
source $BASH_ENV;
|