diff --git a/.travis.yml b/.travis.yml index b04118f37a..76ae12163b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,23 @@ -sudo: required - language: c matrix: include: - os: linux - env: COMPILER=4.04 + env: OCAML_VERSION=4.04 - os: linux - env: COMPILER=4.05 + env: OCAML_VERSION=4.05 - os: linux - env: COMPILER=4.06 + env: OCAML_VERSION=4.06 - os: linux - env: COMPILER=4.07 + env: OCAML_VERSION=4.07 allow_failures: - os: linux - env: COMPILER=4.02 + env: OCAML_VERSION=4.02 - os: linux - env: COMPILER=4.03 + env: OCAML_VERSION=4.03 - os: osx - env: COMPILER=system + env: OCAML_VERSION=system fast_finish: true diff --git a/tools/travis.sh b/tools/travis.sh index f878e4aa7b..f8475d2305 100644 --- a/tools/travis.sh +++ b/tools/travis.sh @@ -1,94 +1,10 @@ set -x - - # Install system packages. -packages_apt () { - case $COMPILER in - 4.02) PPA=avsm/ocaml42+opam12;; - 4.03) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;; - 4.04) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;; - 4.05) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;; - 4.06) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;; - 4.07) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;; - *) echo Unsupported compiler $COMPILER; exit 1;; - esac - - sudo add-apt-repository -y ppa:$PPA - sudo apt-get update -qq - - if [ -z "$DO_SWITCH" ] - then - sudo apt-get install -qq ocaml-nox - fi - - sudo apt-get install -qq opam - -} - -packages_homebrew () { - brew update > /dev/null - - if [ "$COMPILER" = system ] - then - brew install ocaml - # The system compiler on Homebrew is now 4.06 or higher, and there is no - # system Camlp4 package compatible with that (at least not yet). See: - # https://github.com/ocaml/opam-repository/pull/10455 - HAVE_CAMLP4=no - else - DO_SWITCH=yes - fi - - brew install opam - -} - -packages_osx () { - case $PACKAGE_MANAGER in - *) packages_homebrew;; - esac -} - -packages () { - case $TRAVIS_OS_NAME in - linux) packages_apt;; - osx) packages_osx;; - *) echo Unsupported system $TRAVIS_OS_NAME; exit 1;; - esac -} +wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-ocaml.sh +bash -ex .travis-ocaml.sh -packages - - - -# Initialize OPAM and switch to the right compiler, if necessary. -case $COMPILER in - 4.02) OCAML_VERSION=4.02.3;; - 4.03) OCAML_VERSION=4.03.0;; - 4.04) OCAML_VERSION=4.04.2;; - 4.05) OCAML_VERSION=4.05.0;; - 4.06) OCAML_VERSION=4.06.0;; - 4.07) OCAML_VERSION=4.07.0;; - system) OCAML_VERSION=`ocamlc -version`;; - *) echo Unsupported compiler $COMPILER; exit 1;; -esac - -if [ "$FLAMBDA" = yes ] -then - SWITCH="$OCAML_VERSION+flambda" -else - SWITCH="$OCAML_VERSION" -fi - -if [ -n "$DO_SWITCH" ] -then - opam init --compiler=$SWITCH -y -a -else - opam init -y -a -fi - -eval `opam config env` +eval $(opam env) ACTUAL_COMPILER=`ocamlc -version` if [ "$ACTUAL_COMPILER" != "$OCAML_VERSION" ] @@ -97,7 +13,6 @@ then fi - # Pin Js_of_ocaml, install dependencies, and then install Js_of_ocaml. # Js_of_ocaml is installed # separately because we want to keep the build directory for running the tests.