How to add Travis CI to your github project

Travis CI is a nice way to add Continous Integration / Test / Deplyoment to your github project.

As long as your project is open source aka not private you can use Travis CI for free (with a limited quota of 10000 minutes)

Account

Create an account at travis-ci.com 

Connect it with your github account

Configuration

For enable travis CI in your project you must add a .travis.yml file to the root folder. Mind the dot for hidden file!

The content for a python project can look as follows:

language: python
python:
  - "2.7"
  - "3.8"
  - "3.9"
  - "3.10-dev"

script: 
  - python -m unittest discover

Under the python tag you can list all versions under which your code shall be executed. If you don’t provide further information the testing platform is Ubuntu 16.04 Xenial. If you want to run things on Ubuntu 20.04 you can add:

dist: focal

Optional Batch

You can add a batch to your readme

[![Build Status](https://app.travis-ci.com/jboegeholz/easypattern.svg?branch=master)](https://app.travis-ci.com/jboegeholz/easypattern)

Further Reading

https://docs.travis-ci.com/user/languages/python/