Travis CI

General Travis CI notes, concepts and setup reference


Last Updated: October 01, 2020 by Pepe Sandoval



Want to show support?

If you find the information in this page useful and want to show your support, you can make a donation

Use PayPal

This will help me to create more stuff and fix the existent content... or probably your money will be used to buy beer


Travis CI Notes

Intro to Travis CI

  • Travis is a continuous integration pipeline software.
  • It is Open source and free for public repos
  • Travis is intended to work on a Linux system.

  • A continues integration pipeline can help you mimic where you are going to deploy your app and test it. In other words test it in an environment very similar or identically to where it will be deployed for production

  • It can monitor your repo (which can live somewhere else like GitHub for example) so every time you make a commit on a branch, Travis can go to your repository downloads it and do something, normally run some test

Travis config file (The .travis.yml)

  • The .travis.yml config file tells Travis exactly how to run the tests and what it has to do in order to run them

  • Travis config File Sections:

    1. language: specifies the programming language and language versions that Travis should be using to run the tests. (you can user reserved word nightly to use latest available version)
    2. install: specifies what needs to be installed in order to run our tests
    3. script: specifies what we want to run

Setup Travis CI

This Setup guide is a reference on how to setup Travis CI using a repo that lives in GitHub

  1. Sign up with GitHub & authorize access to your GitHub Account
  2. Hit the + (Add New Repository) Travis Add New Repository
  3. Enable your repo Enable Repository
  4. Add a Travis Config YAML file to your repo (Must be called .travis.yml)
    language: python
    python:
    - "3.8"
    - "nightly"
    install:
    - "pip install pytest"
    - "pip install -r requirements.txt"
    script: python -m pytest tests/
  5. Push your .travis.yml file and that should run your config specified in Travis
  6. (optional) Add your build status badge to your readme:1) Click on the Travis badge 2) select Markdown 3) Copy the text 4) Paste it in your Readme.md file Add your build status badge

By default Travis is triggered every time you push to your repo and you will be notified via email about the build status

References

Want to show support?

If you find the information in this page useful and want to show your support, you can make a donation

Use PayPal

This will help me to create more stuff and fix the existent content... or probably your money will be used to buy beer