Continuous Integration with Travis CI
Travis CIA bit of a late-comer to this game, I’ve just discovered the merits of so-called “continuous integration”. In a Journal of Open Source Software (JOSS) review for stripy, one of the reviewers suggested Travis CI as a way to test if the code is working correctly. I’ve heard of CI before, but the learning curve to actually integrate it within my workflow seemed daunting.
But now I am a convert.
With Travis CI I actually save time. Right now I’ve integrated it into many of my projects and with every commit I make to GitHub it allows me to:
- Benchmark my code against a set of tests with
pytest(emails are send to me if I break something) - Compile documentation from docstrings commented within my code with
pydoc - Upload docs to GitHub pages or my own web server
- Package and push tagged releases to PyPI
- Compile and tag Docker images
Sample .travis.yml script
Here is what a configuration file looks like (taken from the top directory of pycurious)
dist: bionic
language: python
python:
- "3.5"
- "3.6"
- "3.7"
install:
- pip3 install numpy scipy pytest pdoc
- pip3 install -e .
script:
# test with pytest
pytest tests/
# generate the docs
- mkdir docs
- cd docs
- pdoc --html -o . --force pycurious
- mv pycurious/*.html .
- rm -rf pycurious/
- cd ../
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN # Put in settings as a secure variable
keep_history: true
on:
branch: master
verbose: true
local_dir: docs/
- Install required packages with pip.
- Run a suite of tests with
pytest. - Compile documentation with
pdoc. - Deploy the documentation on GitHub pages.
- Repeat the same process for Python 3.5, 3.6, and 3.7
So cool!
The only limitation I’ve run into is the lack of parallel support to test MPI environments sigh! But apparently Jenkins is here to help with that. For another time…

I am an ARC Industry Research Fellow in the School of Geography, Earth and Atmospheric Sciences at The University of Melbourne. I am an expert in fusing Earth evolution models with data to understand how groundwater moves critical minerals through the landscape. Related research interests include the cycling of volatiles within the Earth, probabilistic thermal models of the lithosphere to unravel past tectonic and climatic events, and understanding the how enigmatic volcanoes form.
I am a vocal advocate for the integral role of geoscience in responding to challenges we face in transitioning to the carbon-neutral economy. As an expert in my field, I have been interviewed in national and international print media, TV, and radio on a wide variety of subjects including earthquakes, volcanoes, groundwater, and critical minerals.