#!/bin/sh # This file is a part of Julia. License is MIT: https://julialang.org/license setglobal curlhdr = '"Accept: application/vnd.travis-ci.2+json'" setglobal endpoint = ""https://api.travis-ci.org/repos/$TRAVIS_REPO_SLUG"" # Fail fast for superseded builds to PR's if test $TRAVIS_PULL_REQUEST != "false" { setglobal newestbuildforthisPR = $[curl -H $curlhdr $endpoint/builds?event_type=pull_request | \ jq ".builds | map(select(.pull_request_number == $TRAVIS_PULL_REQUEST))[0].number] if test $newestbuildforthisPR != null -a $newestbuildforthisPR != '"'$TRAVIS_BUILD_NUMBER'"' { echo "There are newer queued builds for this pull request, failing early." exit 1 } } else { # And for non-latest push builds in branches other than master or release* match $TRAVIS_BRANCH { with master | release* with * if test '"'$TRAVIS_BUILD_NUMBER'"' != $[curl -H $curlhdr \ $endpoint/branches/$TRAVIS_BRANCH | jq ".branch.number] { echo "There are newer queued builds for this branch, failing early." exit 1 } } }