Skip to content

ci: split build into lint and test workflows with a Windows matrix - #603

Open
sherjy wants to merge 2 commits into
NevaMind-AI:mainfrom
sherjy:ci/split-lint-test-windows-matrix
Open

ci: split build into lint and test workflows with a Windows matrix#603
sherjy wants to merge 2 commits into
NevaMind-AI:mainfrom
sherjy:ci/split-lint-test-windows-matrix

Conversation

@sherjy

@sherjy sherjy commented Jul 28, 2026

Copy link
Copy Markdown

Summary

Split the single build.yml job into two workflows so lint runs once on Linux while tests gain an OS matrix that includes Windows.

  • lint.ymlubuntu-latest, Python 3.13; runs make check (lock-file check, pre-commit, mypy, deptry) exactly once.
  • test.yml — matrix {ubuntu-latest, windows-latest} × {3.11, 3.13}, fail-fast: false; runs pytest with coverage directly (not via make, which isn't guaranteed on windows-latest).
  • Removes build.yml. pr-title.yml, publish-memu-cli.yml, and release-please.yml are untouched.
  • Both workflows keep the existing same-repo dedupe if: guard, so branch pushes and fork PRs behave exactly as before.

Closes #505.

Why

Per #505, adding Windows to the combined job would rerun lint/pre-commit on every OS×Python cell and pull pre-commit onto Windows, where its hooks have CRLF pitfalls (cf. #482). Keeping lint single-run on ubuntu and giving only pytest the OS matrix avoids that and lets platform-specific test failures surface.

Surfaced and fixed a real Windows-only failure

Enabling windows-latest immediately caught one — exactly the point of #505. tests/test_host_templates.py::test_fetch_rejects_bad_responses_without_caching has an "oversize" case that builds a 65,537-byte body, so pytest derived a node id longer than Windows' 32,767-character limit for the PYTEST_CURRENT_TEST environment variable. Setup and teardown then raised ValueError: the environment variable is longer than 32767 characters on Windows only (Linux has no such cap).

Fixed by giving each parametrization a short, explicit pytest.param(..., id=...). The request bodies and assertions are unchanged, so the size guard is still exercised.

Verification

Locally on Windows (Python 3.13):

  • pytest222 passed, 0 errors (previously 221 passed + 2 errors before the id fix).
  • make check: pre-commit, mypy (129 source files), deptry, and uv lock --locked all clean.

CI on this PR additionally covers ubuntu × {3.11, 3.13} and windows × {3.11, 3.13}.

Notes for maintainers

sherjy added 2 commits July 28, 2026 15:56
The oversize branch of test_fetch_rejects_bad_responses_without_caching sends a 65,537-byte body (_MAX_BYTES + 1), so pytest derived a node id tens of thousands of characters long. On Windows that id is written into the PYTEST_CURRENT_TEST environment variable, which is capped at 32,767 characters, so setup and teardown raised 'ValueError: the environment variable is longer than 32767 characters' and the case errored on windows-latest only (Linux has no such limit). Wrap each case in pytest.param(..., id=...) with a short, stable id; the request bodies and assertions are unchanged, so the size guard is still exercised.
build.yml ran lint, pre-commit, mypy, deptry and pytest serially in a single ubuntu-only job. Adding Windows there would rerun the lint steps on every cell and pull pre-commit onto Windows (CRLF pitfalls, cf. NevaMind-AI#482).

- lint.yml: ubuntu-latest, Python 3.13; runs 'make check' (lock check, pre-commit, mypy, deptry) exactly once.
- test.yml: matrix {ubuntu-latest, windows-latest} x {3.11, 3.13}, fail-fast disabled; runs pytest with coverage directly (make is not guaranteed on windows-latest).

Both keep the existing same-repo dedupe guard. Required status checks should be updated from 'build' to 'lint' and 'test'.
@MrXnneHang

MrXnneHang commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

感谢你的 PR~

关于 windows CI 的引入我之前提过一次,但当时没有结果。

memU 确实需要引入跨平台的 ci,但不是现在。

因为跨平台测试目前不应该被所有代码改动触发,对于 memU 的主体它是跨平台安全的。

需要被测试的主要是各个 host 的跨平台 macos cron 和 windows scheduler 的部分。而这部分代码最近会频繁新增和删减。现在引入跨平台单测 ci 会需要频繁修改 ci 文件。

为了更快的开发,当前更倾向手动测试,等到跨平台支持稳定后,再新增按需触发的 CI workflow。

一个始终触发的 windows / macOS workflow 会拖慢 CI 的进行速度,当前并不希望如此。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[IMPROVEMENT] Split CI: separate lint from test, paving the way for a Windows test matrix

2 participants