mvn23 / pyotgw

A library to interface with the OpenTherm Gateway through serial or network connection.
GNU General Public License v3.0
28 stars 16 forks source link

Add Travis to the repository #14

Closed Fokko closed 4 years ago

Fokko commented 4 years ago

It would be cool to add a CI service to the repository so we're sure that everything is still good. This requires you to configure Travis. WDYT?

mvn23 commented 4 years ago

Sounds like a good idea. I have never worked with Travis before, only seen it on other projects. The way I understand it this will run pre-commit on every new commit and shows the result on top of the README.md, correct?

Fokko commented 4 years ago

Travis is quite popular, it is also free for open source projects :)

The CI job will make sure that all the checks pass. If someone opens a new Pull Request to the repository, it will check if isort, black etc. still passes.

Example:

MacBook-Pro-van-Fokko:pyotgw fokkodriesprong$ pre-commit run --all-files
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check docstring is first.................................................Passed
Check Yaml...............................................................Passed
Debug Statements (Python)................................................Passed
Check python ast.........................................................Passed
black....................................................................Passed
flake8...................................................................Passed
pyupgrade................................................................Passed
isort....................................................................Passed
MacBook-Pro-van-Fokko:pyotgw fokkodriesprong$ echo $?
0

This is when everything is okay. For example, when flake8 is not met:

MacBook-Pro-van-Fokko:pyotgw fokkodriesprong$ pre-commit run --all-files
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check docstring is first.................................................Passed
Check Yaml...............................................................Passed
Debug Statements (Python)................................................Passed
Check python ast.........................................................Passed
black....................................................................Failed
hookid: black

Files were modified by this hook. Additional output:

reformatted /Users/fokkodriesprong/Desktop/pyotgw/pyotgw/protocol.py
All done! ✨ 🍰 ✨
1 file reformatted, 4 files left unchanged.

flake8...................................................................Passed
pyupgrade................................................................Passed
isort....................................................................Failed
hookid: isort

Files were modified by this hook. Additional output:

Fixing /Users/fokkodriesprong/Desktop/pyotgw/pyotgw/protocol.py

MacBook-Pro-van-Fokko:pyotgw fokkodriesprong$ echo $?
1

It will return an exit code 1, and this will let you know that that there are flake8 violations.

mvn23 commented 4 years ago

Looks useful indeed, let's give it a go. I have signed up with travis already, time to play!

Thanks for the PR.