Skip to content

refactor: extract shared logic from nightly build scripts - #4

Open
maobaolong wants to merge 1 commit into
mainfrom
refactor/dedupe-nightly-build-scripts
Open

maobaolong wants to merge 1 commit into
mainfrom
refactor/dedupe-nightly-build-scripts

Conversation

@maobaolong

Copy link
Copy Markdown
Collaborator

What

Both build_and_publish_vllm_cpu_nightly.sh (Linux/docker) and build_and_publish_vllm_cpu_nightly_macos.sh (macOS) shared ~270 lines of near-identical logic. This PR extracts it into scripts/common/:

  • helpers.sh: log()/die(), compute_nightly_version(), check_wheel_size()
  • patch_vllm_source.sh: patches pyproject.toml name, strips +cpu from requirements/cpu.txt, fixes the fla.cpp constexpr issue
  • resolve_torch_requirement.py: picks the platform-applicable torch== pin from requirements/cpu.txt
  • verify_wheel_torch.py: verifies a built wheel declares the torch version it was actually compiled against

How

  • The Linux script mounts scripts/common/ read-only into the build container (-v .../common:/opt/vllm-cpu-nightly-common:ro) and sources/invokes the shared files inside docker exec.
  • The macOS script sources/invokes the same files directly on the host (no container boundary).

Testing

  • bash -n on all shell scripts, python -m py_compile on the python scripts.
  • Manually diffed each extracted block against the original inline code to confirm no behavior change (version-bump arithmetic, patch regexes, verification logic all identical).

No behavior change intended.

Both build_and_publish_vllm_cpu_nightly.sh (Linux/docker) and
build_and_publish_vllm_cpu_nightly_macos.sh had ~270 lines of duplicated
logic: log/die helpers, nightly-version computation, vLLM source patching
(pyproject.toml rename, requirements/cpu.txt +cpu stripping, fla.cpp
constexpr fix), torch requirement resolution, and wheel torch-version
verification.

Extract this into scripts/common/:
- helpers.sh: log(), die(), compute_nightly_version(), check_wheel_size()
- patch_vllm_source.sh: the three source patches
- resolve_torch_requirement.py: pick the applicable torch== pin
- verify_wheel_torch.py: verify built wheel declares the torch it was
  built against

The Linux script mounts common/ read-only into the build container so the
same code runs on both sides of the docker boundary; the macOS script
sources/invokes it directly since it runs natively on the host.

No behavior change intended; version-bump math, patch regexes, and wheel
verification logic are unchanged, just de-duplicated.
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.

1 participant