Sunday, February 10, 2013

Testing OCaml projects on Travis CI

Update (Oct 2013): Anil  Madhavapeddy has fleshed this out further.

This evening I spent some time getting unit tests for my OCaml projects to run on Travis CI, a free service for continuous integration on public GitHub projects. Although Travis has no built-in OCaml environment, it's straightforward to hijack its C environment to install OCaml and OPAM, then build an OCaml project and run its tests.

1. Perform the initial setup to get Travis CI watching your GitHub repo (up to and including step two of that guide).

2. Add a .travis.yml file to the root of your repo, with these contents:

language: c
script: bash -ex travis-ci.sh

3. Fill in travis-ci.sh, also in the repo root, with something like this:

# OPAM version to install
export OPAM_VERSION=0.9.1
# OPAM packages needed to build tests
export OPAM_PACKAGES='ocamlfind ounit'

# install ocaml from apt
sudo apt-get update -qq
sudo apt-get install -qq ocaml

# install opam
curl -L https://github.com/OCamlPro/opam/archive/${OPAM_VERSION}.tar.gz | tar xz -C /tmp
pushd /tmp/opam-${OPAM_VERSION}
./configure
make
sudo make install
opam init
eval `opam config -env`
popd

# install packages from opam
opam install -q -y ${OPAM_PACKAGES}

# compile & run tests (here assuming OASIS DevFiles)
./configure --enable-tests
make test

4. Add and commit these two new files, and push to GitHub. Travis CI will then execute the tests.

Working examples: ForkWorkyajl-ocaml

Installing OCaml and OPAM add less than two minutes of overhead, leaving plenty of room for your tests within the stated 15-20 minute time limit for open-source builds. I'm sure the above steps could be used as the basis for an eventual OCaml+OPAM environment built-in to Travis CI.

19 comments:

  1. UNIT TESTING is a degree of programming testing where singular units/parts of a product are tried develop website like UrbanClap and enjoy.

    ReplyDelete
  2. Each person is a person with his own set of qualities and character traits. But no matter how rich, successful or colombian brides good you are, real happiness can only be felt when a loving person is around. Agree, the time spent with loved ones is the brightest and most sensual moments of life.

    ReplyDelete
  3. BVK FRESHENERS specializes in manufacturing automotive and household air fresheners.In order to satisfy the demand of the cosmetics market we offer top quality modernly designed fresheners produced on the basis of aromas by world's leading fragrance manufacturers.

    car perfume spray
    tasotti home perfume

    ReplyDelete
  4. Green Pure and Clean is more than just bleach in a bucket. There are safety protocols and standards to be met to ensure all jobs are done correctly and thoroughly for anyone entering the site. All of our technicians are thoroughly trained to handle any environment. For us, when it comes to health and safety, there's no room for error.


    post construction cleaning services

    house cleaning move out

    ReplyDelete
  5. Our mission is to provide a fast, user-friendly, and customer service-oriented online shopping experience at The Urban Dwelling. We have gone to great lengths through our years of industry experience to offer the best quality home decor to our customers at affordable prices, as we know our customers will always be the key to our success.

    floor lamps chicago

    wall sconces in chicago

    ReplyDelete
  6. Our goal is to provide honest, competent, and trustworthy service to our customers. Our mission is to offer home loans to clients at the most affordable interest rates and closing costs. We also promise to assist borrowers with any obstacles that may arise when securing a loan.

    usda loan md

    down payment assistance maryland

    ReplyDelete
  7. Artistry & Fortitude, an online clothing shop owned by blacks, offers a wide range of products. Get an influencer shirt now to make the world a better place.
    president obama t shirts

    nelson mandela t shirt

    ReplyDelete
  8. The best 100% Natural Vitamins, Supplements, Multivitamins & more! Discount prices & free shipping. Vytanutra is your place for healthy living and eating.


    herbal supplements

    eye health supplements

    ReplyDelete
  9. We help petroleum refiners, renewal fuel manufacturers, chemical and pharmaceutical industries with quality assurance programs to consistently meet specifications, and regulatory requirements using cost effective spectroscopic means of analysis. Here, we are verified and authentic to provide the best petroleum services for all our clients and customers.

    portable fuel analyzer

    Series 4000 SFC

    ReplyDelete
  10. MindinMotion professional production company we are always excited to work with new and amazing projects.Since then we've done with five feature films and dozens of commercials, corporate, marketing videos for different clients. We Are Focused Professional Production Company which is Creating Compelling & Story-Driven Film and Commercial Content.


    post production services

    color correction services

    ReplyDelete
  11. Alibaba restaurant features the most delicious Mediterranean cuisine. If you are looking for a Mediterranean restaurant at long beach, we fit the bill for you


    mediterranean appetizers

    ReplyDelete
  12. Green Pure and Clean is more than just bleach in a bucket. There are safety protocols and standards to be met to ensure all jobs are done correctly and thoroughly for anyone entering the site. All of our technicians are thoroughly trained to handle any environment. For us, when it comes to health and safety, there's no room for error.

    apartment cleaners

    housecleaning services

    ReplyDelete
  13. We begin by facilitating door-to-door food delivery. GoDysh aims to get your great food delivered through a click, so you can have more time for yourself.


    Order Food Online In San Ramon

    Hayward Food Delivery Near Me

    ReplyDelete
  14. royal plaza casino | Online Games | Panda dan Agen 우리카지노 우리카지노 カジノ シークレット カジノ シークレット 온라인카지노 온라인카지노 638Hard Rock Hotel Panama Megapolis

    ReplyDelete
  15. xn--o80b910a26eepc81il5g.online
    › search 11bet › tags › xn--o80b910a26eepc81 우리카지노 계열사 › search 온라인카지노 › tags › xn--o80b910a26eepc81

    ReplyDelete
  16. Since I know what it feels like to be in pain and have sleepless nights. My goal through Live Wild CBD is to help athletes and other people, in general, attain relief. CBD worked for me to overcome my pain; that's how I realized that I should offer the same relief for others in a similar situation as me.
    cbd oil in texas

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete