Skip to content

Travis CI for Birch

Lawrence Murray edited this page Sep 28, 2020 · 1 revision

Travis CI is a continuous integration service that works alongside GitHub to run tests whenever new commits are made to a repository. Other such services include CircleCI and Bitrise, as well as standalone software such as Jenkins.

The main Birch repository has been migrated to CircleCI, but you may still wish to use Travis CI for your own projects. This page explains how.

After signing up for the Travis CI service, you will need to add a .travis.yml file to your code repository. A suggested template for Birch projects is as follows:

language: cpp
matrix:
    # macOS environment
    - os: osx
      compiler: clang
      osx_image: xcode10.3
      addons:
        homebrew:
          update: true
          packages:
            - flex
            - bison
            - eigen
            - libyaml
            - libomp

    # Ubuntu 16.04 environment
    - os: linux
      dist: xenial
      compiler: gcc
      addons:
        apt:
          packages:
            - autoconf
            - libtool
            - flex
            - bison
            - libeigen3-dev
            - libyaml-dev
            - libboost-all-dev
before_install:
  # Checkout Birch, which may be cached
  - git clone "https://github.com/lawmurray/Birch.git" || echo
  - cd Birch && git stash && git pull && git checkout master

  # Build what we need
  - cd driver && ./bootstrap && ./configure INSTALL="install -p" && make -j 2 && sudo make install && cd ..
  - cd libbirch && ./bootstrap && ./configure INSTALL="install -p" && make -j 2 && sudo make install && cd ..
  - cd libraries/Standard && birch build && sudo birch install && cd ../..

install:
  # Build and install own package
  - birch build && sudo birch install
script:
  - ./test.sh
cache:
  directories:
    - Birch

This sets up both macOS and Ubuntu builds, and caches dependencies to recompile them only when necessary.