Related: Travis-CI examples for several programming languages
This Travis-CI quick start assumes Python on GitHub for simplicity. See the Travis-CI examples for several other programming languages.
- have a minimal setup.py and setup.cfg
- Create free Travis-CI account using your Github credentials
- add the GitHub repository to Travis-CI
language: python group: travis_latest git: depth: 25 quiet: true python: - 3.7 - 3.6 os: - linux matrix: include: - os: linux name: PEP8 MyPy Coverage python: 3.7 install: pip install -e .[tests,cov] script: - flake8 - mypy . after_success: - pytest --cov - coveralls install: pip install -e .[tests] script: pytest -r a -v
pytest --cov assumes coverage
settings in .coveragerc.
Now, upon every
git push, the Travis-CI dashboard will make the badge red/green depending on whether your test passed.
flake8tests PEP8 compliance. Try
autopep8 -i -r .to quickly fix most minor issues. This setup assumes a file .flake8
mypytests static type hinting, which is a very good practice to reduce code errors. This setup assumes a file mypy.ini
The key point is that Travis CI considers only
stderr == / != 0 for pass/fail:
A third case is an ERROR in setup, perhaps a prereq is missing from
See my Coveralls.io page.