diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..0452fc34 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,84 @@ +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 + - 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: "Typing checks (mypy)" + run: | + poetry run pre-commit run mypy --all-files + - name: "Run trailing-whitespace" + run: | + poetry run pre-commit run trailing-whitespace --all-files + - name: "Run end-of-file-fixer" + run: | + poetry run pre-commit run end-of-file-fixer --all-files + - name: "Run check-docstring-first" + run: | + poetry run pre-commit run check-docstring-first --all-files + - name: "Run debug-statements" + run: | + poetry run pre-commit run debug-statements --all-files + - name: "Run check-ast" + run: | + poetry run pre-commit run check-ast --all-files + - name: "Potential security issues (bandit)" + run: | + poetry run pre-commit run bandit --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] + + 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 + - name: "Run tests" + run: | + poetry run pytest --cov kasa --cov-report xml + - name: "Upload coverage to Codecov" + uses: "codecov/codecov-action@v1" + with: + fail_ci_if_error: true diff --git a/README.md b/README.md index 1d84eca0..e1136d1f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # python-kasa [![PyPI version](https://badge.fury.io/py/python-kasa.svg)](https://badge.fury.io/py/python-kasa) -[![Build Status](https://dev.azure.com/python-kasa/python-kasa/_apis/build/status/python-kasa.python-kasa?branchName=master)](https://dev.azure.com/python-kasa/python-kasa/_build/latest?definitionId=2&branchName=master) -[![Coverage Status](https://coveralls.io/repos/github/python-kasa/python-kasa/badge.svg?branch=master)](https://coveralls.io/github/python-kasa/python-kasa?branch=master) +[![Build Status](https://github.com/python-kasa/python-kasa/actions/workflows/ci.yml/badge.svg)](https://github.com/python-kasa/python-kasa/actions/workflows/ci.yml) +[![codecov](https://codecov.io/gh/python-kasa/python-kasa/branch/master/graph/badge.svg?token=5K7rtN5OmS)](https://codecov.io/gh/python-kasa/python-kasa) [![Documentation Status](https://readthedocs.org/projects/python-kasa/badge/?version=latest)](https://python-kasa.readthedocs.io/en/latest/?badge=latest) python-kasa is a Python library to control TPLink smart home devices (plugs, wall switches, power strips, and bulbs) using asyncio. diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 2b201ae0..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,118 +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 - 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: | - poetry run 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 trailing-whitespace --all-files - displayName: 'Run trailing-whitespace' - - - script: | - poetry run pre-commit run end-of-file-fixer --all-files - displayName: 'Run end-of-file-fixer' - - - script: | - poetry run pre-commit run check-docstring-first --all-files - displayName: 'Run check-docstring-first' - - - script: | - poetry run pre-commit run check-yaml --all-files - displayName: 'Run check-yaml' - - - script: | - poetry run pre-commit run debug-statements --all-files - displayName: 'Run debug-statements' - - - script: | - poetry run pre-commit run check-ast --all-files - displayName: 'Run check-ast' - - -- stage: "Tests" - jobs: - - job: "Tests" - strategy: - matrix: - Python 3.7 Ubuntu: - python.version: '3.7' - vmImage: 'ubuntu-latest' - - Python 3.8 Ubuntu: - python.version: '3.8' - vmImage: 'ubuntu-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.7 OSX: - python.version: '3.7' - vmImage: 'macOS-latest' - - Python 3.8 OSX: - python.version: '3.8' - 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 kasa --cov-report=xml --cov-report=html - displayName: 'Run tests' - - - script: | - poetry run codecov -t $(codecov.token) - displayName: 'Report code coverage'