File: travis_fastfail.sh

package info (click to toggle)
julia 1.5.3%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 91,132 kB
  • sloc: lisp: 278,486; ansic: 60,186; cpp: 29,801; sh: 2,403; makefile: 1,998; pascal: 1,313; objc: 647; javascript: 516; asm: 226; python: 161; xml: 34
file content (28 lines) | stat: -rwxr-xr-x 1,066 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# This file is a part of Julia. License is MIT: https://julialang.org/license

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
  newestbuildforthisPR=$(curl -H "$curlhdr" $endpoint/builds?event_type=pull_request | \
      jq ".builds | map(select(.pull_request_number == $TRAVIS_PULL_REQUEST))[0].number")
  if [ $newestbuildforthisPR != null -a $newestbuildforthisPR != \"$TRAVIS_BUILD_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