-
-
Notifications
You must be signed in to change notification settings - Fork 565
86 lines (77 loc) · 2.45 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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.12"]
steps:
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip poetry
poetry install --extras docs
- name: "Run pyupgrade"
run: |
poetry run pre-commit run pyupgrade --all-files
- 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:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8"]
os: [ubuntu-latest, macos-latest, windows-latest]
# Exclude example, in case needed again in the future:
# exclude:
# - python-version: pypy3.8
# os: macos-latest
steps:
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip poetry
poetry install --all-extras
- name: "Run tests"
run: |
poetry run pytest --cov miio --cov-report xml
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v4"
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}