mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 03:16:37 +00:00
[ci] Add import-time regression check for esphome.__main__
Adds a CI gate that runs `python -X importtime -c "import esphome.__main__"` via importtime-waterfall's best-of-N harness, compares the root cumulative time against a checked-in budget (script/import_time_budget.json, seeded at 75.2ms with a 15% margin), and fails the build when top-level imports regress. The CLI pays this cost on every invocation before the requested command even runs, so silently adding a top-level dep chain (the recent zeroconf move in #13135 being the motivating case) hurts every user. The check gives us a signal without waiting for user reports. - script/check_import_time.py: --check / --update / --har PATH modes. On regression, prints a ranked top-15 offenders table by self-time. - script/import_time_budget.json: baseline + margin_pct. - script/determine-jobs.py: should_run_import_time() gates the job on esphome/**/*.py, requirements.txt, requirements_dev.txt, pyproject.toml, or changes to the check itself. - .github/workflows/ci.yml: new import-time job, runs when gated and uploads a waterfall HAR artifact (14-day retention) for inspection.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"target_module": "esphome.__main__",
|
||||
"margin_pct": 15,
|
||||
"cumulative_us": 75199
|
||||
}
|
||||
Reference in New Issue
Block a user