Skip to content

Commit

Permalink
🐛 Travis CI Revamp (#4)
Browse files Browse the repository at this point in the history
* Enabled build on Linux (Python 3.6 + 3.7), MacOS (Python 3.7), Windows (Python 3.7)
* Added coverage test and badge
* Auto deploy to PyPI when released a new tag
  • Loading branch information
lamhoangtung authored Sep 9, 2020
1 parent 95bc708 commit d856185
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 43 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ mlchain.egg-info
*.idea
.pyc
test/*
.pytest_cache
.pytest_cache
**/.DS_Store
166 changes: 127 additions & 39 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,139 @@
language: python
arch:
- amd64
python:
- 3.6
- 3.7

stages:
- sanity_check
- build
- test


jobs:
include:
# ====== WINDOWS =========
- name: "Python 3.6.8 on Windows"
os: windows # Windows 10.0.17134 N/A Build 17134
language: shell # 'language: python' is an error on Travis CI Windows
- stage: sanity_check
name: "Sanity check"
os: linux
python: 3.7
install:
- pip install -U pylint pylint-exit
script:
- pylint --output-format=text *.py || pylint-exit $?

- stage: build
name: "Build on Python 3.7 Linux"
os: linux
python: 3.7
install:
- pip install -U scikit-build awscli pip
- pip install -U -r requirements.txt
script:
- python setup.py bdist_wheel
- python setup.py install

- stage: build
name: "Build on Python 3.6 Linux"
os: linux
python: 3.6
install:
- pip install -U scikit-build awscli pip
- pip install -U -r requirements.txt
script:
- python setup.py bdist_wheel
- python setup.py install

- stage: build
name: "Build on Python 3.7 MacOS"
os: osx
language: minimal
install:
- pip3 install -U scikit-build awscli pip
- pip3 install -U -r requirements.txt
script:
- python3 setup.py bdist_wheel
- python3 setup.py install

- stage: build
name: "Build on Python 3.7 Windows"
os: windows
language: shell
before_install:
- choco install python --version 3.6.8
- python -m pip install scikit-build
- python -m pip install pytest pylint
- choco install python --version 3.7.4
- export PATH="/c/Python37:/c/Python37/Scripts:$PATH"
install:
- python --version
- python -m pip install .
- python -m pip install -U scikit-build awscli pip --user
- python -m pip install -U -r requirements.txt --user

script:
- python setup.py bdist_wheel
- python setup.py install


- stage: test
name: "Test on Python 3.7 Linux"
os: linux
python: 3.7
install:
- pip install -U scikit-build pytest coverage codecov pip
- pip install -U attrs
script:
- pip install .
- python -m coverage run --source=. -m unittest discover
- python -m coverage report
after_success:
- codecov


- stage: test
name: "Test on Python 3.6 Linux"
os: linux
python: 3.6
install:
- pip install -U scikit-build pytest coverage codecov pip
- pip install -U attrs
script:
- pylint mlchain
- pytest tests/
env: PATH=/c/Python36:/c/Python36/Scripts:$PATH
- name: "Python 3.7.4 on Windows"
os: windows # Windows 10.0.17134 N/A Build 17134
language: shell # 'language: python' is an error on Travis CI Windows
- pip install .
- python -m coverage run --source=. -m unittest discover
- python -m coverage report
after_success:
- codecov


- stage: test
name: "Test on Python 3.7 MacOS"
os: osx
language: minimal
install:
- pip3 install -U scikit-build pytest coverage codecov pip
- pip3 install -U attrs
script:
- pip3 install .
- python3 -m coverage run --source=. -m unittest discover
- python3 -m coverage report
after_success:
- codecov

- stage: test
name: "Test on Python 3.7 Windows"
os: windows
language: shell
before_install:
- choco install python --version 3.7.4
- python -m pip install scikit-build
- python -m pip install pytest pylint
- export PATH="/c/Python37:/c/Python37/Scripts:$PATH"
install:
- python --version
- python -m pip install .
- python -m pip install -U scikit-build pytest coverage codecov pip
- python -m pip install -U attrs
script:
- pylint mlchain
- pytest tests/
env: PATH=/c/Python37:/c/Python37/Scripts:$PATH

before_install:
- sudo apt-get update
- sudo apt-get install -y software-properties-common
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends build-essential gcc
- pip install scikit-build
- pip install pytest pylint
install:
- python --version
- pip install .
script:
- pylint mlchain
- pytest tests/
- python -m pip install .
- python -m coverage run --source=. -m unittest discover
- python -m coverage report
after_success:
- codecov

deploy:
- provider: pypi
username: __token__
password:
secure: lEK5DTFYmn2vkeP8OrG8CPgUOH/PvhO76OO5F2/K3HbQxJZLH3Vsmzk/mRsY1pIC52XpGLDSg/8d62V9bu2WNReLRQJZ1zIgKSswvf4USrsd0axGwIbJyuX+vr81/x4j4rQr3ohfb2zOIit7JoDrRugwBICSAEukNfXoOZdN6wVn4zpLsW/bdlrNlIsNmhzUBKfurRMPEqsSE1Bq2dDGmyd4KNiZlaJF4PEgNQHfV9qwW2+j/ky4ulCzFgIfxKUpIfvUPFN3Uw3HdaJAaOH6h+S84hvi30xwD8bT8os990fK0zZ/sW5e0ogRckmkGh3jDJcXzyCPetAABMkUjwTrIkehQ2I2QhT49V0+Qqq3A3iJFAGxufl3HEYNY4ZVxo7PXMBIkmA6TdKomhPLh1nKeQTaFomSvoY/Usnc5pF1Va5vhHUz2mGeUgnbR0kQPN2d3yF6hVvl2TnM4Ml0YK2sQa4og4xYOouBGqJsATTZ7OEdG/Iha1KpQRwkHaWs+FShGs1UL0UZO5+FYVSd6va3i1IPxZLoZzJBPscclKBJbrtfup7cWRO2LEeS1uzS0NEKGTmrZLmOW8m9o0Pt+F61pU8meG3O+n0CxYGrytUSNvCrMA0+ZT9DY0hF9Q08w7AASG+zZVarwhnFDakeNq91Z1GLGxB+mD3vIa5mslZGYMw=
on:
tags: true
branch: master
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
[![PyPI version](https://badge.fury.io/py/mlchain.svg)](https://badge.fury.io/py/mlchain)
[![Downloads](https://pepy.tech/badge/mlchain)](https://pepy.tech/project/mlchain)
[![Build Status](https://travis-ci.org/Techainer/mlchain-python.svg?branch=master)](https://travis-ci.org/Techainer/mlchain-python)
[![codecov](https://codecov.io/gh/Techainer/mlchain-python/branch/master/graph/badge.svg)](https://codecov.io/gh/Techainer/mlchain-python)
[![Documentation Status](https://readthedocs.org/projects/mlchain/badge/?version=latest)](https://mlchain.readthedocs.io/en/latest/?badge=latest)
[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/Techainer/mlchain-python/blob/master/LICENSE)
</div>
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Click>=7.1.2
Flask>=1.1.2
Flask-Cors>=3.0.8
gunicorn>=20.0.4
h11>=0.9.0
h11==0.9.0
h2>=3.1.1
hpack>=3.0.0
hpack>=3.0.0,<4
httptools>=0.0.13
hyperframe>=5.2.0
hyperframe>=5.2.0,<6
idna>=2.8
itsdangerous>=1.1.0
Jinja2>=2.10.3
Expand Down

0 comments on commit d856185

Please sign in to comment.