-
-
Notifications
You must be signed in to change notification settings - Fork 20
560 lines (501 loc) · 17.8 KB
/
Copy pathci.yaml
File metadata and controls
560 lines (501 loc) · 17.8 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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
name: CI
on: # yamllint disable-line rule:truthy
push:
branches:
- main
pull_request:
schedule:
- cron: 0 12 * * *
workflow_dispatch:
permissions:
contents: read
env:
FORCE_COLOR: 1
DEFAULT_PYTHON: "3.11"
PYUPGRADE_TARGET: "--py311-plus"
concurrency:
# yamllint disable-line rule:line-length
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
yamllint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run yamllint
uses: frenck/action-yamllint@34b4bbcaeabedcfefad6adea8c5bbc42af0e2d47 # v1.5.0
with:
config: .yamllint
bundle:
name: Bundle external component and ESPHome
runs-on: ubuntu-24.04
outputs:
repo-hash: ${{ github.sha }}
steps:
- name: Check out this project
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check out code from ESPHome project
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: esphome/esphome
ref: dev
path: esphome
- name: Copy external component and tests into the esphome project
run: |
cd esphome
cp -r ../components/* esphome/components/
mkdir -p tests/components
cp -r ../tests/components/* tests/components/
git config user.name "ci"
git config user.email "ci@github.com"
git add .
git commit -a -m "Add external component"
ln -sf ../venv venv
- name: Archive prepared repository
uses: pyTooling/upload-artifact@a59f191f676112c140f4330026bbb6ac19b7a44d # v7
with:
name: bundle
path: .
include-hidden-files: true
retention-days: 1
common:
name: Create common environment
runs-on: ubuntu-24.04
needs: bundle
outputs:
cache-key: ${{ steps.cache-key.outputs.key }}
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Update index to make "git diff-index" happy
run: git update-index -q --really-refresh
- name: Generate cache-key
id: cache-key
run: echo key="${{ hashFiles('esphome/requirements.txt', 'esphome/requirements_test.txt') }}" >> $GITHUB_OUTPUT
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: venv
# yamllint disable-line rule:line-length
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ steps.cache-key.outputs.key }}
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv venv
. venv/bin/activate
python --version
cd esphome
pip install -r requirements.txt -r requirements_test.txt
pip install -e .
ruff:
name: Check ruff
runs-on: ubuntu-24.04
needs:
- bundle
- common
defaults:
run:
working-directory: esphome
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Update index to make "git diff-index" happy
run: git update-index -q --really-refresh
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Run Ruff
run: |
. venv/bin/activate
ruff format esphome tests
- name: Suggested changes
run: script/ci-suggest-changes
if: always()
flake8:
name: Check flake8
runs-on: ubuntu-24.04
needs:
- bundle
- common
defaults:
run:
working-directory: esphome
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Update index to make "git diff-index" happy
run: git update-index -q --really-refresh
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Run flake8
run: |
. venv/bin/activate
flake8 esphome
- name: Suggested changes
run: script/ci-suggest-changes
if: always()
pylint:
name: Check pylint
runs-on: ubuntu-24.04
needs:
- bundle
- common
defaults:
run:
working-directory: esphome
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Update index to make "git diff-index" happy
run: git update-index -q --really-refresh
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Run pylint
run: |
. venv/bin/activate
pylint -f parseable --persistent=n esphome
- name: Suggested changes
run: script/ci-suggest-changes
if: always()
pyupgrade:
name: Check pyupgrade
runs-on: ubuntu-24.04
needs:
- bundle
- common
defaults:
run:
working-directory: esphome
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Update index to make "git diff-index" happy
run: git update-index -q --really-refresh
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Run pyupgrade
run: |
. venv/bin/activate
pyupgrade ${{ env.PYUPGRADE_TARGET }} `find esphome -name "*.py" -type f`
- name: Suggested changes
run: script/ci-suggest-changes
if: always()
ci-custom:
name: Run script/ci-custom
runs-on: ubuntu-24.04
needs:
- bundle
- common
defaults:
run:
working-directory: esphome
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Update index to make "git diff-index" happy
run: git update-index -q --really-refresh
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Register matcher
run: echo "::add-matcher::.github/workflows/matchers/ci-custom.json"
- name: Do not suggest to move consts
run: |
sed -i 's#if len(uses) < 3:#if len(uses) < 8:#' script/ci-custom.py
git update-index --assume-unchanged script/ci-custom.py
- name: Run script/ci-custom
run: |
. ../venv/bin/activate
script/ci-custom.py
clang-format:
name: Check clang-format
runs-on: ubuntu-24.04
needs:
- bundle
- common
defaults:
run:
working-directory: esphome
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Update index to make "git diff-index" happy
run: git update-index -q --really-refresh
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Install clang-format
run: |
. venv/bin/activate
pip install clang-format -c requirements_dev.txt
- name: Run clang-format
run: |
. venv/bin/activate
script/clang-format -i
- name: Suggested changes
run: script/ci-suggest-changes
if: always()
clang-tidy:
name: ${{ matrix.name }}
runs-on: ubuntu-24.04
needs:
- bundle
- common
defaults:
run:
working-directory: esphome
strategy:
fail-fast: false
max-parallel: 2
matrix:
include:
- id: clang-tidy
name: Run script/clang-tidy for ESP8266
options: --environment esp8266-arduino-tidy --grep USE_ESP8266
pio_cache_key: tidyesp8266
- id: clang-tidy
name: Run script/clang-tidy for ESP32 Arduino
options: --environment esp32-arduino-tidy
pio_cache_key: tidyesp32
- id: clang-tidy
name: Run script/clang-tidy for ESP32 IDF
options: --environment esp32-idf-tidy --grep USE_ESP_IDF
pio_cache_key: tidyesp32-idf
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Update index to make "git diff-index" happy
run: git update-index -q --really-refresh
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Cache platformio
if: github.ref == 'refs/heads/main'
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/.platformio
key: platformio-${{ matrix.pio_cache_key }}-${{ hashFiles('esphome/platformio.ini') }}
restore-keys: platformio-${{ matrix.pio_cache_key }}-
- name: Cache platformio
if: github.ref != 'refs/heads/main'
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/.platformio
key: platformio-${{ matrix.pio_cache_key }}-${{ hashFiles('esphome/platformio.ini') }}
restore-keys: platformio-${{ matrix.pio_cache_key }}-
- name: Register problem matchers
run: |
echo "::add-matcher::.github/workflows/matchers/gcc.json"
echo "::add-matcher::.github/workflows/matchers/clang-tidy.json"
- name: Run 'pio run --list-targets -e esp32-idf-tidy'
if: matrix.name == 'Run script/clang-tidy for ESP32 IDF'
run: |
. venv/bin/activate
mkdir -p .temp
pio run --list-targets -e esp32-idf-tidy
- name: Install clang-tidy
run: |
. venv/bin/activate
pip install clang-tidy -c requirements_dev.txt
- name: Run clang-tidy
run: |
. venv/bin/activate
script/clang-tidy --all-headers --fix ${{ matrix.options }} $(ls ../components/)
env:
# Also cache libdeps, store them in a ~/.platformio subfolder
PLATFORMIO_LIBDEPS_DIR: ~/.platformio/libdeps
- name: Suggested changes
run: script/ci-suggest-changes
# yamllint disable-line rule:line-length
if: always()
pytest:
name: Run pytest
runs-on: ubuntu-24.04
needs:
- bundle
- common
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Run pytest
run: |
. venv/bin/activate
pytest tests/ -v
cpp-unit-tests:
name: Run C++ unit tests
runs-on: ubuntu-24.04
needs:
- bundle
- common
defaults:
run:
working-directory: esphome
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Update index to make "git diff-index" happy
run: git update-index -q --really-refresh
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Cache platformio
if: github.ref == 'refs/heads/main'
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/.platformio
key: platformio-host-${{ hashFiles('esphome/platformio.ini') }}
restore-keys: platformio-host-
- name: Cache platformio
if: github.ref != 'refs/heads/main'
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/.platformio
key: platformio-host-${{ hashFiles('esphome/platformio.ini') }}
restore-keys: platformio-host-
- name: Run C++ unit tests
run: |
. venv/bin/activate
script/cpp_unit_test.py atorch_dl24
env:
PLATFORMIO_LIBDEPS_DIR: ~/.platformio/libdeps
ASAN_OPTIONS: detect_leaks=0
esphome-config:
name: Validate example configurations
runs-on: ubuntu-24.04
needs:
- bundle
- common
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Register matcher
run: echo "::add-matcher::.github/workflows/matchers/esphome-config.json"
- name: Validate example configurations
run: |
. venv/bin/activate
echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password\ndl24_mac_address: FF:FF:FF:FF:FF:FF\ndl24_mac_address0: FF:FF:FF:FF:FF:F0\ndl24_mac_address1: FF:FF:FF:FF:FF:F1\n" > secrets.yaml
for YAML in esp*.yaml; do
esphome -s external_components_source components config $YAML
done
- name: Validate test configurations
run: |
. venv/bin/activate
echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password\ndl24_mac_address: FF:FF:FF:FF:FF:FF\ndl24_mac_address0: FF:FF:FF:FF:FF:F0\ndl24_mac_address1: FF:FF:FF:FF:FF:F1\n" > tests/secrets.yaml
for YAML in tests/esp*.yaml; do
esphome -s external_components_source ../components config $YAML
done
esphome-compile:
name: Build example configurations
runs-on: ubuntu-24.04
needs:
- bundle
- common
steps:
- name: Download prepared repository
uses: pyTooling/download-artifact@dc575e4e9df4b6e3580712285f1c90f579bb8712 # v8
with:
name: bundle
path: .
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Cache platformio
if: github.ref == 'refs/heads/main'
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/.platformio
key: platformio-compile-${{ hashFiles('esphome/platformio.ini') }}
restore-keys: platformio-compile-
- name: Cache platformio
if: github.ref != 'refs/heads/main'
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/.platformio
key: platformio-compile-${{ hashFiles('esphome/platformio.ini') }}
restore-keys: platformio-compile-
- name: Compile example configurations
run: |
. venv/bin/activate
echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password\ndl24_mac_address: FF:FF:FF:FF:FF:FF\ndl24_mac_address0: FF:FF:FF:FF:FF:F0\ndl24_mac_address1: FF:FF:FF:FF:FF:F1\n" > secrets.yaml
for YAML in esp*faker.yaml esp32-dc-meter-example-advanced-multiple-devices.yaml; do
esphome -s external_components_source components compile $YAML
done
env:
PLATFORMIO_LIBDEPS_DIR: ~/.platformio/libdeps
- name: Compile test configurations
run: |
. venv/bin/activate
echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password\ndl24_mac_address: FF:FF:FF:FF:FF:FF\ndl24_mac_address0: FF:FF:FF:FF:FF:F0\ndl24_mac_address1: FF:FF:FF:FF:FF:F1\n" > tests/secrets.yaml
esphome -s external_components_source ../components compile tests/esp32c6-compatibility-test.yaml
env:
PLATFORMIO_LIBDEPS_DIR: ~/.platformio/libdeps