Skip to content

Commit

Permalink
Merge pull request #12387 from JuliaLang/tk/travis-fastfail
Browse files Browse the repository at this point in the history
RFC: fail fast on Travis for old queued builds in same PR or branch
  • Loading branch information
tkelman committed Jul 31, 2015
2 parents 448a31b + 5f56b9e commit 398cea6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ notifications:
- http://status.julialang.org/put/travis
- http://julia.mit.edu:8000/travis-hook
before_install:
- make check-whitespace
- if [ `uname` = "Linux" ]; then
sudo apt-get install jq -y;
contrib/travis_fastfail.sh || exit 1;
BUILDOPTS="-j3 USEGCC=1 LLVM_CONFIG=llvm-config-3.3 VERBOSE=1 USE_BLAS64=0 FORCE_ASSERTIONS=1 STAGE2_DEPS=utf8proc";
for lib in LLVM SUITESPARSE ARPACK BLAS FFTW LAPACK GMP MPFR LIBUNWIND OPENLIBM; do
export BUILDOPTS="$BUILDOPTS USE_SYSTEM_$lib=1";
Expand All @@ -39,6 +42,8 @@ before_install:
brew tap staticfloat/julia;
brew rm --force $(brew deps --HEAD julia);
brew update;
brew install -v jq;
contrib/travis_fastfail.sh || exit 1;
brew install -v --only-dependencies --HEAD julia;
BUILDOPTS="-j3 USECLANG=1 LLVM_CONFIG=$(brew --prefix llvm33-julia)/bin/llvm-config-3.3 VERBOSE=1 USE_BLAS64=0 SUITESPARSE_INC=-I$(brew --prefix suite-sparse-julia)/include FORCE_ASSERTIONS=1 STAGE2_DEPS=utf8proc";
BUILDOPTS="$BUILDOPTS LIBBLAS=-lopenblas LIBBLASNAME=libopenblas LIBLAPACK=-lopenblas LIBLAPACKNAME=libopenblas";
Expand All @@ -49,10 +54,9 @@ before_install:
export DYLD_FALLBACK_LIBRARY_PATH="/usr/local/lib:/lib:/usr/lib:$(brew --prefix openblas-julia)/lib:$(brew --prefix suite-sparse-julia)/lib:$(brew --prefix arpack-julia)/lib";
make $BUILDOPTS -C contrib -f repackage_system_suitesparse4.make;
fi
- git clone -q git://git.kitenet.net/moreutils
script:
- make check-whitespace || exit 1
- make $BUILDOPTS -C base version_git.jl.phony
- git clone -q git://git.kitenet.net/moreutils
- make $BUILDOPTS NO_GIT=1 JULIA_SYSIMG_BUILD_FLAGS="--output-ji ../usr/lib/julia/sys.ji" prefix=/tmp/julia install | moreutils/ts -s "%.s"
- if [ `uname` = "Darwin" ]; then
for name in suitesparseconfig spqr umfpack colamd cholmod amd suitesparse_wrapper; do
Expand Down
26 changes: 26 additions & 0 deletions contrib/travis_fastfail.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

curlhdr="Accept: application/vnd.travis-ci.2+json"
endpoint="https://api.travis-ci.org/repos/$TRAVIS_REPO_SLUG"

# Fail fast for superseded builds to PR's
if ! [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
if ! [ \"$TRAVIS_BUILD_NUMBER\" = $(curl -H "$curlhdr" $endpoint/builds?event_type=pull_request | \
jq ".builds | map(select(.pull_request_number == $TRAVIS_PULL_REQUEST))[0].number") ]; then
echo "There are newer queued builds for this pull request, failing early."
exit 1
fi
else
# And for non-latest push builds in branches other than master or release*
case $TRAVIS_BRANCH in
master | release*)
;;
*)
if ! [ \"$TRAVIS_BUILD_NUMBER\" = $(curl -H "$curlhdr" \
$endpoint/branches/$TRAVIS_BRANCH | jq ".branch.number") ]; then
echo "There are newer queued builds for this branch, failing early."
exit 1
fi
;;
esac
fi

0 comments on commit 398cea6

Please sign in to comment.