build: use CI-provider independent variable names (#26377)
PR Close #26377
This commit is contained in:

committed by
Alex Rickabaugh

parent
b647608c96
commit
3b24e0edb6
@ -40,8 +40,15 @@ setEnvVar CHROMIUM_VERSION 561733 # Chrome 68 linux stable, see https://www.chr
|
||||
setEnvVar CHROMEDRIVER_VERSION_ARG "--versions.chrome 2.41"
|
||||
setEnvVar SAUCE_CONNECT_VERSION 4.4.9
|
||||
setEnvVar ANGULAR_CLI_VERSION 1.6.3
|
||||
setEnvVar AIO_MIN_PWA_SCORE 95
|
||||
setEnvVar CI_AIO_MIN_PWA_SCORE 95
|
||||
setEnvVar CI_BRANCH $TRAVIS_BRANCH
|
||||
setEnvVar CI_COMMIT $TRAVIS_COMMIT
|
||||
setEnvVar CI_COMMIT_RANGE $TRAVIS_COMMIT_RANGE
|
||||
setEnvVar CI_PULL_REQUEST $TRAVIS_PULL_REQUEST
|
||||
setEnvVar PROJECT_ROOT $(cd ${thisDir}/../..; pwd)
|
||||
# WARNING: Secrets (do not print).
|
||||
export CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN=$FIREBASE_TOKEN
|
||||
export CI_SECRET_PAYLOAD_FIREBASE_TOKEN=$ANGULAR_PAYLOAD_FIREBASE_TOKEN
|
||||
|
||||
if [[ ${TRAVIS:-} ]]; then
|
||||
case ${CI_MODE} in
|
||||
@ -83,7 +90,7 @@ if [[ ${TRAVIS:-} ]]; then
|
||||
# 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 [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ]; then
|
||||
if [ "${CI_PULL_REQUEST}" = "false" ] && [ "${CI_BRANCH}" = "master" ]; then
|
||||
setEnvVar SAUCE_USERNAME angular2-ci
|
||||
# Not using use `setEnvVar` so that we don't print the key.
|
||||
export SAUCE_ACCESS_KEY=693ebc16208a-0b5b-1614-8d66-a2662f4e
|
||||
|
@ -28,7 +28,10 @@ calculateSize() {
|
||||
checkSize() {
|
||||
name="$1"
|
||||
limitFile="$2"
|
||||
node ${PROJECT_ROOT}/scripts/ci/payload-size.js $limitFile $name $TRAVIS_BRANCH $TRAVIS_COMMIT
|
||||
|
||||
# In non-PR builds, `CI_BRANCH` is the branch being built (e.g. `pull/12345`), not the targeted branch.
|
||||
# Thus, PRs will fall back to using the size limits for `master`.
|
||||
node ${PROJECT_ROOT}/scripts/ci/payload-size.js $limitFile $name $CI_BRANCH $CI_COMMIT
|
||||
}
|
||||
|
||||
# Write timestamp to global variable `$payloadData`.
|
||||
@ -41,9 +44,9 @@ addTimestamp() {
|
||||
# Write travis commit message to global variable `$payloadData`.
|
||||
addMessage() {
|
||||
# Grab the set of SHAs for the message. This can fail when you force push or do initial build
|
||||
# because $TRAVIS_COMMIT_RANGE will contain the previous SHA which will not be in the
|
||||
# because $CI_COMMIT_RANGE may contain the previous SHA which will not be in the
|
||||
# force push or commit, hence we default to last commit.
|
||||
message=$(git log --oneline $TRAVIS_COMMIT_RANGE -- || git log --oneline -n1)
|
||||
message=$(git log --oneline $CI_COMMIT_RANGE -- || git log --oneline -n1)
|
||||
message=$(echo $message | sed 's/\\/\\\\/g' | sed 's/"/\\"/g')
|
||||
payloadData="$payloadData\"message\": \"$message\""
|
||||
}
|
||||
@ -53,8 +56,8 @@ addMessage() {
|
||||
# Update the change source in global variable `$payloadData`.
|
||||
addChange() {
|
||||
yarnChanged=false
|
||||
allChangedFiles=$(git diff --name-only $TRAVIS_COMMIT_RANGE $parentDir | wc -l)
|
||||
allChangedFileNames=$(git diff --name-only $TRAVIS_COMMIT_RANGE $parentDir)
|
||||
allChangedFiles=$(git diff --name-only $CI_COMMIT_RANGE $parentDir | wc -l)
|
||||
allChangedFileNames=$(git diff --name-only $CI_COMMIT_RANGE $parentDir)
|
||||
|
||||
if [[ $allChangedFileNames == *"yarn.lock"* ]]; then
|
||||
yarnChanged=true
|
||||
@ -82,14 +85,14 @@ uploadData() {
|
||||
|
||||
echo $payloadData > /tmp/current.log
|
||||
|
||||
readonly safeBranchName=$(echo $TRAVIS_BRANCH | sed -e 's/\./_/g')
|
||||
readonly safeBranchName=$(echo $CI_BRANCH | sed -e 's/\./_/g')
|
||||
|
||||
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
|
||||
readonly dbPath=/payload/$name/$safeBranchName/$TRAVIS_COMMIT
|
||||
if [[ "$CI_PULL_REQUEST" == "false" ]]; then
|
||||
readonly dbPath=/payload/$name/$safeBranchName/$CI_COMMIT
|
||||
|
||||
# WARNING: FIREBASE_TOKEN should NOT be printed.
|
||||
# WARNING: CI_SECRET_PAYLOAD_FIREBASE_TOKEN should NOT be printed.
|
||||
set +x
|
||||
$NODE_MODULES_BIN/firebase database:update --data "$payloadData" --project $PROJECT_NAME --confirm --token "$ANGULAR_PAYLOAD_FIREBASE_TOKEN" $dbPath
|
||||
$NODE_MODULES_BIN/firebase database:update --data "$payloadData" --project $PROJECT_NAME --confirm --token "$CI_SECRET_PAYLOAD_FIREBASE_TOKEN" $dbPath
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ function publishAllBuilds() {
|
||||
}
|
||||
|
||||
# See docs/DEVELOPER.md for help
|
||||
CUR_BRANCH=${CIRCLE_BRANCH:-$(git symbolic-ref --short HEAD)}
|
||||
CUR_BRANCH=${CI_BRANCH:-$(git symbolic-ref --short HEAD)}
|
||||
if [ $# -gt 0 ]; then
|
||||
ORG=$1
|
||||
publishAllBuilds "ssh"
|
||||
|
@ -15,7 +15,7 @@ source ${thisDir}/_travis-fold.sh
|
||||
# Run PWA-score tests
|
||||
# (Run before unit and e2e tests, which destroy the `dist/` directory.)
|
||||
travisFoldStart "test.aio.pwaScore"
|
||||
yarn test-pwa-score-localhost $AIO_MIN_PWA_SCORE
|
||||
yarn test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
|
||||
travisFoldEnd "test.aio.pwaScore"
|
||||
|
||||
# Run unit tests
|
||||
|
@ -21,7 +21,7 @@ source ${thisDir}/_travis-fold.sh
|
||||
# Run PWA-score tests
|
||||
# (Run before unit and e2e tests, which destroy the `dist/` directory.)
|
||||
travisFoldStart "test.aio.pwaScore"
|
||||
yarn test-pwa-score-localhost $AIO_MIN_PWA_SCORE
|
||||
yarn test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
|
||||
travisFoldEnd "test.aio.pwaScore"
|
||||
|
||||
# Check the bundle sizes.
|
||||
|
Reference in New Issue
Block a user