Skip to content

Commit

Permalink
chore: added presubmit-queue to travis
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery authored and travis@travis-ci.org committed Jul 28, 2015
1 parent 4cfe92c commit c5f8c95
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ env:
# This SSO token belongs to github account angular-github-ratelimit-token which has no access
# (password is in Valentine)
- TSDRC='{"token":"ef474500309daea53d5991b3079159a29520a40b"}'
# GITHUB_TOKEN_ANGULAR
- secure: "fq/U7VDMWO8O8SnAQkdbkoSe2X92PVqg4d044HmRYVmcf6YbO48+xeGJ8yOk0pCBwl3ISO4Q2ot0x546kxfiYBuHkZetlngZxZCtQiFT9kyId8ZKcYdXaIW9OVdw3Gh3tQyUwDucfkVhqcs52D6NZjyE2aWZ4/d1V4kWRO/LMgo="
matrix:
- MODE=js DART_CHANNEL=dev
# Make slowest build on top, so that we don't hog VMs while waiting for others to complete.
- MODE=dart DART_CHANNEL=stable
- MODE=dart DART_CHANNEL=dev
- MODE=dart_experimental DART_CHANNEL=dev
- MODE=saucelabs DART_CHANNEL=dev
- MODE=js DART_CHANNEL=dev
# Dissabled until we can make it pass.
# - MODE=saucelabs DART_CHANNEL=dev

matrix:
matrix:
allow_failures:
- env: "MODE=saucelabs DART_CHANNEL=dev"

Expand All @@ -61,12 +65,14 @@ install:

before_script:
- mkdir -p $LOGS_DIR
- ./scripts/ci/presubmit-queue-setup.sh

script:
- ./scripts/ci/build_and_test.sh ${MODE}

after_script:
- ./scripts/ci/print-logs.sh
- ./scripts/ci/after-script.sh

notifications:
webhooks:
Expand Down
28 changes: 28 additions & 0 deletions scripts/ci/after-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -e -o pipefail

echo '*******************'
echo '** AFTER_SUCCESS **'
echo '*******************'


echo '---------------------'
echo '-- WAIT FOR OTHERS --'
echo '---------------------'

curl -Lo travis_after_all.py https://raw.github.com/jbdeboer/travis_after_all/master/travis_after_all.py
python travis_after_all.py
. .to_export_back

echo BUILD_LEADER=$BUILD_LEADER
echo BUILD_AGGREGATE_STATUS=$BUILD_AGGREGATE_STATUS

if [ "$BUILD_LEADER" = "YES" ]; then
if [ "$BUILD_AGGREGATE_STATUS" = "others_succeeded" ]; then
./scripts/ci/presubmit-queue-success.sh
else
echo "ERROR: Some Failed, not submitting"
fi
else
echo "ERROR: Other builds have not finished, not submitting"
fi
20 changes: 20 additions & 0 deletions scripts/ci/presubmit-queue-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -e -o pipefail

if [ "$TRAVIS_REPO_SLUG" = "angular/angular" ]; then
if [[ $TRAVIS_BRANCH == "presubmit-"* ]]; then

echo '*********************'
echo '** PRESUBMIT SETUP **'
echo '*********************'

git config credential.helper "store --file=.git/credentials"
# travis encrypt GITHUB_TOKEN_ANGULAR=??? --repo=angular/angular
echo "https://${GITHUB_TOKEN_ANGULAR}:@github.com" > .git/credentials
git config user.name "travis@travis-ci.org"

git remote add upstream https://github.com/angular/angular.git
git fetch upstream master
git rebase upstream/master
fi
fi
44 changes: 44 additions & 0 deletions scripts/ci/presubmit-queue-success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
set -e -o pipefail

# If we're on the presubmit branch, the dev Dart release, and all unit
# tests pass, merge the presubmit branch into master and push it.


CHANNEL=`echo $JOB | cut -f 2 -d -`
SHA=`git rev-parse HEAD`

echo Current channel is: $CHANNEL
echo Current branch is: $TRAVIS_BRANCH
echo Test result is: $TRAVIS_TEST_RESULT

if [ "$TRAVIS_REPO_SLUG" = "angular/angular" ]; then
if [ $TRAVIS_TEST_RESULT -eq 0 ] && [[ $TRAVIS_BRANCH == "presubmit-"* ]]; then
echo '***************'
echo '** PRESUBMIT **'
echo '***************'
echo
echo "Pushing HEAD to master..."
git stash
git fetch upstream master
git rebase upstream/master
if git push upstream HEAD:master; then
echo "$TRAVIS_BRANCH has been merged into master, deleting..."
git push upstream :"$TRAVIS_BRANCH"
else
COMITTER_EMAIL=`git --no-pager show -s --format='%cE' HEAD`
echo Sending failure email to ${COMITTER_EMAIL}
mail \
-s "Failed to merge branch $TRAVIS_BRANCH to master" \
${COMMITTER_EMAIL} \
<< EOM
Your travis branch ${TRAVIS_BRANCH} failed!
https://travis-ci.org/angular/angular/builds/${TRAVIS_JOB_ID}
Please take a look.
EOM
fi
fi
fi
`

0 comments on commit c5f8c95

Please sign in to comment.