-
Notifications
You must be signed in to change notification settings - Fork 2
112 lines (94 loc) · 2.65 KB
/
ci.yml
File metadata and controls
112 lines (94 loc) · 2.65 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DEFAULT_PYTHON: "3.12"
jobs:
ruff:
name: Ruff Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install Ruff
run: pip install ruff
- name: Run Ruff check
run: ruff check custom_components/nerdqaxe tests/ --output-format=github
- name: Run Ruff format check
run: ruff format custom_components/nerdqaxe tests/ --check
mypy:
name: Mypy Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install dependencies
run: |
pip install mypy homeassistant aiohttp
- name: Run Mypy
run: mypy custom_components/nerdqaxe --ignore-missing-imports
pytest:
name: Tests & Coverage
runs-on: ubuntu-latest
needs: [ruff, mypy]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install dependencies
run: |
pip install \
pytest \
pytest-asyncio \
pytest-cov \
pytest-homeassistant-custom-component \
aiohttp
- name: Run tests with coverage
run: |
pytest tests/ \
--cov=custom_components/nerdqaxe \
--cov-report=xml \
--cov-report=term-missing \
--cov-fail-under=80 \
-v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: always()
with:
files: ./coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
all-checks:
name: All CI Checks
runs-on: ubuntu-latest
needs: [ruff, mypy, pytest]
if: always()
steps:
- name: Check all jobs passed
run: |
if [[ "${{ needs.ruff.result }}" != "success" ]] || \
[[ "${{ needs.mypy.result }}" != "success" ]] || \
[[ "${{ needs.pytest.result }}" != "success" ]]; then
echo "One or more checks failed"
exit 1
fi
echo "All checks passed!"