https://github.com/cmccandless/travis-coveralls-demo
Tutorial for setting up a new Github Repository with Travis-CI and Coveralls support
https://github.com/cmccandless/travis-coveralls-demo
Last synced: 3 months ago
JSON representation
Tutorial for setting up a new Github Repository with Travis-CI and Coveralls support
- Host: GitHub
- URL: https://github.com/cmccandless/travis-coveralls-demo
- Owner: cmccandless
- License: mit
- Created: 2017-10-30T21:05:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-31T15:04:42.000Z (over 7 years ago)
- Last Synced: 2025-01-13T03:12:13.948Z (5 months ago)
- Language: Python
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Travis-Coveralls-Demo
[](https://travis-ci.org/cmccandless/Travis-Coveralls-Demo) [](https://coveralls.io/github/cmccandless/Travis-Coveralls-Demo?branch=master)
Tutorial for setting up a new Github Repository with [Travis-CI](https://travis-ci.org/) and [Coveralls](https://coveralls.io/) support.
Travis-CI and Coveralls are not limited to [Python](https://www.python.org/) repositories, but we will use Python in this tutorial.
## Steps
### 1) Add [source code](https://github.com/cmccandless/Travis-Coveralls-Demo/blob/9751a043c14376c40e60ed2c3ef4945cb56ca8e5/convert.py)
### 2) Add [unit tests](https://github.com/cmccandless/Travis-Coveralls-Demo/blob/9751a043c14376c40e60ed2c3ef4945cb56ca8e5/convert_test.py)
### 3) Travis-CI
#### 3.1) Configure
##### 3.1.1) Create .travis.yml
```YML
# Most Travis scripts will probably not need sudo enabled
sudo: false# Language of your repository
language: python# Language versions for Travis to test
python:
- 2.7
- 3.3
- 3.4
- 3.5
- 3.6
- nightly# Test matrix settings
matrix:
# Ignore failures for unstable versions
allow_failures:
- python: nightly# Install dependencies here (apt-get, pip, etc.)
install:
- pip install -r requirements-travis.txt# Code style checks are often run here
# See http://flake8.pycqa.org/en/latest/ for more info on flake8
before_script:
- flake8# Call your CI script here
script:
- pytest -v
```##### 3.1.2) (Optional) Create requirements-travis.txt
*Filename is not important, and contents could just as easily be inserted into `.travis.yml`*
#### 3.2) Go to [Travis-CI.org](https://travis-ci.org/)
##### 3.2.1) Click `Sign in with GitHub`
##### 3.2.2) Go to [profile](https://travis-ci.org/profile/) and follow instructions
#### 3.3) Trigger a new build manually or by pushing new commits
#### 3.4) (Optional) Add badge to repository README
Click on the badge
[](https://travis-ci.org/cmccandless/Travis-Coveralls-Demo)
on your build results page.### 4) Coveralls
#### 4.1) Enable
Follow steps at `https://coveralls.io/github/USERNAME/REPOSITORY`
#### 4.2) Configure coverage
.coveragerc
```ini
[report]
omit =
*/python?.?/*
*__init__*
*_test.py
```#### 4.3) Run coverage and coveralls in Travis-CI build
``` YML
# Call your CI script here
script:
- python -m pytest -v
- coverage run -m pytest -vafter_success: coveralls
```#### 4.4) Trigger another new Travis-CI build
#### 4.5) (Optional) Add badge to repository README
Click on "EMBED" next to
[](https://coveralls.io/github/cmccandless/Travis-Coveralls-Demo?branch=master)
inside the "BADGE YOUR REPO: \" banner at the bottom of your Coveralls build results page.