#!/bin/sh # tool/travis-ci-kick -- kick off a build at Travis CI # Richard Brooksby, Ravenbrook Limited, 2023-01-15 # # Copyright (c) 2023 Ravenbrook Limited. See end of file for license. # # This shell script uses the Travis CI REST API V3 to kick off a build # on the Travis CI servers. The build will be run using the Travis CI # configuration at the commit (in .travis.yml). # # See also tool/github-ci-kick. # # To get a token for this script, visit # and copy your token # from "API authentication". # # TODO: Extend this script to take MPS platform codes and kick off the # appropriate build, overriding the (possibly nonexistent) Travis Ci # config. See [TRAVIS]. # # TODO: Convert to Python for use from Windows? # # TODO: Make -t optional by getting AUTH-TOKEN from somewhere (secure). set -e # exit on error # defaults branch="master" org="Ravenbrook" repo="mps" usage() { echo 1>&2 "Usage: ${0} [-o ORG] [-r REPO] [-b BRANCH] [-c COMMIT-SHA] -t AUTH-TOKEN" exit 1 } while getopts o:r:b:c:t: flag; do case "${flag}" in c) commit="${OPTARG}";; b) branch="${OPTARG}";; o) org="${OPTARG}";; r) repo="${OPTARG}";; t) auth="${OPTARG}";; *) usage;; esac done test -z "${auth}" && usage # If the field "sha" is omitted, Travis CI builds the tip of the # branch [TRAVIS]. if test -z "${commit}"; then cat <<-EOF { "request": { "branch":"${branch}" } } EOF else cat <. # # # B. DOCUMENT HISTORY # # 2023-01-15 RB Created. # # C. COPYRIGHT AND LICENSE # # Copyright (C) 2023 Ravenbrook Limited . # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the # distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # $Id$