Skip to content

Commit

Permalink
Add a TravisCI and opam file
Browse files Browse the repository at this point in the history
  • Loading branch information
clarus committed Mar 31, 2020
1 parent a0b5067 commit a6a9be1
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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'
18 changes: 18 additions & 0 deletions smart-print.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
opam-version: "2.0"
version: "dev"

maintainer: "[email protected]"
authors: ["Guillaume Claret <[email protected]>"]
homepage: "https://github.com/clarus/smart-print"
bug-reports: "https://github.com/clarus/smart-print/issues"
license: "BSD-3-Clause"

depends: [
"ocaml" {>= "4.00.0"}
"ocamlfind" {build}
"ocamlbuild" {build}
]
build: make
dev-repo: "git://github.com/clarus/smart-print"
install: [make "install"]
synopsis: "A pretty-printing library in OCaml"

0 comments on commit a6a9be1

Please sign in to comment.