Skip to content

Commit

Permalink
Add github flow for ci (#1044)
Browse files Browse the repository at this point in the history
* Add github flow for ci

* Add runs-on to tests

* Replace azure pipelines badge with github one, replace coveralls with codecov

* Test pypy3 only on ubuntu
  • Loading branch information
rytilahti authored May 17, 2021
1 parent 0392d35 commit f3f9550
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 134 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch: # to allow manual re-runs


jobs:
linting:
name: "Perform linting checks"
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.9"]

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip poetry
poetry install --extras docs
- name: "Code formating (black)"
run: |
poetry run pre-commit run black --all-files
- name: "Code formating (flake8)"
run: |
poetry run pre-commit run flake8 --all-files
- name: "Order of imports (isort)"
run: |
poetry run pre-commit run isort --all-files
- name: "Docstring formating (docformatter)"
run: |
poetry run pre-commit run docformatter --all-files
- name: "Potential security issues (bandit)"
run: |
poetry run pre-commit run bandit --all-files
- name: "Documentation build (sphinx)"
run: |
poetry run sphinx-build docs/ generated_docs
# - name: "Typing checks (mypy)"
# run: |
# poetry run pre-commit run mypy --all-files

tests:
name: "Python ${{ matrix.python-version}} on ${{ matrix.os }}"
needs: linting
runs-on: ${{ matrix.os }}

strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "pypy3"]
os: [ubuntu-latest, macos-latest, windows-latest]
# test pypy3 only on ubuntu as cryptography requires rust compilation
# which slows the pipeline and was not currently working on macos
exclude:
- python-version: pypy3
os: macos-latest
- python-version: pypy3
os: windows-latest

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip poetry
poetry install --extras docs
- name: "Run tests"
run: |
poetry run pytest --cov miio --cov-report xml
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v1"
with:
fail_ci_if_error: true
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ Other projects
:target: https://badge.fury.io/py/python-miio
.. |PyPI downloads| image:: https://img.shields.io/pypi/dw/python-miio
:target: https://pypi.org/project/python-miio/
.. |Build Status| image:: https://img.shields.io/azure-devops/build/python-miio/608e6099-f1ed-403c-9158-8fdcb2a0e477/1
:target: https://dev.azure.com/python-miio/python-miio/
.. |Coverage Status| image:: https://coveralls.io/repos/github/rytilahti/python-miio/badge.svg?branch=master
:target: https://coveralls.io/github/rytilahti/python-miio?branch=master
.. |Build Status| image:: https://github.com/rytilahti/python-miio/actions/workflows/ci.yml/badge.svg
:target: https://github.com/rytilahti/python-miio/actions/workflows/ci.yml
.. |Coverage Status| image:: https://codecov.io/gh/rytilahti/python-miio/branch/master/graph/badge.svg?token=lYKWubxkLU
:target: https://codecov.io/gh/rytilahti/python-miio
.. |Docs| image:: https://readthedocs.org/projects/python-miio/badge/?version=latest
:alt: Documentation status
:target: https://python-miio.readthedocs.io/en/latest/?badge=latest
Expand Down
130 changes: 0 additions & 130 deletions azure-pipelines.yml

This file was deleted.

0 comments on commit f3f9550

Please sign in to comment.