Hands-On Docker for Microservices with Python
上QQ阅读APP看书,第一时间看更新

Configuring Travis CI

Travis CI (https://travis-ci.com/) is a popular continuous integration service that's freely available for public GitHub projects. Integration with GitHub is very simple and it allows you to configure the platform it runs on, such as macOS, Linux, or even iOS.

Travis CI integrates tightly with GitHub, so you only need to log in to GitHub to be able to access it. We'll see how to connect our project to it.

For clarity, only the code in this chapter will be hooked up to Travis.

Travis works a bit differently from other CI tools in that it creates independent jobs by starting a new VM. This means that any artifact created for a previous stage needs to be copied somewhere else to be downloaded at the start of the next stage.

This makes things a bit unpractical sometimes, and an easy solution is to build multiple times for each individual job.

Configuring a remote system such as Travis CI can be a little frustrating sometimes, as it requires you to push a commit to be built to see if the configuration is correct. Also, it gets configured with a YAML file, which can be a bit temperamental in terms of syntax. It will take you a few attempts to get something stable, but don't worry. Once it is set up, you can change it only via a specific pull request as the configuration file is also under source control. 

You can also check the requests in the Travis CI configuration to see if a .yml file creates a parse error.

You can check full Travis CI documentation here: https://docs.travis-ci.com/ .

To configure Travis CI, let's start off by adding a repository from GitHub.