Compare commits

..

No commits in common. "master" and "v0.1" have entirely different histories.
master ... v0.1

6 changed files with 50 additions and 280 deletions

View File

@ -1,13 +1,17 @@
# IMPORTANT:
#
# This is NOT an example of a .travis.yml you would use in your own
# Racket project -- for that, see example/.travis.yml.
#
# Instead, this is used by this repo to test install-racket.sh.
language: racket
language: c
env:
- RACKET_VERSION=5.3.5
before_install:
- curl https://raw.github.com/greghendershott/travis-racket/master/install-racket.sh | sh
install:
before_script:
script:
- shellcheck install-racket.sh
- shellcheck test.sh
- ./test.sh
- /usr/racket/bin/raco make main.rkt
- /usr/racket/bin/raco test -x .
after_script:

View File

@ -1,40 +1,19 @@
# Deprecated
Experimenting with using Travis CI for a Racket project.
As of 2020-11-25 I no longer use Travis CI for my projects.
Until Travis CI gets built-in support for Racket, we can use the
`before_install` clause of `.travis.yml` to download and run the
Racket installer.
Instead I am using
[`setup-racket`](https://github.com/Bogdanp/setup-racket) with GitHub
Actions.
> **CAVEAT**: This downloads the ~75MB Racket installer and runs it
> for **each and every** build! In other words, this is a hack. The
> un-hack would be (IIUC) to add a Travis CI "cookbook" for Racket.
After maintaining this repo for eight years, I'm glad to pass the
baton.
To add this capability to your project, simply add the
[example `.travis.yml`](https://github.com/greghendershott/travis-racket/blob/master/.travis.yml)
to your repo. You may need to change its `script` section's `raco
make` and `raco test` parts.
If you're willing and able to pay Travis CI, you might still find this
repo useful. You can fork it. Someday, when there is a new version of
Racket, you might need to update the `install-racket.sh` script (as I
would have done, but won't be doing anymore).
Here's a "badge" showing the status for the `master` branch of this
repo:
I'm not going to "Archive" this repo -- which would make it read-only
for issues and pull-requests -- right away. So if you have any
questions, feel feee to open an issue. But eventually I probably
will archive it.
# Still want to use this? Here's the old README
Until/unless Travis CI gets built-in support for Racket, we can use
the `install:` section of `.travis.yml` to download and run the
installer for various versions and variants of Racket.
To use in your project, simply add the [example
`.travis.yml`](example/.travis.yml) to the root of your repo.
> **NOTE:** Use `example/.travis.yml` --- *not* the one in the root of
> this repo, which is intended to test this repo not your project.
You may need to make some small edits to the file, as explained in its
comments. Specifically:
- You may want to change the `RACKET_VERSION` values, depending on
which versions of Racket you intend to support.
- You may need to change its `script:` section to suit your project.
[![Build Status](https://travis-ci.org/greghendershott/travis-racket.png?branch=master)](https://travis-ci.org/greghendershott/travis-racket)

View File

@ -1,79 +0,0 @@
language: c
env:
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.
- RACKET_DIR=~/racket
matrix:
# Supply at least one RACKET_VERSION environment variable. This is
# used by the install-racket.sh script 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=6.3
- RACKET_VERSION=6.4
- RACKET_VERSION=6.5
- RACKET_VERSION=6.6
- RACKET_VERSION=6.7
- RACKET_VERSION=6.8
- RACKET_VERSION=6.9
- RACKET_VERSION=6.10
- RACKET_VERSION=6.11
- RACKET_VERSION=6.12
- RACKET_VERSION=7.0
- RACKET_VERSION=7.1
- RACKET_VERSION=7.2
- RACKET_VERSION=7.3
- RACKET_VERSION=7.4
- RACKET_VERSION=7.5
- RACKET_VERSION=7.6
- RACKET_VERSION=7.7
- RACKET_VERSION=7.8
- RACKET_VERSION=7.9
- RACKET_VERSION=7.9 RACKET_CS=1
# "HEAD" is a daily snapshot built from the `master` branch.
# This is the main variant of Racket that uses its own runtime.
- RACKET_VERSION=HEAD
# "HEADCS" is a daily snapshot built from the `master` branch.
# This is an experimental variant of Racket that uses Chez Scheme.
- RACKET_VERSION=HEADCS
# "RELEASE" is a release candidate that updates only during the
# weeks before a new release. The final release candidate should
# remain available until the next release cycle. As a result, you
# may leave this in your .travis.yml all the time. See:
# <https://pre-release.racket-lang.org/>.
- RACKET_VERSION=RELEASE
matrix:
# You may want to test against certain versions of Racket, without
# having them count against the overall success/failure. For example
# here we include the development versions:
allow_failures:
- env: RACKET_VERSION=HEAD
- env: RACKET_VERSION=HEADCS
- env: RACKET_VERSION=RELEASE
# Fast finish: Overall build result is determined as soon as any of
# its rows have failed, or, all of its rows that aren't allowed to
# fail have succeeded.
fast_finish: true
install:
- bash <(curl https://raw.githubusercontent.com/greghendershott/travis-racket/master/install-racket.sh)
- export PATH="${RACKET_DIR}/bin:${PATH}" #install-racket.sh can't set for us
# Here supply steps such as raco make, raco test, etc.
script:
- raco make main.rkt
- raco test -x .
# OR: If your repo is a Racket package with an info.rkt that has any
# `deps`:
#
# script:
# - raco pkg install --deps search-auto
# - raco setup -D --check-pkg-deps <your-package-name>
# - raco test -x -p <your-package-name>

136
install-racket.sh Executable file → Normal file
View File

@ -1,137 +1,17 @@
#!/bin/bash
#
# In the Travis CI environment `#!/bin/bash` won't suffice (it's here
# to make shellcheck happy and for convenience when using this script
# locally).
#
# Instead .travis.yml should pipe this script to bash (not to sh).
set -e
if [[ "$RACKET_MINIMAL" = "1" ]]; then
MIN="minimal-"
else
MIN=""
fi
URL="http://download.racket-lang.org/installers/$RACKET_VERSION/racket/racket-$RACKET_VERSION-bin-x86_64-linux-ubuntu-precise.sh"
INSTALL="./racket-$RACKET_VERSION.sh"
if [[ "$RACKET_NATIPKG" = "1" ]]; then
RACKET_NATIPKG="-natipkg"
else
RACKET_NATIPKG=""
fi
echo "Downloading $URL to $INSTALL:"
curl -o $INSTALL $URL
if [[ "$RACKET_CS" = "1" ]]; then
RACKET_CS="-cs"
else
RACKET_CS=""
fi
# If this section seems like a mess, it is, because reasons:
#
# - The download URL naming conventions have changed over the years.
#
# - The Linux version name has changed over the years.
#
# - From time to time a Racket download server has gone offline, in
# which case this file has been "hot fixed". In the absence of any
# clear resolution signal ("you can resume using the original
# server"), the hot fix remains in place (until maybe someday it
# needs to be hot fixed).
#
# On the one hand, it sucks. On the other hand, a large part of the
# "added value" of this repo that it deals with the suckage so that
# ordinary users need not. They can supply names for Racket versions
# and variants using a consistent naming scheme, and we'll try to make
# it work.
DL_BASE="https://www.cs.utah.edu/plt/installers"
# In theory either NWU or Utah should work for downloading snapshot
# a.k.a. HEAD builds. In practice, it varies from time to time.
## HEAD_BASE="https://plt.eecs.northwestern.edu/snapshots/current"
HEAD_BASE="https://www.cs.utah.edu/plt/snapshots/current"
if [[ "$RACKET_VERSION" = "HEADBC" ]]; then
if [[ "$RACKET_MINIMAL" = "1" ]]; then
URL="${HEAD_BASE}/installers/racket-minimal-current-x86_64-linux-precise-bc.sh"
else
URL="${HEAD_BASE}/installers/racket-current-x86_64-linux-precise-bc.sh"
fi
elif [[ "$RACKET_VERSION" = "HEADCS" || "$RACKET_VERSION" = "HEAD" ]]; then
if [[ "$RACKET_MINIMAL" = "1" ]]; then
URL="${HEAD_BASE}/installers/racket-minimal-current-x86_64-linux-xenial.sh"
else
URL="${HEAD_BASE}/installers/racket-current-x86_64-linux-xenial.sh"
fi
elif [[ "$RACKET_VERSION" = 5.3* ]]; then
if [[ "$RACKET_MINIMAL" = "1" ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-textual/racket-textual-${RACKET_VERSION}-bin-x86_64-linux-debian-squeeze.sh"
else
URL="${DL_BASE}/${RACKET_VERSION}/racket/racket-${MIN}${RACKET_VERSION}-bin-x86_64-linux-debian-squeeze.sh"
fi
elif [[ "$RACKET_VERSION" = "RELEASE" ]]; then
URL="https://pre-release.racket-lang.org/installers/racket-${MIN}current-x86_64-linux${RACKET_NATIPKG}.sh"
elif [[ "$RACKET_VERSION" = "RELEASECS" ]]; then
URL="https://pre-release.racket-lang.org/installers/racket-${MIN}current-x86_64-linux${RACKET_NATIPKG}-cs.sh"
elif [[ "$RACKET_VERSION" = 5.9* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux-ubuntu-quantal.sh"
elif [[ "$RACKET_VERSION" = 6.[0-4] ]] || [[ "$RACKET_VERSION" = 6.[0-4].[0-9] ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux-ubuntu-precise.sh"
elif [[ "$RACKET_VERSION" = 6.* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux${RACKET_NATIPKG}.sh"
elif [[ "$RACKET_VERSION" = 7.* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux${RACKET_NATIPKG}${RACKET_CS}.sh"
else
echo "ERROR: Unsupported version ${RACKET_VERSION}"
exit 1
fi
printf "%-25s" "${MIN}${RACKET_VERSION}${RACKET_NATIPKG}${RACKET_CS}"
echo "@ ${URL}"
if curl -I -L "$URL" 2>&1 | grep 404.Not.Found ; then
echo "Installer not available"
if [[ "$RACKET_VERSION" = "HEAD" ]]; then
echo "Did the build fail? Check the logs at ${HEAD_BASE}/log/"
fi
exit 1
fi
if [ -n "$TEST" ]; then
exit 0
fi
# 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-${MIN}${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 "Running $RUN_INSTALLER to install Racket:"
$RUN_INSTALLER <<EOF
echo "Running $INSTALL to install Racket:"
chmod u+rx "$INSTALL"
sudo "$INSTALL" <<EOF
no
"$RACKET_DIR"
1
EOF
if [[ "$RACKET_MINIMAL" = "1" ]]; then
echo "Minimal Racket: Installing packages for raco test..."
${RACKET_DIR}/bin/raco pkg install --auto --scope installation rackunit-lib compiler-lib
fi
exit 0

14
main.rkt Normal file
View File

@ -0,0 +1,14 @@
#lang racket
;; A comment.
(define (plus1 x)
(add1 x))
(define (minus1 x)
(sub1 x))
(module+ test
(require rackunit)
(check-equal? (plus1 1) 2)
(check-equal? (minus1 1) 0))

28
test.sh
View File

@ -1,28 +0,0 @@
#!/bin/bash
# In older Racket versions, there is a "MINIMAL" "flavor".
for VER in 6.4 6.3 6.2 6.2.1 6.1 6.1.1 6.0 6.0.1 5.93 5.92 5.3 5.3.6 5.3.5 5.3.4 5.3.3 5.3.2 5.3.1 ; do
for MIN in 0 1; do
TEST=1 RACKET_MINIMAL=$MIN RACKET_VERSION=$VER ./install-racket.sh || exit 1
done
done
# Starting with Racket 6.5, there is also a "NATIPKG" flavor.
for VER in 7.3 7.2 7.1 7.0 6.12 6.11 6.10 6.9 6.8 6.7 6.6 6.5 ; do
for MIN in 0 1; do
for NAT in 0 1; do
TEST=1 RACKET_MINIMAL=$MIN RACKET_NATIPKG=$NAT RACKET_VERSION=$VER ./install-racket.sh || exit 1
done
done
done
# Starting with Racket 7.4, there is also a "CS" flavor.
for VER in HEAD HEADBC HEADCS 7.9 7.8 7.7 7.6 7.5 7.4 ; do
for MIN in 0 1; do
for NAT in 0 1; do
for CS in 0 1; do
TEST=1 RACKET_MINIMAL=$MIN RACKET_NATIPKG=$NAT RACKET_CS=$CS RACKET_VERSION=$VER ./install-racket.sh || exit 1
done
done
done
done