Skip to content

Commit

Permalink
Fail fast on AppVeyor for repeated commits to same PR
Browse files Browse the repository at this point in the history
Use AppVeyor's API!

reuse cached version of jq instead of downloading every time

make slightly more robust to network problems
  • Loading branch information
tkelman committed Dec 14, 2014
1 parent e669ee3 commit 346ebe3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ cache:
- llvm-3.3-i686-w64-mingw32-juliadeps.7z
- llvm-3.3-x86_64-w64-mingw32-juliadeps.7z
- make-3.81-2-msys-1.0.11-bin.tar.lzma
- jq.exe

build_script:
# Remove C:\MinGW\bin from the path, the version of MinGW installed on
Expand Down
18 changes: 16 additions & 2 deletions contrib/windows/msys_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ cd `dirname "$0"`/../..
# Stop on error
set -e

# Fail fast on AppVeyor if there are newer pending commits in this PR
curlflags="curl --retry 10 -k -L -y 5"
if [ -n "$APPVEYOR_PULL_REQUEST_NUMBER" ]; then
# download a handy cli json parser
if ! [ -e jq.exe ]; then
$curlflags -O http:https://stedolan.github.io/jq/download/win64/jq.exe
fi
av_api_url="https://ci.appveyor.com/api/projects/StefanKarpinski/julia/history?recordsNumber=50"
query=".builds | map(select(.pullRequestId == \"$APPVEYOR_PULL_REQUEST_NUMBER\"))[0].buildNumber"
latestbuild="$(curl $av_api_url | ./jq "$query")"
if [ -n "$latestbuild" -a "$latestbuild" != "null" -a "$latestbuild" != "$APPVEYOR_BUILD_NUMBER" ]; then
echo "There are newer queued builds for this pull request, failing early."
exit 1
fi
fi

# If ARCH environment variable not set, choose based on uname -m
if [ -z "$ARCH" -a -z "$XC_HOST" ]; then
export ARCH=`uname -m`
Expand Down Expand Up @@ -61,8 +77,6 @@ case $(uname) in
;;
esac

curlflags="curl --retry 10 -k -L -y 5"

# Download most recent Julia binary for dependencies
if ! [ -e julia-installer.exe ]; then
f=julia-latest-win$bits.exe
Expand Down

0 comments on commit 346ebe3

Please sign in to comment.