-
Notifications
You must be signed in to change notification settings - Fork 6
/
.travis.yml
60 lines (57 loc) · 2.04 KB
/
.travis.yml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
dist: trusty
sudo: required
language: generic
services:
- docker
env:
global:
- PACKAGE_NAME="smart-print"
matrix:
- OCAML_VERSION="4.02" SHOULD_SUPPORT="true"
- OCAML_VERSION="4.03" SHOULD_SUPPORT="true"
- OCAML_VERSION="4.04" SHOULD_SUPPORT="true"
- OCAML_VERSION="4.05" SHOULD_SUPPORT="true"
- OCAML_VERSION="4.06" SHOULD_SUPPORT="true"
- OCAML_VERSION="4.07" SHOULD_SUPPORT="true"
- OCAML_VERSION="4.08" SHOULD_SUPPORT="true"
- OCAML_VERSION="4.09" SHOULD_SUPPORT="true"
- OCAML_VERSION="4.10" SHOULD_SUPPORT="true"
install: |
# Prepare the Docker container
docker pull ocaml/opam2:${OCAML_VERSION}
docker run -d -i --init --name=CONTAINER -v ${TRAVIS_BUILD_DIR}:/home/project -w /home/project ocaml/opam2:${OCAML_VERSION}
docker exec CONTAINER /bin/bash --login -c "
# This bash script is double-quoted to interpolate Travis CI env vars:
echo \"Build triggered by ${TRAVIS_EVENT_TYPE}\"
export PS4='+ \e[33;1m(\$0 @ line \$LINENO) \$\e[0m '
set -ex # -e = exit on failure; -x = trace for debug
(cd /home/opam/opam-repository && git pull)
opam update
opam pin add ${PACKAGE_NAME}.opam . --kind=path --no-action
opam config list
opam repo list
opam pin list
opam list
" install
script:
- echo -e "${ANSI_YELLOW}Building...${ANSI_RESET}" && echo -en 'travis_fold:start:script\\r'
- |
docker exec CONTAINER /bin/bash --login -c "
export PS4='+ \e[33;1m(\$0 @ line \$LINENO) \$\e[0m '
set -ex
whoami
sudo chown -R opam:opam /home/project
export OPAMWITHTEST=true
# Check if the package is compatible with the current environment
if [ "${SHOULD_SUPPORT}" = "true" ] || opam install ${PACKAGE_NAME} --show-action; then
# First, install the dependencies
sudo apt-get update
opam depext ${PACKAGE_NAME} -y
opam install ${PACKAGE_NAME} --deps-only -y
opam list
# Then, install the package itself in verbose mode
opam install ${PACKAGE_NAME} -v
fi;
" script
- docker stop CONTAINER # optional
- echo -en 'travis_fold:end:script\\r'