Skip to content

How to use JuNest within Travis CI

Filippo Squillace edited this page Mar 13, 2016 · 2 revisions

This tutorial will explain how JuNest can help on running integration tests in a CI environment. Before reading this tutorial I would suggest you to read the travis getting started first.

Travis CI offers two different infrastructures for running CI:

  • Standard or Trusty Infrastructure
  • Container Based Infrastructure

The Standard infrastructure represents the legacy Travis infrastructure. It allows the use of sudo command which can be particularly useful, for instance, whenever apt packages needs to be installed. In order to automatically get a standard infrastructure you need to specify sudo:required inside .travis.yml file. The major flaw of running CI with the stander backend is that Standard infrastructure are pretty slow and the OS is an Ubuntu distro that contains old packages versions.

The Container based infrastructure has the major advantage that is by far much faster than the Standard infrastructure but is not allowed any use of sudo, setuid and setgid executables. The packages are installed via a whitelisted repository that, similarly to the Standard infrastructure, contains a limited number of packages and which most of them are pretty old.

Between both approaches is where JuNest shines. Combining JuNest with the Container based infrastructure allows to:

  • Have a wider varieties of packages available in the official and AUR Arch Linux repositories
  • Use the most updated package versions
  • Have pretty fast infrastructure that can start in few seconds

The following is an example of .travis.yml file that uses JuNest for installing the packages fish and zsh which represents the integration tests dependencies:

language: bash

before_install:
  - git clone git://github.com/fsquillace/junest ~/junest
  - PATH=~/junest/bin:$PATH
  - junest -f -- pacman --noconfirm -Sy fish zsh

script:
  - junest -- ./tests/tests.sh