跳转至

E2E CI 测试

This document explains how to trigger specific E2E tests against your PR code via a comment command, without running the full E2E test suite.

背景

The E2E-Full workflow (pr_test.yaml) normally runs the complete E2E test suite when a PR has ready label. This is expensive in CI resources and time.

Authorized users can trigger only the specific test files they care about by posting a /e2e comment on the PR, then adding the ready label.

如何触发

1.发布评论

首先,在 PR 上发布一条评论,指定要运行的测试路径:

/e2e [test-path-1] [test-path-2] ...
  • 每个路径必须是相对于仓库根目录的有效 pytest 路径。
  • 可以在单条评论中列出多个路径,使用空格分隔。
  • 可以使用 :: 表示法来指定特定的测试用例。
评论格式 效果
/e2e tests/e2e/pull_request/one_card/test_foo.py 在 one_card 上运行一个测试文件
/e2e tests/e2e/pull_request/two_card/test_bar.py 在 two_card 上运行一个测试文件
/e2e path1 path2 path3 运行多个文件,按路径模式路由
/e2e tests/e2e/pull_request/one_card/test_foo.py::test_case 运行特定的测试用例

2.添加标签

After posting the comment, add the ready label to your PR. Adding the label is what actually triggers the workflow — at that point the workflow reads the existing comments to find the /e2e command.

Note

Only repository Contributors (Triage role) and Maintainers (Write role) can add labels. If you do not have this permission, ask a maintainer to add the label for you. You can find the list of maintainers and contributors by checking the CODEOWNERS file.

Warning

The comment must be posted before the label is added. If you add the label first, the workflow will find no /e2e comment and will not trigger any per-test runs.

Note

Additionally, only the PR author or collaborators with write or admin repository access can trigger tests via comment. The workflow validates the commenter's permission before proceeding.

3.等待结果

GitHub Actions will trigger the E2E-Full workflow. Only the hardware jobs matching the provided test paths will run, which saves CI resources.

路径路由规则

The workflow automatically routes each test path to the correct hardware runner based on path patterns:

路径模式 硬件 Runner
路径中包含 two_card two_card A3 NPU linux-aarch64-a3-2
路径中包含 four_card four_card A3 NPU linux-aarch64-a3-4
one/two_card 下文件名包含 _310p Ascend 310P x1 linux-aarch64-310p-*
four_card 下文件名包含 _310p Ascend 310P x4 linux-aarch64-310p-*
所有其他路径 one_card A2 NPU linux-aarch64-a2b3-1

When paths from multiple categories are listed in a single comment, each category's tests run on its respective hardware in parallel.

测试路径参考

tests/e2e/pull_request/ 目录按硬件类别组织:

tests/e2e/pull_request/
├── one_card/          # Single card tests → A2 NPU x1 runner
├── two_card/          # Two card tests → A3 NPU x2 runner
├── four_card/         # Four card tests → A3 NPU x4 runner

310P tests use _310p subdirectories or _310p.py filename suffix under the corresponding card directory:

tests/e2e/pull_request/one_card/_310p/   # 310P single card
tests/e2e/pull_request/four_card/_310p/  # 310P four card

与完整 E2E 套件的对比

方面 完整 E2E 套件 按测试评论触发
触发条件 ready 标签 /e2e 评论 + ready 标签
范围 所有 E2E 测试 仅指定的测试路径
可触发人员 任何可以添加标签的人 PR 作者或写入/管理员合作者
使用场景 合入前验证 特定测试的迭代调试

示例

运行单个 one_card 测试:

/e2e tests/e2e/pull_request/one_card/test_offline_inference.py

运行 two_card 测试:

/e2e tests/e2e/pull_request/two_card/test_data_parallel.py

在一条评论中跨多个硬件类别运行测试:

/e2e tests/e2e/pull_request/one_card/test_offline_inference.py tests/e2e/pull_request/two_card/test_data_parallel.py

Re-trigger after fixing an issue: just push a new commit. The synchronize event re-runs the workflow and picks up the existing /e2e comment automatically — no need to post a new comment.

故障排查

添加标签后工作流未启动。

  • Make sure the /e2e comment was posted before the label was added. If the label was added first, remove it and re-add it after posting the comment.
  • Check that the comment starts exactly with /e2e followed by at least one path, with no leading spaces or extra characters before the slash.
  • To re-trigger after fixing an issue, simply push a new commit — the workflow will reuse the existing /e2e comment automatically.

测试运行在了错误的硬件上。

  • Check that the path includes the expected directory segment (one_card, two_card, four_card, or _310p). Paths that do not match any of these patterns are routed to the one_card runner by default.

parse-comment 任务因权限错误被跳过。

  • Only the PR 作者或写入/管理员合作者s can use the comment trigger. Ask a maintainer to post the /e2e comment instead.