Skip to content

perf(ci): reduce duplicate builds and reuse native artifacts - #6751

Merged
qin-ctx merged 10 commits into
volcengine:mainfrom
zhanglistar:perf/ci-build-reuse
Oct 30, 2026
Merged

qin-ctx merged 10 commits into
volcengine:mainfrom
zhanglistar:perf/ci-build-reuse

Conversation

@zhanglistar

@zhanglistar zhanglistar commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

CI dependency setup implicitly builds OpenViking before explicit native build steps, and API and cuVS jobs repeat the same compilation. This change removes those repeated builds and lets Linux API tests (Python 3.10) and cuVS tests (3.11) share one same-run cp310-abi3 runtime.

  • Cancel superseded PR runs and select jobs/platforms from a merge-base diff, including renamed/deleted paths. Native and build configuration changes retain all five wheel platforms; release distribution defaults remain unchanged.
  • Cache Cargo intermediates and C++ compiler output with runner and toolchain isolation. Primary keys include the commit SHA so later main builds can save updated compiler output; compatible prefix restores reuse the newest available entries, preferring the same Cargo lockfile. Only official main runs save; PR/fork/tag runs restore only. Ccache is capped at 256 MiB and Cargo incremental output is disabled.
  • Build Studio once per distribution workflow and reuse it across wheel jobs. Validate native bundles against commit, OS, architecture, libc, platform, ABI, build options and checksums before restoring them. Release wheels build independently in their own environments.
  • Runtime Markdown skills and prompt templates reach the workflow planner and select API tests.

The cuVS job moves into the API workflow to consume the same-run artifact, preserving the exact check context cuvs-tests / Lite Test (ubuntu-24.04, 3.11) and its test list and Python version.

Observed before/after results

These are single-run observations, not a repeated benchmark. The optimized measurements below come from API workflow run 40832753623 at 49b5ea26, before the final cache rollover fix in 1f3beb3b7. Job execution times exclude runner queueing.

Job Previously inspected baseline Optimized run
API & CLI integration 27m 03s 4m 21s
cuVS regression 21m 59s 1m 01s
Shared native runtime build Included separately in the test jobs 14m 47s, built once

The optimized API and cuVS jobs both downloaded artifact 12881871620 (native-runtime-linux-x64-cp310-abi3) and skipped local native compilation. API/CLI reported 130 passing tests; cuVS reported 112 passing tests.

The shared build must be included when assessing the saving: the three listed jobs consumed 20m 09s of combined execution time versus 49m 02s for the two baseline jobs, approximately 59% less combined runner execution time. This is not a 59% reduction in workflow wall time.

Runner availability remains the main delay. The optimized API workflow took 1h 20m 53s from creation to completion. Its shared native job waited about 32 minutes after preparation, and cuVS waited about 25 minutes after the native artifact was ready. Cargo and ccache both missed in this run, so the measured native build was cold; these results do not establish a warm-cache speedup.

All build and test checks for 49b5ea26 completed successfully, including the five wheel platforms and Rust CLI targets; npm publishing was intentionally skipped. See the PR checks run and Rust CLI run. Those results do not validate the subsequently pushed 1f3beb3b7.

Test plan

  • 25 dependency-free CI helper tests passed locally, including later-main cache rollover, newest compatible PR restores, runner/toolchain isolation, lockfile preference, legacy cache recovery, CI selection and artifact validation.
  • The cache rollover regression fails against the previous fixed-key action configuration.
  • Updated cache action YAML parsing, Ruff lint/format and git diff whitespace checks passed.
  • 28 packaging, ABI, versioning and build-support regression tests passed during implementation.
  • Existing workflow changes passed actionlint during implementation.
  • Actual macOS arm64 C++ build with compiler launchers and native engine import passed during implementation.
  • Editable installation with native compilation disabled produced the expected entry points.
  • Complete GitHub build/test checks and runtime artifact reuse verified at 49b5ea26, with execution and queue times recorded above.
  • Verify GitHub checks for the final cache rollover commit 1f3beb3b7.
  • After merge, confirm two successive official main revisions restore compatible entries and successfully save distinct cache keys with updated compiler output.

Reduce runner contention with PR cancellation, change-aware job selection, compiler caches, and validated same-run native and Studio artifacts.
Keep shared compiler caches stable and writable only from official main runs, preserve the cuVS required check context, and prevent runtime skill and prompt files from bypassing API tests.
Version immutable cache entries by commit while restoring compatible prefixes so later main builds retain new compiler output. Preserve main-only writes and cover cache rollover, PR restores, toolchain isolation, and legacy entries.
Allow trusted manual runs to use ov-ci-runner in an Ubuntu 24.04 container while preserving native artifact compatibility and hosted PR defaults. Add a Linux-only trial option and cover runner selection boundaries.
Route official PR, scheduled and release native builds to the dedicated runner to reduce hosted queueing, while retaining a manual hosted override.
Keep service-dependent P0 memory tests on openviking-ecs and default other Linux x64 tests and builds to ov-ci-runner. Preserve platform matrices and add explicit container dependencies and Docker test cleanup for persistent hosts.

@qin-ctx qin-ctx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

编译复用有实际价值,但当前 PR 同时把大多数 Linux CI,包括 Docker 镜像发布,迁到了自托管 runner。建议将这部分基础设施迁移拆出,明确任务隔离和机器生命周期后单独评审。

本轮明确的合并阻塞是:仅修改插件市场清单时,原有安装入口测试会被跳过,需要补齐任务选择。另有两项依赖 runner 部署方式的设计问题:外部 PR 与镜像发布共用 runner 的隔离,以及复用宿主机时历史镜像引用混入后续发布。后两项按 non-blocking 提出,不代表已经证实凭据泄露或线上发布异常。

Comment thread .github/scripts/ci_plan.py Resolved
Scope Git safe.directory settings to the two CI checkouts through inherited environment configuration so container ownership checks do not block installer validation.
Return ordinary tests and builds to hosted runners so execution savings can be measured independently of self-hosted capacity. Keep the existing P0 memory suite pinned to its original ECS host.
@zhanglistar

Copy link
Copy Markdown
Collaborator Author

@zhanglistar

Copy link
Copy Markdown
Collaborator Author

对照主干现有构建流程,优化有明显效果。此前“macOS、Windows 基本持平”的结论需要修正:那是两轮已优化版本之间的比较。

主干Main Branch Checks 只跑 CodeQL,没有发行包构建。因此我选取了优化前 8–11 小时内的 3 轮成功 PR 构建 ;核对文件哈希后,确认它们的_build.yml 与主干完全一致。以下取三轮中位数,均为执行时间,排除排队:

image

把所有发行包任务相加, 并计入新增的共享 Studio 构建 ,累计执行时间从中位数 213分10秒 降到 111分26秒 ,减少约 48% 。整轮检查实际等待时间从基线中位数 60分52秒 降到 34分02秒 ,这项也受调度影响。

日志支持节省的原因:旧流程的uv sync 会先构建 OpenViking,单是依赖安装就耗费:

  • macOS Intel:36–46 分钟
  • Windows:24–26 分钟
  • macOS ARM:15–16 分钟
    优化后,创建环境和安装构建依赖只需几秒,正式编译集中在后续构建步骤。 本次 macOS Intel、Windows 的 Cargo 和 ccache 均未命中,说明这部分收益在冷构建下就已出现。

这些是不同代码提交的观察样本,而且三个基线来自同一 PR 的不同版本,尚非严格同提交实验;但多个平台一致下降,加上日志确认去掉了安装阶段的构建,足以支持优化有效。

@qin-ctx
qin-ctx merged commit de9803e into volcengine:main Oct 30, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Oct 30, 2026
@cla-assistant

cla-assistant Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants