Repository navigation
[CI/Build] Build NPU wheels for prerelease tags - #4574
Manifold68575 wants to merge 7 commits into
Conversation
Aionw
left a comment
There was a problem hiding this comment.
Thanks for picking up #4405. The direction looks right to me: prerelease NPU wheels go to the GitHub Pre-release, and PyPI publication stays limited to stable releases in the upstream repo. A few notes before merging.
Blocking: NPU's stable/prerelease classification no longer matches the other release workflows
Today every release workflow uses the same coarse rule: a tag containing - is never a stable release. release.yaml, release-cuda13, release-non-cuda and the three EFA workflows all gate on !contains(github.ref_name, '-'). MUSA and ROCm reject *-* tags in their dispatch validation. pre-release.yaml only matches v*-rc*, v*-alpha*, v*-beta* and v*-pre*. The rule is crude, but all workflows agree on it, so a tag is either published to PyPI by all of them or by none.
This PR switches NPU to "whatever packaging.Version accepts". As a result, NPU disagrees with the other workflows on hyphenated tags that PEP 440 normalizes to stable versions:
| Tag | Other release workflows | NPU after this PR |
|---|---|---|
v0.3.14-rc1 |
GitHub Pre-release (CUDA family) | GitHub Pre-release ✅ |
v0.3.13-1, v0.3.13-post1 |
all skipped | published to PyPI as stable |
For the second row, packaging parses both tags as 0.3.13.post1 with is_prerelease=False. The NPU wheel would then go to production PyPI on its own, while every other package skips the tag. Because the stable path doesn't override the version, that wheel also carries whatever version pyproject.toml has, not the tag's. A PyPI filename can't be reused even after deletion, so a mistaken tag like this can't be undone.
Historically every patch release has used .postN and every hyphenated tag has been alpha/beta/rc, so this is unlikely to happen. But the cost is irreversible and the fix is small. I'd suggest keeping the repo-wide rule and adding prerelease handling only on the hyphenated branch:
- no
-in the tag: stable, exactly as before; -in the tag: must passscripts/ci/testpypi_wheel_gate.py normalize-version, the same checkpre-release.yamluses (it requiresis_prereleaseand rejects local versions); otherwise fail.
This also removes the duplicated normalization logic: pre-release.yaml and this workflow would share one definition of "prerelease tag" instead of two slightly different ones. The cost is one checkout step in version-stamp.
Non-blocking
make_latest: 'legacy'changes stable behavior; see the inline comment.- Most of the new tests assert the workflow's exact expression strings; see the inline comment.
Also note that after merging, a maintainer still needs to dispatch the workflow manually to backfill the v0.3.14-rc1 NPU wheels.
| - name: Install version parser | ||
| run: python -m pip install packaging | ||
|
|
||
| - name: Normalize release tag |
There was a problem hiding this comment.
This accepts any tag that packaging.Version parses, so v0.3.13-1 and v0.3.13-post1 (both parse as 0.3.13.post1) are classified as stable and reach publish-pypi, while every other release workflow skips hyphenated tags. See the review summary.
Suggest keeping the stable path for tags without -, and requiring hyphenated tags to pass the existing check, so NPU and pre-release.yaml share one rule:
if [[ "$RELEASE_TAG" == *-* ]]; then
version=$(python scripts/ci/testpypi_wheel_gate.py normalize-version --tag "$RELEASE_TAG")
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
else
# stable: unchanged behavior
...
fi| tag_name: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }} | ||
| tag_name: ${{ needs.version-stamp.outputs.release_tag }} | ||
| prerelease: ${{ needs.version-stamp.outputs.is_prerelease == 'true' }} | ||
| make_latest: ${{ needs.version-stamp.outputs.is_prerelease == 'true' && 'false' || 'legacy' }} |
There was a problem hiding this comment.
Nit: on stable releases this used to omit make_latest. The release is usually created first by release.yaml (still on softprops/action-gh-release@v1), and an update without make_latest leaves the Latest flag alone. Now NPU always sends legacy on update. Passing an empty string keeps the old behavior, because softprops drops the field when the input is empty:
make_latest: ${{ needs.version-stamp.outputs.is_prerelease == 'true' && 'false' || '' }}| self.assertNotEqual(result.returncode, 0) | ||
| self.assertEqual(values, {}) | ||
|
|
||
| def test_build_uses_validated_tag_for_push_and_manual_runs(self): |
There was a problem hiding this comment.
Nit: the tests that run the normalizer and the sed override check real behavior, which is useful. This test and test_github_prereleases_are_separate_from_production_pypi mostly restate the workflow's if: / needs: expressions verbatim, so any refactor (e.g. #3970) breaks them even when the behavior is unchanged. I'd keep only the behavioral tests. If the classification moves into testpypi_wheel_gate.py as suggested, those tests can import the function directly instead of extracting a run: block from YAML.
|
@Aionw Thank you for the careful review and for catching the publication-policy mismatch. I have pushed three small follow-up commits addressing all three points:
Local validation passed: all 21 CI script tests (including 3 NPU behavioral tests), all 6 existing wheel-gate tests, scoped pre-commit, actionlint, and The updated PR CI has been triggered. Full Ascend/CANN builds and real publication remain unvalidated locally, and the historical rc1 backfill still needs a maintainer dispatch after merge. I would appreciate another look when you have time. Thank you again for helping keep this aligned with the other release workflows. |
Signed-off-by: Manifold68575 <14250491@cumt.edu.cn>
Description
NPU release jobs currently skip hyphenated tags, so
v0.3.14-rc1produces no NPU wheels. This change preserves the repository-wide rule that tags without a hyphen follow the stable path. Hyphenated tags must pass the existingtestpypi_wheel_gate.py normalize-versionpublic prerelease check; tags such asv0.3.13-1andv0.3.13-post1fail before any publication outputs are written. Both push and manual runs use this classification. The workflow builds prerelease wheels with a normalized PEP 440 version (v0.3.14-rc1->0.3.14rc1), and uploads them to the corresponding GitHub Release withprerelease=trueandmake_latest=false.Production PyPI publication is a separate job restricted to stable releases in the upstream repository. GitHub uploads no longer depend on the protected
pypienvironment. The native build matrix and stable wheel version handling are unchanged. Stable GitHub uploads leavemake_latestempty to preserve the existing Latest flag; prerelease uploads explicitly set it to false.Fixes #4405. A maintainer will still need to run the updated workflow manually to backfill the missing rc1 assets after merge; no release assets have been uploaded by this PR.
Related work: #3970 migrates wheel assembly to the root scikit-build backend and changes the same workflow's build steps. This PR addresses prerelease tag handling and publication policy, which #3970 does not cover. If that migration lands first, the prerelease version override will need to use its version interface.
Module
mooncake-transfer-engine)mooncake-store)mooncake-conductor)mooncake-reshard)mooncake-ep)mooncake-pg)mooncake-integration)mooncake-p2p-store)mooncake-wheel)mooncake-common)mooncake-rl)Type of Change
How Has This Been Tested?
Test commands:
# WSL Ubuntu 24.04, Python 3.12 virtual environment with packaging, PyYAML and pytest. python -m unittest discover -s scripts/ci/tests -v python -m pytest -q mooncake-wheel/tests/test_testpypi_wheel_gate.py --confcutdir=mooncake-wheel/tests pre-commit run --files .github/workflows/release-npu.yaml scripts/ci/tests/test_npu_release.py actionlint -shellcheck= -pyflakes= .github/workflows/release-npu.yaml git diff --check origin/main...HEADTest results:
The new tests execute the workflow's actual tag parser and version override commands. They cover seven accepted tags and eight rejected inputs, including the two hyphenated post-release tags raised in review and rejection before exporting outputs. They also execute the temporary wheel version override. Exact-expression workflow assertions were removed following review; the normalization command uses the existing shared prerelease gate. The regression cases failed against the previous PR revision and passed after the classification fix. The tests failed against the original workflow before the implementation was added. The final committed files were compared byte-for-byte with the independently checked WSL copies.
Ordinary PR CI discovers these unit tests; the tag/manual NPU release workflow still needs maintainer validation for the full build matrix and publication.
Checklist
./scripts/code_format.sh(not applicable: no C/C++ changes; Python formatting passed through pre-commit)AI Assistance Disclosure
OpenAI Codex assisted with issue and workflow investigation, implementation, regression tests, local validation, and PR preparation. The human submitter confirmed reviewing every changed line and being able to explain and defend the initial fix, and authorized the follow-up changes addressing the three maintainer review comments. Codex implemented and tested those follow-up changes.