forked from xapi-project/xen-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis-opam-coverage.sh
38 lines (31 loc) · 1.4 KB
/
.travis-opam-coverage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# SUMMARY:
# Builds & tests xapi with coverage in a Ubuntu 16.04 Docker container with
# OCaml 4.04.2, then uploads the coverage information to coveralls.
set -ex
# Currently there is no way of specifying OPAM depexts for multiple versions of
# a given disto, and our current depexts only work with Ubuntu >= 16.04, due to
# a change in packages (libsystemd-dev). Since the build environments of Travis
# are older then Ubuntu 16.04, we have to run the build in a Docker container
# with an appropriate Ubuntu version.
# We need to pass some Travis environment variables to the container to enable
# uploading to coveralls and detection of Travis CI.
docker run --rm --volume=$PWD:/mnt --workdir=/mnt \
--env "TRAVIS=$TRAVIS" \
--env "TRAVIS_JOB_ID=$TRAVIS_JOB_ID" \
ocaml/opam:ubuntu-16.04_ocaml-4.04.2 \
bash -ex -c '
sudo apt-get update
sudo chown -R $(whoami) .
# replace the base remote with xs-opam
opam repository remove default
opam repository add xs-opam https://github.com/xapi-project/xs-opam.git
# install the dependencies of xapi
sudo apt install -y libpci-dev
opam pin add --no-action xapi .
opam depext --yes xapi
opam install --deps-only xapi
# build and test xapi with coverage, then submit the coverage information to coveralls
curl -O https://raw.githubusercontent.com/xapi-project/xapi-travis-scripts/master/coverage.sh
env TEST_CMD="./configure && jbuilder runtest" bash -ex coverage.sh
'