2021-09-23 16:25:41 +00:00
|
|
|
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:
|
2021-12-17 16:48:03 +00:00
|
|
|
python-version: ["3.10"]
|
2021-09-23 16:25:41 +00:00
|
|
|
|
|
|
|
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
|
2021-09-23 16:29:45 +00:00
|
|
|
poetry install
|
2022-02-20 23:56:18 +00:00
|
|
|
- name: "Run pyupgrade"
|
|
|
|
run: |
|
|
|
|
poetry run pre-commit run pyupgrade --all-files
|
2021-09-23 16:25:41 +00:00
|
|
|
- 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
|
|
|
|
|
|
|
|
tests:
|
|
|
|
name: "Python ${{ matrix.python-version}} on ${{ matrix.os }}"
|
|
|
|
needs: linting
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-12-17 16:48:03 +00:00
|
|
|
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7"]
|
2021-09-23 16:25:41 +00:00
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2021-09-23 23:44:22 +00:00
|
|
|
# exclude pypy on windows, as the poetry install seems to be very flaky:
|
|
|
|
# PermissionError(13, 'The process cannot access the file because it is being used by another process'))
|
|
|
|
# at C:\hostedtoolcache\windows\PyPy\3.7.10\x86\site-packages\requests\models.py:761 in generate
|
|
|
|
exclude:
|
|
|
|
- python-version: pypy-3.7
|
|
|
|
os: windows-latest
|
2021-09-23 16:25:41 +00:00
|
|
|
|
|
|
|
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
|
2021-09-23 17:09:19 +00:00
|
|
|
poetry install
|
2021-09-23 16:25:41 +00:00
|
|
|
- name: "Run tests"
|
|
|
|
run: |
|
|
|
|
poetry run pytest --cov kasa --cov-report xml
|
|
|
|
- name: "Upload coverage to Codecov"
|
2021-12-13 17:58:46 +00:00
|
|
|
uses: "codecov/codecov-action@v2"
|
2021-09-23 16:25:41 +00:00
|
|
|
with:
|
|
|
|
fail_ci_if_error: true
|