Skip to content

Commit 5f56b9e

Browse files
committed
fail fast on Travis for multiple queued builds in same PR
Adjust installation of jq on osx --only-dependencies is not what I want there Rearrange travis steps before_install steps are fatal by default, script steps are not (travis runs all of them and marks the build as failed if any returns nonzero exit code) Fail faster on osx May as well do check-whitespace before installing deps Add fast fail for branch builds too Make sure branch section does not apply to PRs
1 parent a9b71c6 commit 5f56b9e

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ notifications:
2121
- http://status.julialang.org/put/travis
2222
- http://julia.mit.edu:8000/travis-hook
2323
before_install:
24+
- make check-whitespace
2425
- if [ `uname` = "Linux" ]; then
26+
sudo apt-get install jq -y;
27+
contrib/travis_fastfail.sh || exit 1;
2528
BUILDOPTS="-j3 USEGCC=1 LLVM_CONFIG=llvm-config-3.3 VERBOSE=1 USE_BLAS64=0 FORCE_ASSERTIONS=1 STAGE2_DEPS=utf8proc";
2629
for lib in LLVM SUITESPARSE ARPACK BLAS FFTW LAPACK GMP MPFR LIBUNWIND OPENLIBM; do
2730
export BUILDOPTS="$BUILDOPTS USE_SYSTEM_$lib=1";
@@ -39,6 +42,8 @@ before_install:
3942
brew tap staticfloat/julia;
4043
brew rm --force $(brew deps --HEAD julia);
4144
brew update;
45+
brew install -v jq;
46+
contrib/travis_fastfail.sh || exit 1;
4247
brew install -v --only-dependencies --HEAD julia;
4348
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";
4449
BUILDOPTS="$BUILDOPTS LIBBLAS=-lopenblas LIBBLASNAME=libopenblas LIBLAPACK=-lopenblas LIBLAPACKNAME=libopenblas";
@@ -49,10 +54,9 @@ before_install:
4954
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";
5055
make $BUILDOPTS -C contrib -f repackage_system_suitesparse4.make;
5156
fi
52-
- git clone -q git://git.kitenet.net/moreutils
5357
script:
54-
- make check-whitespace || exit 1
5558
- make $BUILDOPTS -C base version_git.jl.phony
59+
- git clone -q git://git.kitenet.net/moreutils
5660
- make $BUILDOPTS NO_GIT=1 JULIA_SYSIMG_BUILD_FLAGS="--output-ji ../usr/lib/julia/sys.ji" prefix=/tmp/julia install | moreutils/ts -s "%.s"
5761
- if [ `uname` = "Darwin" ]; then
5862
for name in suitesparseconfig spqr umfpack colamd cholmod amd suitesparse_wrapper; do

contrib/travis_fastfail.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
3+
curlhdr="Accept: application/vnd.travis-ci.2+json"
4+
endpoint="https://api.travis-ci.org/repos/$TRAVIS_REPO_SLUG"
5+
6+
# Fail fast for superseded builds to PR's
7+
if ! [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
8+
if ! [ \"$TRAVIS_BUILD_NUMBER\" = $(curl -H "$curlhdr" $endpoint/builds?event_type=pull_request | \
9+
jq ".builds | map(select(.pull_request_number == $TRAVIS_PULL_REQUEST))[0].number") ]; then
10+
echo "There are newer queued builds for this pull request, failing early."
11+
exit 1
12+
fi
13+
else
14+
# And for non-latest push builds in branches other than master or release*
15+
case $TRAVIS_BRANCH in
16+
master | release*)
17+
;;
18+
*)
19+
if ! [ \"$TRAVIS_BUILD_NUMBER\" = $(curl -H "$curlhdr" \
20+
$endpoint/branches/$TRAVIS_BRANCH | jq ".branch.number") ]; then
21+
echo "There are newer queued builds for this branch, failing early."
22+
exit 1
23+
fi
24+
;;
25+
esac
26+
fi

0 commit comments

Comments
 (0)