Travis CI

Table of Contents

Testing SpECTRE with Travis CI

SpECTRE uses TravisCI for testing the code. Multiple build jobs (described below) are launched each time a pull request is submitted or updated. In addition, a daily cron job is run. Travis will also launch these build jobs each time you push to a branch on your fork of SpECTRE if you enable it. (Go to Travis, click on your name in the upper right corner, and then towards the bottom, enable testing on your fork of SpECTRE.)

For pull requests, you can view the Travis CI build by clicking on Details next to the Travis build failed or Travis build succeeded in the section for All checks have failed or All checks have passed towards the bottom of the pull request. You can login to Travis using your GitHub credentials in order to cancel your builds, and you should do so if you update your pull request while it is building.

What is tested

The Travis report lists the build jobs which will each have either a green check mark if it passes, a red X if it has failed, or a yellow binary if the build is in progress. Clicking on a build job will display the log of the build.

The following build jobs are launched:

How to perform the checks locally

Before pushing to GitHub and waiting for Travis to perform the checks it is useful to perform at least the following tests locally:

Travis setup

Troubleshooting

Precompiled Headers and ccache

Getting ccache to work with precompiled headers on TravisCI is a little challenging. The header to be precompiled is ${SPECTRE_SOURCE_DIR}/tools/SpectrePch.hpp and is symbolically linked to ${SPECTRE_BUILD_DIR}/SpectrePch.hpp. The configuration that seems to work is specifying the environment variables:

CCACHE_COMPILERCHECK=content
CCACHE_EXTRAFILES="${SPECTRE_SOURCE_DIR}/tools/SpectrePch.hpp"
CCACHE_IGNOREHEADERS="${SPECTRE_BUILD_DIR}/SpectrePch.hpp:${SPECTRE_BUILD_DIR}/SpectrePch.hpp.gch"

On macOS builds we haven't yet had success with using ccache with a precompiled header. We disable the precompiled header and build in debug mode only to have reasonable build times.

Build Stages

In order to avoid timeouts we build SpECTRE in various stages, carrying over the ccache from one stage to the next. This allows us to avoid recompiling the code in the next stage (there is some small overhead from running ccache instead of not doing anything at all). The first stage builds all the SpECTRE libraries but none of the executables or testing libraries. The second stage builds builds the test executables, runs the tests, and also runs ClangTidy, include-what-you-use, and various other checks. Another stage could be added that builds some of the test libraries if necessary.

Caching Dependencies on macOS Builds

On macOS builds we cache all of our dependencies, like LIBXSMM and Charm++. These are cached in $HOME/mac_cache. Ultimately this saves about 10-12 minutes even when compared to using ccache to cache the object files from building the dependencies. We also cache $HOME/Library/Caches/Homebrew, which is where Homebrew keeps the downloaded formulas. By caching the Homebrew bottles we are able to avoid brew formulas building from source because a tarball of the package was not available at the time.