-
Notifications
You must be signed in to change notification settings - Fork 31
142 lines (133 loc) · 4.41 KB
/
pull.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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Pull actions
# yamllint disable-line rule:truthy
on:
pull_request:
jobs:
validate:
runs-on: "ubuntu-latest"
name: Validate HACS
steps:
- uses: "actions/checkout@v4"
- name: HACS validation
uses: "hacs/action@main"
with:
category: "integration"
ignore: topics
- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"
lint-black:
name: Check black
runs-on: ubuntu-latest
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
id: python
with:
python-version: "3.x"
- name: Setup pre-commit
run: |
python3 -m pip install pre-commit
pre-commit install
- name: Run black
run: pre-commit run --hook-stage manual black --all-files --show-diff-on-failure
lint-isort:
name: Check isort
runs-on: ubuntu-latest
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
id: python
with:
python-version: "3.x"
- name: Setup pre-commit
run: |
python3 -m pip install pre-commit
pre-commit install
- name: Run isort
run: pre-commit run --hook-stage manual isort --all-files --show-diff-on-failure
lint-flake8:
name: Check flake8
runs-on: ubuntu-latest
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
id: python
with:
python-version: "3.12"
- name: Setup pre-commit
run: |
python3 -m pip install pre-commit
pre-commit install
- name: Register flake8 problem matcher
run: |
echo "::add-matcher::.github/workflows/matchers/flake8.json"
- name: Run flake8
run: pre-commit run --hook-stage manual flake8 --all-files
lint-other:
name: Check other linters
runs-on: ubuntu-latest
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
id: python
with:
python-version: "3.x"
- name: Setup pre-commit
run: |
python3 -m pip install pre-commit
pre-commit install
- name: Run pyupgrade
run: pre-commit run --hook-stage manual pyupgrade --all-files --show-diff-on-failure
- name: Register yamllint problem matcher
run: |
echo "::add-matcher::.github/workflows/matchers/yamllint.json"
- name: Run yamllint
run: pre-commit run --hook-stage manual yamllint --all-files --show-diff-on-failure
- name: Register check-json problem matcher
run: |
echo "::add-matcher::.github/workflows/matchers/check-json.json"
- name: Run check-json
run: pre-commit run --hook-stage manual check-json --all-files
- name: Register check executables problem matcher
run: |
echo "::add-matcher::.github/workflows/matchers/check-executables-have-shebangs.json"
- name: Run executables check
run: pre-commit run --hook-stage manual check-executables-have-shebangs --all-files
- name: Register codespell problem matcher
run: |
echo "::add-matcher::.github/workflows/matchers/codespell.json"
- name: Run codespell
run: pre-commit run --show-diff-on-failure --hook-stage manual codespell --all-files
- name: Run bandit
run: pre-commit run --hook-stage manual bandit --all-files --show-diff-on-failure
tests:
runs-on: "ubuntu-latest"
name: Run tests
steps:
- name: Check out code from GitHub
uses: "actions/checkout@v4"
- name: Setup Python
uses: "actions/setup-python@v5"
with:
python-version: "3.12"
- name: Install requirements
run: python3 -m pip install -r requirements_test.txt
- name: Run tests
run: |
pytest \
-qq \
--timeout=9 \
--durations=10 \
-n auto \
--cov custom_components.nefiteasy \
-o console_output_style=count \
-p no:sugar \
tests