#!/bin/bash #************************************************************************** #* * #* OCaml * #* * #* Anil Madhavapeddy, OCaml Labs * #* * #* Copyright 2014 Institut National de Recherche en Informatique et * #* en Automatique. * #* * #* All rights reserved. This file is distributed under the terms of * #* the GNU Lesser General Public License version 2.1, with the * #* special exception on linking described in the file LICENSE. * #* * #************************************************************************** PREFIX=~/local MAKE=make SHELL=dash # TRAVIS_COMMIT_RANGE has the form ... # TRAVIS_CUR_HEAD is # TRAVIS_PR_HEAD is # # The following diagram illustrates the relationship between # the commits: # # (trunk) (pr branch) # TRAVIS_CUR_HEAD TRAVIS_PR_HEAD # | / # … … # | / # TRAVIS_MERGE_BASE # echo TRAVIS_COMMIT_RANGE=$TRAVIS_COMMIT_RANGE TRAVIS_CUR_HEAD=${TRAVIS_COMMIT_RANGE%%...*} TRAVIS_PR_HEAD=${TRAVIS_COMMIT_RANGE##*...} case $TRAVIS_EVENT_TYPE in # If this is not a pull request then TRAVIS_COMMIT_RANGE may be empty. pull_request) TRAVIS_MERGE_BASE=$(git merge-base $TRAVIS_CUR_HEAD $TRAVIS_PR_HEAD);; esac BuildAndTest () { case $XARCH in i386) cat< /dev/null \ && CheckNoChangesMessage || echo pass } CheckNoChangesMessage () { if test -n "$(git log --grep="[Nn]o [Cc]hange.* needed" --max-count=1 ${TRAVIS_MERGE_BASE}..${TRAVIS_PR_HEAD})" then echo pass elif test -n "$(curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/issues/$TRAVIS_PULL_REQUEST/labels \ | grep 'no-change-entry-needed')" then echo pass else exit 1 fi } CheckTestsuiteModified () { cat< /dev/null \ && exit 1 || echo pass } case $CI_KIND in build) BuildAndTest;; changes) case $TRAVIS_EVENT_TYPE in pull_request) CheckChangesModified;; esac;; tests) case $TRAVIS_EVENT_TYPE in pull_request) CheckTestsuiteModified;; esac;; *) echo unknown CI kind exit 1 ;; esac