Skip to content

Commit 2567181

Browse files
committed
refactor: verify wheel installs in container
Signed-off-by: Aaron Gonzales <aagonzales@nvidia.com>
1 parent 051532c commit 2567181

10 files changed

Lines changed: 64 additions & 373 deletions

File tree

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ __pycache__/
2424
.venv/
2525

2626
# Build artifacts
27-
dist/
27+
dist/*
28+
!dist/*.whl
2829
htmlcov/
2930
coverage.json
3031
coverage.xml

.github/actions/detect-changes/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,6 @@ runs:
8585
- '.github/actions/**'
8686
- '.mise.toml'
8787
- '.mise/tasks/**'
88+
- '.dockerignore'
89+
- 'containers/Dockerfile.test_ci'
8890
- 'tools/release_version.py'
89-
- 'tools/verify_wheel_install.py'

.github/workflows/ci-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
run: mise run build-wheel
153153

154154
- name: Verify clean end-user wheel install
155-
run: mise run release:verify-wheel -- dist/*.whl
155+
run: mise run release:verify-wheel
156156

157157
unit-test:
158158
name: Unit Tests

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
echo "Built: $WHEEL (version $VERSION)"
7070
7171
- name: Verify clean end-user wheel install
72-
run: mise run release:verify-wheel -- dist/*.whl
72+
run: mise run release:verify-wheel
7373

7474
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
7575
with:

.mise/tasks/release/verify-wheel

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,19 @@ set -euo pipefail
77
source "${MISE_CONFIG_ROOT}/.mise/tasks/_lib.sh"
88

99
tool_root="${MISE_CONFIG_ROOT:-$(git rev-parse --show-toplevel)}"
10-
python_version="$(resolve_python_version)"
10+
container_cmd="$(resolve_container_cmd)"
1111

12-
if (( $# > 0 )); then
13-
wheel="$1"
14-
shift
15-
else
16-
shopt -s nullglob
17-
wheels=("${tool_root}"/dist/*.whl)
18-
if (( ${#wheels[@]} != 1 )); then
19-
echo "Error: expected exactly one wheel under ${tool_root}/dist, found ${#wheels[@]}" >&2
20-
exit 1
21-
fi
22-
wheel="${wheels[0]}"
12+
shopt -s nullglob
13+
wheels=("${tool_root}"/dist/*.whl)
14+
if (( ${#wheels[@]} != 1 )); then
15+
echo "Error: expected exactly one wheel under ${tool_root}/dist, found ${#wheels[@]}" >&2
16+
exit 1
2317
fi
2418

25-
uv --no-config run --no-project --python "${python_version}" \
26-
"${tool_root}/tools/verify_wheel_install.py" \
27-
"${wheel}" --python "${python_version}" "$@"
19+
"${container_cmd}" build \
20+
--platform "${CONTAINER_TEST_PLATFORM:-linux/amd64}" \
21+
--progress=plain \
22+
--file "${CONTAINER_TEST_FILE:-containers/Dockerfile.test_ci}" \
23+
--target wheel-install \
24+
--tag "${CONTAINER_WHEEL_INSTALL_IMAGE:-nss-wheel-install:latest}" \
25+
"${tool_root}"

containers/Dockerfile.test_ci

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,41 @@ RUN MISE_GPG_KEY=24853EC9F655CE80B48E6C3A8B81C9D17413A06D \
2424
MISE_YES=1 mise trust && \
2525
PYTHON_VERSION="${PYTHON_VERSION}" MISE_YES=1 mise run setup
2626

27+
FROM setup AS wheel-install
28+
29+
ENV UV_LINK_MODE=copy
30+
31+
COPY dist/*.whl /tmp/dist/
32+
33+
RUN --mount=type=cache,target=/root/.cache/uv \
34+
wheel_count="$(find /tmp/dist -maxdepth 1 -type f -name '*.whl' | wc -l)" && \
35+
test "${wheel_count}" -eq 1 && \
36+
wheel="$(find /tmp/dist -maxdepth 1 -type f -name '*.whl')" && \
37+
uv --no-config venv --clear --python /usr/local/bin/python /opt/wheel-cpu && \
38+
uv --no-config pip install \
39+
--python /opt/wheel-cpu/bin/python \
40+
--no-sources \
41+
--default-index https://pypi.org/simple \
42+
--index https://download.pytorch.org/whl/cpu \
43+
--index-strategy unsafe-best-match \
44+
"nemo-safe-synthesizer[cpu,engine] @ file://${wheel}" && \
45+
uv --no-config pip check --python /opt/wheel-cpu/bin/python && \
46+
/opt/wheel-cpu/bin/python -c \
47+
"from importlib.metadata import version; from nemo_safe_synthesizer.package_info import __version__; assert __version__ == version('nemo-safe-synthesizer')" && \
48+
/opt/wheel-cpu/bin/safe-synthesizer --help >/dev/null && \
49+
uv --no-config venv --clear --python /usr/local/bin/python /opt/wheel-cu129 && \
50+
uv --no-config pip install \
51+
--python /opt/wheel-cu129/bin/python \
52+
--no-sources \
53+
--dry-run \
54+
--default-index https://pypi.org/simple \
55+
--index https://flashinfer.ai/whl/cu129 \
56+
--index https://download.pytorch.org/whl/cu129 \
57+
--index https://wheels.vllm.ai/ee0da84ab9e04ac7610e28580af62c365e898389/cu129 \
58+
--index-strategy unsafe-best-match \
59+
"nemo-safe-synthesizer[cu129,engine] @ file://${wheel}" && \
60+
rm -rf /opt/wheel-cpu /opt/wheel-cu129
61+
2762
FROM setup AS install-deps
2863
# Install Python dependencies (cached until pyproject.toml, uv.lock, or src/ or tests/ change)
2964
COPY pyproject.toml .

containers/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,22 @@ before enabling a platform in CI.
123123
## CPU Test Image
124124

125125
`Dockerfile.test_ci` provides a CPU-only image for running unit tests locally
126-
or in CI without a GPU. It uses a two-stage build: `setup` (system packages +
127-
mise-managed tools) and `install-deps` (Python environment via
128-
`mise run bootstrap-nss cpu`).
126+
or in CI without a GPU. Its `setup` stage installs system packages and
127+
mise-managed tools, while `install-deps` creates the Python environment with
128+
`mise run bootstrap-nss cpu`. The separate `wheel-install` stage installs the
129+
built wheel without project sources, runs CPU package and CLI checks, and
130+
resolves the CUDA dependency set.
129131

130132
```bash
131133
# Run CI unit tests in a container
132134
mise run test:ci-container
133135

134136
# Verify mise-managed tools install correctly (fast -- setup stage only)
135137
mise run test:tool-install
138+
139+
# Verify the built wheel in a clean container stage
140+
mise run build-wheel
141+
mise run release:verify-wheel
136142
```
137143

138144
### CPU Test Mise Tasks
@@ -143,3 +149,4 @@ mise run test:tool-install
143149
| `container:build:test-setup` | Build only the setup stage (tools, no Python deps) |
144150
| `test:ci-container` | Build and run CI unit tests |
145151
| `test:tool-install` | Verify mise-managed tools install correctly (setup stage only) |
152+
| `release:verify-wheel` | Install and verify the built wheel in the clean wheel stage |

tests/tools/test_release_workflows.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

tests/tools/test_verify_wheel_install.py

Lines changed: 0 additions & 160 deletions
This file was deleted.

0 commit comments

Comments
 (0)