Skip to content

Commit

Permalink
Merge pull request #5 from domsj/travis
Browse files Browse the repository at this point in the history
setup travis build
  • Loading branch information
domsj committed Aug 4, 2015
2 parents 5dea7bf + a656b56 commit 31658ec
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: c
cache: apt
matrix:
include:
- os: linux
env: OCAML_VERSION=4.02.1 OPAM_VERSION=1.2.2

sudo: required
before_install: ./travis.sh before_install
install: ./travis.sh install
script: ./travis.sh script
git:
submodules: false
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ OCAML_FIND ?= ocamlfind
build:
ocamlbuild -use-ocamlfind -lflags -cclib,/usr/local/lib/librocksdb.so rocks.inferred.mli rocks.cma rocks.cmxa rocks.cmxs rocks_options.inferred.mli

build_test:
test:
ocamlbuild -use-ocamlfind -lflags -cclib,/usr/local/lib/librocksdb.so rocks_test.native rocks.inferred.mli rocks.cma rocks.cmxa rocks.cmxs

clean:
Expand Down
69 changes: 69 additions & 0 deletions travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash -xue

APT_DEPENDS="g++-4.8 build-essential"
APT_OCAML_DEPENDS="ocaml ocaml-native-compilers camlp4-extra opam"
OPAM_DEPENDS="ocamlfind ctypes.0.4.1 ctypes-foreign.0.4.0"

export OPAMYES=1
export OPAMVERBOSE=1
export OPAMCOLOR=never

before_install () {
echo "Running 'before_install' phase"

echo "Adding PPA"
sudo add-apt-repository "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main restricted universe multiverse"
sudo add-apt-repository "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted universe multiverse"
sudo add-apt-repository --yes ppa:avsm/ocaml42+opam12

echo "Updating Apt cache"
sudo apt-get update -qq

echo "Installing general dependencies"
sudo apt-get install -qq ${APT_DEPENDS}
echo "Installing dependencies"
sudo apt-get install -qq ${APT_OCAML_DEPENDS}

echo "OCaml versions:"
ocaml -version
ocamlopt -version

echo "Opam versions:"
opam --version
opam --git-version
}

install () {
echo "Running 'install' phase"

opam init
eval `opam config env`
opam update

opam install ${OPAM_DEPENDS}

CXX=g++-4.8 ./install_rocksdb.sh

make build test
}

script () {
echo "Running 'script' phase"

./rocks_test.native
}

case "$1" in
before_install)
before_install
;;
install)
install
;;
script)
script
;;
*)
echo "Usage: $0 {before_install|install|script}"
exit 1
esac

0 comments on commit 31658ec

Please sign in to comment.