Use github actions instead of azure pipelines (#206)

* Use github actions instead of azure pipelines

* add codecov badge
This commit is contained in:
Teemu R 2021-09-23 18:25:41 +02:00 committed by GitHub
parent b3c8f9769c
commit 41bed35e01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 86 additions and 120 deletions

84
.github/workflows/ci.yml vendored Normal file
View File

@ -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

View File

@ -1,8 +1,8 @@
# python-kasa # python-kasa
[![PyPI version](https://badge.fury.io/py/python-kasa.svg)](https://badge.fury.io/py/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) [![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)
[![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) [![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) [![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. python-kasa is a Python library to control TPLink smart home devices (plugs, wall switches, power strips, and bulbs) using asyncio.

View File

@ -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'