From 346ebe39519c817a08d94846551cc3fbfd512a09 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Sun, 14 Dec 2014 04:32:08 -0800 Subject: [PATCH] Fail fast on AppVeyor for repeated commits to same PR Use AppVeyor's API! reuse cached version of jq instead of downloading every time make slightly more robust to network problems --- appveyor.yml | 1 + contrib/windows/msys_build.sh | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a1896b81fec9a..0e3b4b29b096b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 diff --git a/contrib/windows/msys_build.sh b/contrib/windows/msys_build.sh index 3d7e9640a715a..c09eff6da21c6 100755 --- a/contrib/windows/msys_build.sh +++ b/contrib/windows/msys_build.sh @@ -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://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` @@ -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