From 0a3d2332d8d708d0d6362535edf4c9c589060d61 Mon Sep 17 00:00:00 2001 From: Anton Bachin Date: Fri, 17 Jun 2016 15:24:11 -0500 Subject: [PATCH] Travis: test on 4.03 and improve matrix, script Before this commit, we were testing on 4.02 on Ubuntu and whatever version Homebrew had on OS X, which happened to be 4.03 - despite the build matrix claiming 4.02. Now explicitly testing on both 4.02 and 4.03 on both systems. The build script now checks which version of the compiler is actually installed. Removed the workaround for https://github.com/ocaml/opam/issues/1747. That was fixed in https://github.com/ocaml/opam/pull/1756. Remaining changes have to do with brevity (set -e instead of explicit checks, set -x instead of echo) and the new build matrix (no need to check for Linux when checking $COVERAGE). --- .travis.yml | 23 +++++++++---- src/travis_ci_test.sh | 80 ++++++++++++++++++++++--------------------- 2 files changed, 57 insertions(+), 46 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f0285a8..daefcb50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,18 @@ sudo: required -language: c + +language: generic + +matrix: + include: + - os: linux + env: OCAML_VERSION=4.02 + - os: linux + env: OCAML_VERSION=4.03 COVERALLS=yes + - os: linux + env: OCAML_VERSION=4.03 BYTECODE_ONLY=yes + - os: osx + env: OCAML_VERSION=4.02 + - os: osx + env: OCAML_VERSION=4.03 + script: bash -e ./src/travis_ci_test.sh -os: - - linux - - osx -env: - - OCAML_VERSION=4.02 OPAM_VERSION=1.2.0 COVERALLS=yes - - OCAML_VERSION=4.02 OPAM_VERSION=1.2.0 BYTECODE_ONLY=yes diff --git a/src/travis_ci_test.sh b/src/travis_ci_test.sh index d7cdb86e..e0a1be72 100644 --- a/src/travis_ci_test.sh +++ b/src/travis_ci_test.sh @@ -1,24 +1,39 @@ #!/usr/bin/env bash -export opam_pin_add="" -travis_install_on_linux () { - # Install OCaml and OPAM PPAs - case "$OCAML_VERSION,$OPAM_VERSION" in - 4.02,1.1.0) ppa=avsm/ocaml42+opam11 ;; - 4.02,1.2.0) ppa=avsm/ocaml42+opam12; export opam_pin_add="add" ;; - *) echo Unknown $OCAML_VERSION,$OPAM_VERSION; exit 1 ;; - esac +set -e +set -x - echo "yes" | sudo add-apt-repository ppa:$ppa +travis_install_on_linux () { + # Install OCaml and OPAM PPA + sudo add-apt-repository -y ppa:avsm/ocaml42+opam12 sudo apt-get update -qq - sudo apt-get install -qq ocaml ocaml-native-compilers camlp4-extra opam time git + case "$OCAML_VERSION" in + 4.02) + sudo apt-get install -qq ocaml-nox camlp4-extra opam time git + opam init -y ;; + 4.03) + sudo apt-get install -qq opam time git + opam init -y --compiler=4.03.0 ;; + *) + echo Unknown $OCAML_VERSION + exit 1 ;; + esac } travis_install_on_osx () { brew update > /dev/null brew install opam - export opam_pin_add="add" + + case "$OCAML_VERSION" in + 4.02) + opam init -y --compiler=4.02.3 ;; + 4.03) + opam init -y ;; + *) + echo Unknown $OCAML_VERSION + exit 1 ;; + esac } case $TRAVIS_OS_NAME in @@ -27,28 +42,18 @@ case $TRAVIS_OS_NAME in *) echo "Unknown $TRAVIS_OS_NAME"; exit 1 esac -export OPAMYES=1 - -# Set up OPAM -opam init $opam_init_options +# Prepare environment eval `opam config env` -# Configure and view settings -echo "ocaml -version" -ocaml -version -echo "opam --version" +# Check packages +ocaml -version | grep $OCAML_VERSION opam --version -echo "git --version" git --version -# Bypass opam bug #1747 -git config --global user.email "you@example.com" -git config --global user.name "Your Name" - echo echo "Install dependencies" echo -opam install ocamlfind ocamlbuild ppx_tools +opam install -y ocamlfind ocamlbuild ppx_tools GENERAL_PATH=$PATH RESTRICTED_PATH=$PATH @@ -75,7 +80,7 @@ echo make build export PATH=$GENERAL_PATH -opam install ounit ppx_blob ppx_deriving # Used in test suite. +opam install -y ounit ppx_blob ppx_deriving # Used in test suite. export PATH=$RESTRICTED_PATH echo @@ -111,18 +116,15 @@ echo "Testing package usage and Ocamlbuild plugin" echo make -C tests usage -if [ "$TRAVIS_OS_NAME" = linux ] +if [ "$COVERALLS" = yes ] then - if [ "$COVERALLS" = yes ] - then - echo - echo "Submitting coverage report" - echo - export PATH=$GENERAL_PATH - opam install -y ocveralls - make dev tests - make -C tests coverage - ocveralls --prefix _build.instrumented tests/_coverage/meta*.out --send - export PATH=$RESTRICTED_PATH - fi + echo + echo "Submitting coverage report" + echo + export PATH=$GENERAL_PATH + opam install -y ocveralls + make dev tests + make -C tests coverage + ocveralls --prefix _build.instrumented tests/_coverage/meta*.out --send + export PATH=$RESTRICTED_PATH fi