From ee745a0e4a02338692693b67b4e2825f4e3ba683 Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Tue, 11 May 2021 20:42:39 +0200 Subject: [PATCH 1/4] Add github flow for ci --- .github/workflows/ci.yml | 75 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..4cee17c62 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +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}}" + needs: linting + + strategy: + matrix: + python-version: ["3.6", "3.7", "3.8", "3.9", "pypy3"] + + + 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 From af485df400bf08c6241f61f242e597811c534831 Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Tue, 11 May 2021 20:46:14 +0200 Subject: [PATCH 2/4] Add runs-on to tests --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cee17c62..920a4e14a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,12 +49,14 @@ jobs: # poetry run pre-commit run mypy --all-files tests: - name: "Python ${{ matrix.python-version}}" + 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] steps: From 331c7ed92feb5abb89469a332caef1abf821c449 Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Tue, 11 May 2021 21:05:02 +0200 Subject: [PATCH 3/4] Replace azure pipelines badge with github one, replace coveralls with codecov --- README.rst | 8 +-- azure-pipelines.yml | 130 -------------------------------------------- 2 files changed, 4 insertions(+), 134 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/README.rst b/README.rst index 6a49820b3..169ff721f 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index e4eb0d8f3..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,130 +0,0 @@ -trigger: -- master -pr: -- master - - -stages: -- stage: "Linting" - jobs: - - job: "LintChecks" - pool: - vmImage: "ubuntu-latest" - strategy: - matrix: - Python 3.8: - python.version: '3.8' - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - displayName: 'Use Python $(python.version)' - - - script: | - python -m pip install --upgrade pip poetry - poetry install --extras docs - displayName: 'Install dependencies' - - - script: | - poetry run pre-commit run black --all-files - displayName: 'Code formating (black)' - - - script: | - poetry run pre-commit run flake8 --all-files - displayName: 'Code formating (flake8)' - - #- script: | - # pre-commit run mypy --all-files - # displayName: 'Typing checks (mypy)' - - - script: | - poetry run pre-commit run isort --all-files - displayName: 'Order of imports (isort)' - - - script: | - poetry run pre-commit run docformatter --all-files - displayName: 'Docstring formating (docformatter)' - - - script: | - poetry run pre-commit run bandit --all-files - displayName: 'Potential security issues (bandit)' - - - script: | - poetry run sphinx-build docs/ generated_docs - displayName: 'Documentation build (sphinx)' - - -- stage: "Tests" - jobs: - - job: "Tests" - strategy: - matrix: - Python 3.6 Ubuntu: - python.version: '3.6' - vmImage: 'ubuntu-latest' - - Python 3.7 Ubuntu: - python.version: '3.7' - vmImage: 'ubuntu-latest' - - Python 3.8 Ubuntu: - python.version: '3.8' - vmImage: 'ubuntu-latest' - - Python 3.9 Ubuntu: - python.version: '3.9' - vmImage: 'ubuntu-latest' - - PyPy Ubuntu: - python.version: pypy3 - vmImage: 'ubuntu-latest' - - Python 3.6 Windows: - python.version: '3.6' - vmImage: 'windows-latest' - - Python 3.7 Windows: - python.version: '3.7' - vmImage: 'windows-latest' - - Python 3.8 Windows: - python.version: '3.8' - vmImage: 'windows-latest' - - Python 3.9 Windows: - python.version: '3.9' - vmImage: 'windows-latest' - - Python 3.6 OSX: - python.version: '3.6' - vmImage: 'macOS-latest' - - Python 3.7 OSX: - python.version: '3.7' - vmImage: 'macOS-latest' - - Python 3.8 OSX: - python.version: '3.8' - vmImage: 'macOS-latest' - - Python 3.9 OSX: - python.version: '3.9' - vmImage: 'macOS-latest' - - pool: - vmImage: $(vmImage) - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - displayName: 'Use Python $(python.version)' - - - script: | - python -m pip install --upgrade pip poetry - poetry install - displayName: 'Install dependencies' - - - script: | - poetry run pytest --cov miio --cov-report html - displayName: 'Tests' From b533c10e9198840cfa54b9605dd1401445ba89ae Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Tue, 11 May 2021 21:05:29 +0200 Subject: [PATCH 4/4] Test pypy3 only on ubuntu --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 920a4e14a..3d1d83f2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,13 @@ jobs: 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"