Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

Commit

Permalink
Support Travis CI containers. Fixes #5.
Browse files Browse the repository at this point in the history
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 travis-ci/travis-ci#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).
  • Loading branch information
Greg Hendershott committed Jan 13, 2015
1 parent bf386bb commit ebbc14e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 33 deletions.
61 changes: 37 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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 <pkg>` 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 <pkg>` 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 <pkg>
# - /usr/racket/bin/raco test -x -p <pkg>
# - raco pkg install --deps search-auto --link <pkg>
# - raco test -x -p <pkg>

after_script:
34 changes: 25 additions & 9 deletions install-racket.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

INSTALLER="./racket-${RACKET_VERSION}.sh"

echo "Downloading $URL to $INSTALLER:"
curl -L -o $INSTALLER $URL

echo "Making $INSTALLER executable:"
chmod u+rx "$INSTALLER"

# Only use sudo if installing to /usr
if [[ "$RACKET_DIR" = /usr* ]]; then
RUN_INSTALLER="sudo ${INSTALLER}"
else
RUN_INSTALLER="${INSTALLER}"
fi

echo "Downloading $URL to $INSTALL:"
curl -L -o $INSTALL $URL
echo "Running $RUN_INSTALLER to install Racket:"

echo "Running $INSTALL to install Racket:"
chmod u+rx "$INSTALL"
sudo "$INSTALL" <<EOF
$RUN_INSTALLER <<EOF
no
/usr/racket
"$RACKET_DIR"
# EOF
EOF

exit 0

0 comments on commit ebbc14e

Please sign in to comment.