From ebbc14e18b058667b42c9fcca98893fd9fcb630c Mon Sep 17 00:00:00 2001 From: Greg Hendershott Date: Mon, 12 Jan 2015 14:12:57 -0500 Subject: [PATCH] Support Travis CI containers. Fixes #5. Change install-racket.sh to: - Use a RACKET_DIR env var saying where to install Racket. For backwards compatibility, if undefined this defaults to /usr/racket. - Don't use sudo unless installing to /usr*. - Download nightly snapshot builds from Northwestern not Utah. See https://github.com/travis-ci/travis-ci/issues/3012 - Fix the here string (which was slightly broken all along, although in a way that had been harmless). Change the example .travis.yml to: - Split env into global and matrix sections. - Specify RACKET_DIR as a global var. - Specify the RACKET_VERSIONs as matrix vars. - Set PATH from RACKET_DIR (because install-racket.sh can't do this -- it can't change the env for the .travis.yml). --- .travis.yml | 61 ++++++++++++++++++++++++++++------------------- install-racket.sh | 34 +++++++++++++++++++------- 2 files changed, 62 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 36f9997..be15dbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,44 +1,57 @@ language: c -# Supply at least one RACKET_VERSION environment variable definition -# here. RACKET_VERSION is used by the install-racket.sh script -# (specifed below under before_install) to select the version of -# Racket to download and install. +# Optional: To use Travis CI's newer container infrastucture, +# un-comment the following line. (Also be sure RACKET_DIR is set to +# somewhere like ~/racket that doesn't require sudo.) # -# If you supply more than one, you can create multiple builds (a -# Travis-CI build matrix resulting in multiple builds). You can use -# this to test against multiple Racket versions. +# sudo: false + env: - - RACKET_VERSION=5.3.4 - - RACKET_VERSION=5.3.5 - - RACKET_VERSION=5.92 - - RACKET_VERSION=6.0 - - RACKET_VERSION=6.1 - - RACKET_VERSION=6.1.1 - - RACKET_VERSION=HEAD + global: + # Supply a global RACKET_DIR environment variable. This is where + # Racket will be installed. A good idea is to use ~/racket because + # that doesn't require sudo to install and is therefore compatible + # with Travis CI's newer container infrastructure. + - RACKET_DIR=~/racket + matrix: + # Supply at least one RACKET_VERSION environment variable. This is + # used by the install-racket.sh script (run at before_install, + # below) to select the version of Racket to download and install. + # + # Supply more than one RACKET_VERSION (as in the example below) to + # create a Travis-CI build matrix to test against multiple Racket + # versions. + - RACKET_VERSION=5.3.4 + - RACKET_VERSION=5.3.5 + - RACKET_VERSION=5.92 + - RACKET_VERSION=6.0 + - RACKET_VERSION=6.1 + - RACKET_VERSION=6.1.1 + - RACKET_VERSION=HEAD before_install: -- git clone https://github.com/greghendershott/travis-racket.git -- cat travis-racket/install-racket.sh | bash # pipe to bash not sh! + - git clone https://github.com/greghendershott/travis-racket.git + - cat travis-racket/install-racket.sh | bash # pipe to bash not sh! + - export PATH="${RACKET_DIR}/bin:${PATH}" #install-racket.sh can't set for us install: before_script: -# Here supply steps such as raco make, raco test, etc. Note that you -# need to supply /usr/racket/bin/ -- it's not in PATH. You can run -# `raco pkg install --deps search-auto ` to install any required -# packages without it getting stuck on a confirmation prompt. +# Here supply steps such as raco make, raco test, etc. +# +# Tip: Use `raco pkg install --deps search-auto ` to install any +# required packages without getting stuck on a confirmation prompt. script: - - /usr/racket/bin/raco make main.rkt - - /usr/racket/bin/raco test -x . + - raco make main.rkt + - raco test -x . # NOTE: If your repo is a Racket package with an info.rkt that # includes some `deps`, the following is more elegant: # # script: # - cd .. # Travis did a cd into the dir. Back up, for the next: -# - /usr/racket/bin/raco pkg install --deps search-auto --link -# - /usr/racket/bin/raco test -x -p +# - raco pkg install --deps search-auto --link +# - raco test -x -p after_script: diff --git a/install-racket.sh b/install-racket.sh index cb36ea0..c385578 100755 --- a/install-racket.sh +++ b/install-racket.sh @@ -4,7 +4,7 @@ set -e if [[ "$RACKET_VERSION" = "HEAD" ]]; then - URL="http://www.cs.utah.edu/plt/snapshots/current/installers/racket-current-x86_64-linux-precise.sh" + URL="http://plt.eecs.northwestern.edu/snapshots/current/installers/racket-test-current-x86_64-linux-precise.sh" elif [[ "$RACKET_VERSION" = 5.9* ]]; then URL="http://download.racket-lang.org/installers/${RACKET_VERSION}/racket-${RACKET_VERSION}-x86_64-linux-ubuntu-quantal.sh" elif [[ "$RACKET_VERSION" = 6.* ]]; then @@ -13,17 +13,33 @@ else URL="http://download.racket-lang.org/installers/${RACKET_VERSION}/racket/racket-${RACKET_VERSION}-bin-x86_64-linux-debian-squeeze.sh" fi -INSTALL="./racket-${RACKET_VERSION}.sh" +# Older .travis.yml files don't set $RACKET_DIR (the Racket install +# directory) explicitly and expect it to be /usr/racket. +if [[ "$RACKET_DIR" = "" ]]; then + RACKET_DIR=/usr/racket +fi -echo "Downloading $URL to $INSTALL:" -curl -L -o $INSTALL $URL +INSTALLER="./racket-${RACKET_VERSION}.sh" -echo "Running $INSTALL to install Racket:" -chmod u+rx "$INSTALL" -sudo "$INSTALL" <