-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (60 loc) · 2.73 KB
/
Copy pathtest.yml
File metadata and controls
65 lines (60 loc) · 2.73 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
name: Test
# Fast host-side unit tests for the Python (MoonDeck / build scripts) and JS
# (web installer) code that the C++ ctest/scenario suites can't reach. Runs on
# every PR and on pushes to main/next-iteration. Scoped to the paths these tests
# cover so a docs-only or pure-firmware change doesn't spend a runner here.
#
# Today this pins the Improv frame wire format (test/python + test/js assert a
# shared golden vector so the device C++, Python, and JS builders can't drift).
# New Python/JS unit suites land under test/python and test/js and run here.
# Paths cover every input to the host-side tests: the Python/JS sources under test
# (scripts, web-installer), the test files themselves, AND the device-side C++ frame
# contract (src/core/Improv*.h + the platform handler) — a wire-format change in the
# firmware must run the cross-language golden-vector tests so it can't drift from the
# Python/JS builders silently. pull_request gates every PR; push runs main only (a
# direct-to-main hotfix). A PR branch is covered by pull_request alone — listing
# feature branches under push too would double-run every PR (push + pull_request).
on:
pull_request:
paths: &test-paths
- 'moondeck/**'
- 'web-installer/**'
- 'src/core/ImprovFrame.h'
- 'src/core/ImprovOpReassembler.h'
- 'src/platform/esp32/platform_esp32_improv.cpp'
- 'test/python/**'
- 'test/js/**'
- '.github/workflows/test.yml'
push:
branches:
- main
paths: *test-paths
permissions:
contents: read
jobs:
python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: astral-sh/setup-uv@v3
# pytest + pyserial come from the test file's inline PEP-723 block; passing
# them via --with is the explicit, discovery-friendly form (a bare `pytest
# <dir>` doesn't honour a test file's own inline deps). `markdown` (a MkDocs
# dep, not in the base env) is needed by test_mkdocs_slug.py, which pins _slug()
# against Python-Markdown's real toc slugify. `wled` is the frenck/python-wled
# library HA's WLED integration uses; test_wled_json_shape.py parses the
# device /json vector through its Device.from_dict to pin the wire contract.
- name: pytest
run: uv run --with pytest --with pyserial --with markdown --with wled pytest test/python -q
js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
# Node's built-in test runner — no npm install, no package.json. The glob
# form is required: a bare directory arg is treated as a module to execute.
- name: node --test
run: node --test "test/js/**/*.test.mjs"