mirror of
https://github.com/debpalash/VoiceStudio.git
synced 2026-12-04 01:18:16 +00:00
ci: faster Python tests and ROCm image builds; smaller installers (#4322)
* ci: shard Python tests, cache ROCm image layers, mount uv cache in Docker build * build(electron): ship only main-process dependencies in app.asar * docs(changelog): fragments for #4322 * ci: shard hook no longer leaks into nested pytest runs; refresh flake node-deps hash; fix moss rebound fixture
This commit is contained in:
1 parent
1f658f844e
commit
42f0f93b8f
13 files changed
+196
-80
No files matched your search
@@ -163,13 +163,21 @@ jobs:
|
||||
shell: pwsh
|
||||
run: ./electron/tests/powershell-installer.ps1
|
||||
|
||||
# Two shards of tests/ (whole modules, see conftest.py
|
||||
# pytest_collection_modifyitems) run in parallel; shard 1 also runs the serial
|
||||
# backend/tests session, shard 2 the mobile token checks. `test` gates on the
|
||||
# job's aggregate result, so the required check name is unchanged.
|
||||
test-python:
|
||||
name: Tests (Python)
|
||||
name: Tests (Python ${{ matrix.shard }}/2)
|
||||
needs: changes
|
||||
# Must report even if `changes` failed, so a detection error never skips the gate;
|
||||
# only a rejected external approval (changes skipped) stops it.
|
||||
if: ${{ !cancelled() && needs.changes.result != 'skipped' && needs.changes.outputs.runtime != 'false' }}
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard: [1, 2]
|
||||
env:
|
||||
# Same restricted-network resilience the smoke matrix already sets. This
|
||||
# job resolves the same direct-URL dependency and had none of it, which
|
||||
@@ -184,7 +192,7 @@ jobs:
|
||||
- id: pass
|
||||
uses: ./.github/actions/ci-pass
|
||||
with:
|
||||
job: test-python
|
||||
job: test-python-${{ matrix.shard }}
|
||||
content: |
|
||||
.
|
||||
|
||||
@@ -276,24 +284,25 @@ jobs:
|
||||
run: uv run --no-sync pytest tests/ -q --tb=short -n 6
|
||||
env:
|
||||
HF_HUB_OFFLINE: "1"
|
||||
VOICESTUDIO_TEST_SHARD: ${{ matrix.shard }}/2
|
||||
|
||||
# `backend/tests/` mounts routers on bare FastAPI apps (no heavy main
|
||||
# import chain) with a hermetic data dir from its conftest.py. It no
|
||||
# longer stubs sys.modules, so mixed sessions with tests/ are safe;
|
||||
# the separate session is kept for cheaper, clearer CI output.
|
||||
- name: Run pytest (backend/tests, isolated)
|
||||
if: steps.pass.outputs.hit != 'true'
|
||||
if: steps.pass.outputs.hit != 'true' && matrix.shard == 1
|
||||
run: uv run --no-sync pytest backend/tests/ -q --tb=short
|
||||
env:
|
||||
HF_HUB_OFFLINE: "1" # same no-silent-downloads guard as tests/
|
||||
|
||||
# Check the generated mobile files explicitly as well as through pytest.
|
||||
- name: Mobile theme tokens match Electron
|
||||
if: steps.pass.outputs.hit != 'true'
|
||||
if: steps.pass.outputs.hit != 'true' && matrix.shard == 2
|
||||
run: bun --no-install scripts/export-mobile-tokens.ts --check
|
||||
|
||||
- name: Mobile maintainer cards match Electron
|
||||
if: steps.pass.outputs.hit != 'true'
|
||||
if: steps.pass.outputs.hit != 'true' && matrix.shard == 2
|
||||
run: bun --no-install scripts/export-mobile-contributors.ts --check
|
||||
|
||||
# Last: record that these inputs passed, for later runs to skip.
|
||||
|
||||
@@ -385,9 +385,9 @@ jobs:
|
||||
type=raw,value=rocm,enable=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||
type=raw,value=sha-${{ steps.source.outputs.short_sha }}-rocm
|
||||
|
||||
# cache-from only: reading the CUDA job's exported cache reuses the
|
||||
# identical frontend-builder stage. Deliberately NO cache-to — the ROCm
|
||||
# runtime layers would overwrite the CUDA job's cache image.
|
||||
# Reads the ROCm cache first, then the CUDA job's cache (identical
|
||||
# frontend-builder stage). cache-to writes a SEPARATE ref so the ROCm
|
||||
# runtime layers never overwrite the CUDA job's cache image.
|
||||
# The ROCm base ships its own HIP torch, which must equal the checked-out
|
||||
# pin: a backfill of an older release builds that release's constraints,
|
||||
# so the base follows deploy/torch-constraints.txt, not this workflow.
|
||||
@@ -421,7 +421,11 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=${{ env.BUILDCACHE_IMAGE }}:buildkit
|
||||
cache-from: |
|
||||
type=registry,ref=${{ env.BUILDCACHE_IMAGE }}:buildkit-rocm
|
||||
type=registry,ref=${{ env.BUILDCACHE_IMAGE }}:buildkit
|
||||
# A failed cache export must never fail (or skip) the image publish.
|
||||
cache-to: type=registry,ref=${{ env.BUILDCACHE_IMAGE }}:buildkit-rocm,mode=max,ignore-error=true
|
||||
|
||||
- name: Backfill canonical GHCR release tags (ROCm)
|
||||
if: inputs.backfill_release
|
||||
|
||||
@@ -15,11 +15,17 @@
|
||||
"name": "voicestudio-electron",
|
||||
"version": "0.0.0-electron",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "^1.8.0",
|
||||
"@electron-toolkit/utils": "^4.0.0",
|
||||
"electron-updater": "^6.8.9",
|
||||
"proxy-agent": "6.5.0",
|
||||
"word-extractor": "1.0.4",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@base-ui/react": "^1.8.0",
|
||||
"@fontsource-variable/inter": "^5.3.0",
|
||||
"@lobehub/icons-static-svg": "^1.95.0",
|
||||
"@scalar/api-reference-react": "^0.9.67",
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"@tanstack/react-form": "^1.33.5",
|
||||
"@tanstack/react-pacer": "^0.23.0",
|
||||
"@tanstack/react-query": "^5.102.8",
|
||||
@@ -27,18 +33,27 @@
|
||||
"@tanstack/react-store": "^0.11.1",
|
||||
"@tanstack/react-virtual": "^3.14.13",
|
||||
"@tanstack/store": "^0.11.1",
|
||||
"@testing-library/jest-dom": "^7.0.1",
|
||||
"@testing-library/react": "^16.3.3",
|
||||
"@types/node": "^24.13.4",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@vidstack/react": "1.15.6",
|
||||
"@vitejs/plugin-react": "^6.1.1",
|
||||
"@xyflow/react": "^12.12.0",
|
||||
"builder-util": "26.15.3",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"cn": "^0.3.0",
|
||||
"country-flag-icons": "^1.6.20",
|
||||
"dashjs": "^5.2.1",
|
||||
"electron-updater": "^6.8.9",
|
||||
"electron": "^44.3.0",
|
||||
"electron-builder": "^26.15.3",
|
||||
"electron-vite": "6.0.0-beta.1",
|
||||
"hls.js": "^1.7.3",
|
||||
"html-entities": "^2.6.0",
|
||||
"i18next": "^26.4.2",
|
||||
"jsdom": "^30.0.1",
|
||||
"lucide-react": "^1.46.0",
|
||||
"proxy-agent": "6.5.0",
|
||||
"qrcode": "^1.5.4",
|
||||
"react": "^19.3.0",
|
||||
"react-dom": "^19.3.0",
|
||||
@@ -46,29 +61,14 @@
|
||||
"react-i18next": "^17.0.14",
|
||||
"shadcn": "^4.21.0",
|
||||
"sonner": "^2.0.8",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"wavesurfer.js": "^7.12.12",
|
||||
"word-extractor": "1.0.4",
|
||||
"zustand": "^5.0.15",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"@testing-library/jest-dom": "^7.0.1",
|
||||
"@testing-library/react": "^16.3.3",
|
||||
"@types/node": "^24.13.4",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@vitejs/plugin-react": "^6.1.1",
|
||||
"builder-util": "26.15.3",
|
||||
"electron": "^44.3.0",
|
||||
"electron-builder": "^26.15.3",
|
||||
"electron-vite": "6.0.0-beta.1",
|
||||
"jsdom": "^30.0.1",
|
||||
"tailwindcss": "^4.3.3",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"typescript": "^7.0.2",
|
||||
"vite": "^8.3.0",
|
||||
"vite-plus": "^1.5.0",
|
||||
"vitest": "5.1.0",
|
||||
"wavesurfer.js": "^7.12.12",
|
||||
"zustand": "^5.0.15",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1687,7 +1687,7 @@
|
||||
|
||||
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
|
||||
|
||||
"nanoid": ["nanoid@3.3.18", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w=="],
|
||||
"nanoid": ["nanoid@5.1.16", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ=="],
|
||||
|
||||
"negotiator": ["negotiator@1.1.0", "", { "dependencies": { "content-type": "^2.1.0" } }, "sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg=="],
|
||||
|
||||
@@ -2319,14 +2319,10 @@
|
||||
|
||||
"@modelcontextprotocol/sdk/zod": ["zod@4.5.4", "", {}, "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA=="],
|
||||
|
||||
"@scalar/api-client/nanoid": ["nanoid@5.1.16", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ=="],
|
||||
|
||||
"@scalar/api-client/yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="],
|
||||
|
||||
"@scalar/api-client/zod": ["zod@4.5.4", "", {}, "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA=="],
|
||||
|
||||
"@scalar/api-reference/nanoid": ["nanoid@5.1.16", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ=="],
|
||||
|
||||
"@scalar/api-reference/yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="],
|
||||
|
||||
"@scalar/components/@floating-ui/utils": ["@floating-ui/utils@0.2.10", "", {}, "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ=="],
|
||||
@@ -2339,10 +2335,6 @@
|
||||
|
||||
"@scalar/snippetz/stringify-object": ["stringify-object@6.0.0", "", { "dependencies": { "get-own-enumerable-keys": "^1.0.0", "is-identifier": "^1.0.1", "is-obj": "^3.0.0", "is-regexp": "^3.1.0" } }, "sha512-6f94vIED6vmJJfh3lyVsVWxCYSfI5uM+16ntED/Ql37XIyV6kj0mRAAiTeMMc/QLYIaizC3bUprQ8pQnDDrKfA=="],
|
||||
|
||||
"@scalar/themes/nanoid": ["nanoid@5.1.16", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ=="],
|
||||
|
||||
"@scalar/types/nanoid": ["nanoid@5.1.16", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ=="],
|
||||
|
||||
"@scalar/types/zod": ["zod@4.5.4", "", {}, "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA=="],
|
||||
|
||||
"@scalar/workspace-store/yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="],
|
||||
@@ -2485,6 +2477,8 @@
|
||||
|
||||
"pnpm-workspace-yaml/yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="],
|
||||
|
||||
"postcss/nanoid": ["nanoid@3.3.18", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w=="],
|
||||
|
||||
"postject/commander": ["commander@9.5.0", "", {}, "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ=="],
|
||||
|
||||
"pretty-format/ansi-styles": ["ansi-styles@5.2.0", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="],
|
||||
@@ -2503,8 +2497,6 @@
|
||||
|
||||
"radix-vue/@vueuse/shared": ["@vueuse/shared@10.11.1", "", { "dependencies": { "vue-demi": ">=0.14.8" } }, "sha512-LHpC8711VFZlDaYUXEBbFBCQ7GS3dVU9mjOhhMhXP6txTV4EhYQg/KGnQuvt/sPAtoUKq7VVUnL6mVtFoL42sA=="],
|
||||
|
||||
"radix-vue/nanoid": ["nanoid@5.1.16", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ=="],
|
||||
|
||||
"rolldown/@oxc-project/types": ["@oxc-project/types@0.148.0", "", {}, "sha512-Nm4s/jB+4FpFsPhWGEC4h7rzksesmtnMXomo6rCMcg/b8zLQuOziRgkCS1fxDCXOlJB/6Q8oABOZ/OP6RIPj9A=="],
|
||||
|
||||
"send/mime-types": ["mime-types@3.0.2", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A=="],
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Windows, macOS and Linux installers drop about 425 MB of unused UI packages from the app archive (#4322)
|
||||
@@ -0,0 +1 @@
|
||||
Python tests now run as two parallel shards and the ROCm Docker image reuses its own layer cache, shortening CI (#4322)
|
||||
+27
@@ -3,6 +3,7 @@
|
||||
Only fixtures that both suites need live here; each suite's own conftest.py
|
||||
still owns its import path and hermetic data dir.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import types
|
||||
|
||||
@@ -95,3 +96,29 @@ def pytest_make_parametrize_id(config, val, argname):
|
||||
if isinstance(val, (str, bytes)) and len(val) > _MAX_PARAM_ID:
|
||||
return f"{argname}-len{len(val)}"
|
||||
return None
|
||||
|
||||
|
||||
def pytest_collection_modifyitems(config, items):
|
||||
"""CI sharding: VOICESTUDIO_TEST_SHARD="i/N" keeps every N-th test module.
|
||||
|
||||
Whole modules (never single tests) are dealt round-robin over the sorted
|
||||
module paths, so module-level state stays together and the N shards are a
|
||||
disjoint partition of the full collection. Unset = run everything.
|
||||
"""
|
||||
spec = os.environ.get("VOICESTUDIO_TEST_SHARD", "").strip()
|
||||
if not spec:
|
||||
return
|
||||
# Consumed here: tests that spawn a nested pytest must see the whole suite,
|
||||
# not inherit this session's shard (it would collect nothing and fail).
|
||||
os.environ.pop("VOICESTUDIO_TEST_SHARD", None)
|
||||
index, _, total = spec.partition("/")
|
||||
index, total = int(index), int(total)
|
||||
if not 1 <= index <= total:
|
||||
raise pytest.UsageError(f"VOICESTUDIO_TEST_SHARD={spec!r} must be i/N with 1 <= i <= N")
|
||||
modules = sorted({item.nodeid.split("::", 1)[0] for item in items})
|
||||
mine = {m for pos, m in enumerate(modules) if pos % total == index - 1}
|
||||
kept = [i for i in items if i.nodeid.split("::", 1)[0] in mine]
|
||||
dropped = [i for i in items if i.nodeid.split("::", 1)[0] not in mine]
|
||||
if dropped:
|
||||
config.hook.pytest_deselected(items=dropped)
|
||||
items[:] = kept
|
||||
+13
-5
@@ -100,6 +100,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
# we want. No-ops on the conda-based CUDA image.
|
||||
ENV PIP_BREAK_SYSTEM_PACKAGES=1
|
||||
ENV UV_BREAK_SYSTEM_PACKAGES=1
|
||||
# uv's download/wheel cache lives in a BuildKit cache mount (never in a layer),
|
||||
# so rebuilds that change only one dependency reuse the rest. The mount is a
|
||||
# different filesystem from site-packages, so copy instead of hardlinking.
|
||||
ENV UV_CACHE_DIR=/root/.cache/uv
|
||||
ENV UV_LINK_MODE=copy
|
||||
|
||||
# Install `uv` for blazing-fast reliable pip resolution
|
||||
# (`python3 -m pip` — not every base symlinks a bare `pip` onto PATH)
|
||||
@@ -141,7 +146,8 @@ COPY deploy/security-constraints.txt deploy/security_floors.py ./deploy/
|
||||
# --override: `[tool.uv] override-dependencies` lifts caps that block security
|
||||
# releases (gradio's `pillow<13`), but `uv pip install` applies it only when run
|
||||
# from the project directory with a recent uv; pass it explicitly (#3275).
|
||||
RUN uv pip install --python "$(command -v python3)" --no-cache \
|
||||
RUN --mount=type=cache,target=/root/.cache/uv,sharing=locked \
|
||||
uv pip install --python "$(command -v python3)" \
|
||||
--constraint deploy/torch-constraints.txt \
|
||||
--constraint deploy/security-constraints.txt \
|
||||
--override deploy/uv-overrides.txt .
|
||||
@@ -157,10 +163,11 @@ RUN python3 -c "from importlib.metadata import version; from packaging.requireme
|
||||
# requires: the install above leaves them alone (msgpack 1.1.1 in
|
||||
# pytorch/pytorch), so upgrade what is below its floor, then fail the build if
|
||||
# anything still is. Packages the image does not install are skipped.
|
||||
RUN floors="$(python3 deploy/security_floors.py requirements)" \
|
||||
RUN --mount=type=cache,target=/root/.cache/uv,sharing=locked \
|
||||
floors="$(python3 deploy/security_floors.py requirements)" \
|
||||
&& if [ -n "$floors" ]; then \
|
||||
echo "Raising to security floors: $floors" \
|
||||
&& uv pip install --python "$(command -v python3)" --no-cache \
|
||||
&& uv pip install --python "$(command -v python3)" \
|
||||
--constraint deploy/torch-constraints.txt \
|
||||
--constraint deploy/security-constraints.txt \
|
||||
--override deploy/uv-overrides.txt $floors; \
|
||||
@@ -188,9 +195,10 @@ RUN python3 -c "import os, torch, torchaudio, torchvision; \
|
||||
# Skipped for ROCm (no cuDNN there) and for aarch64: nvidia-cudnn-cu12==8.9.7.29
|
||||
# has no aarch64 wheel (DGX Spark / GH200 builds, #2831), so CTranslate2 ASR
|
||||
# stays unavailable on those images.
|
||||
RUN if [ "$GPU_FLAVOR" = "cuda" ] && [ "$(uname -m)" != "aarch64" ]; then \
|
||||
RUN --mount=type=cache,target=/root/.cache/uv,sharing=locked \
|
||||
if [ "$GPU_FLAVOR" = "cuda" ] && [ "$(uname -m)" != "aarch64" ]; then \
|
||||
target="$(python3 -c "import sys; print(f'{sys.prefix}/lib/python{sys.version_info.major}.{sys.version_info.minor}/site-packages/cudnn8_compat')")" \
|
||||
&& uv pip install --python "$(command -v python3)" --no-cache --no-deps \
|
||||
&& uv pip install --python "$(command -v python3)" --no-deps \
|
||||
--target "$target" nvidia-cudnn-cu12==8.9.7.29 \
|
||||
&& CUDNN8_TARGET="$target" python3 -c "import glob, os; t = os.environ['CUDNN8_TARGET']; found = [f for f in glob.glob(t + '/nvidia/cudnn/lib/*') if '.so.8' in f]; assert found, 'cuDNN 8 libraries missing from ' + t; print(f'cuDNN 8 compat: {len(found)} libraries in ' + t)"; \
|
||||
else \
|
||||
|
||||
+22
-22
@@ -38,11 +38,17 @@
|
||||
"dmg:background": "node scripts/render-dmg-background.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@base-ui/react": "^1.8.0",
|
||||
"@electron-toolkit/utils": "^4.0.0",
|
||||
"electron-updater": "^6.8.9",
|
||||
"proxy-agent": "6.5.0",
|
||||
"word-extractor": "1.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@base-ui/react": "^1.8.0",
|
||||
"@fontsource-variable/inter": "^5.3.0",
|
||||
"@lobehub/icons-static-svg": "^1.95.0",
|
||||
"@scalar/api-reference-react": "^0.9.67",
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"@tanstack/react-form": "^1.33.5",
|
||||
"@tanstack/react-pacer": "^0.23.0",
|
||||
"@tanstack/react-query": "^5.102.8",
|
||||
@@ -50,18 +56,27 @@
|
||||
"@tanstack/react-store": "^0.11.1",
|
||||
"@tanstack/react-virtual": "^3.14.13",
|
||||
"@tanstack/store": "^0.11.1",
|
||||
"@testing-library/jest-dom": "^7.0.1",
|
||||
"@testing-library/react": "^16.3.3",
|
||||
"@types/node": "^24.13.4",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@vidstack/react": "1.15.6",
|
||||
"@vitejs/plugin-react": "^6.1.1",
|
||||
"@xyflow/react": "^12.12.0",
|
||||
"builder-util": "26.15.3",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"cn": "^0.3.0",
|
||||
"country-flag-icons": "^1.6.20",
|
||||
"dashjs": "^5.2.1",
|
||||
"electron-updater": "^6.8.9",
|
||||
"electron": "^44.3.0",
|
||||
"electron-builder": "^26.15.3",
|
||||
"electron-vite": "6.0.0-beta.1",
|
||||
"hls.js": "^1.7.3",
|
||||
"html-entities": "^2.6.0",
|
||||
"i18next": "^26.4.2",
|
||||
"jsdom": "^30.0.1",
|
||||
"lucide-react": "^1.46.0",
|
||||
"proxy-agent": "6.5.0",
|
||||
"qrcode": "^1.5.4",
|
||||
"react": "^19.3.0",
|
||||
"react-dom": "^19.3.0",
|
||||
@@ -69,29 +84,14 @@
|
||||
"react-i18next": "^17.0.14",
|
||||
"shadcn": "^4.21.0",
|
||||
"sonner": "^2.0.8",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"wavesurfer.js": "^7.12.12",
|
||||
"word-extractor": "1.0.4",
|
||||
"zustand": "^5.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"@testing-library/jest-dom": "^7.0.1",
|
||||
"@testing-library/react": "^16.3.3",
|
||||
"@types/node": "^24.13.4",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@vitejs/plugin-react": "^6.1.1",
|
||||
"builder-util": "26.15.3",
|
||||
"electron": "^44.3.0",
|
||||
"electron-builder": "^26.15.3",
|
||||
"electron-vite": "6.0.0-beta.1",
|
||||
"jsdom": "^30.0.1",
|
||||
"tailwindcss": "^4.3.3",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"typescript": "^7.0.2",
|
||||
"vite": "^8.3.0",
|
||||
"vite-plus": "^1.5.0",
|
||||
"vitest": "5.1.0"
|
||||
"vitest": "5.1.0",
|
||||
"wavesurfer.js": "^7.12.12",
|
||||
"zustand": "^5.0.15"
|
||||
},
|
||||
"trustedDependencies": [
|
||||
"electron",
|
||||
|
||||
@@ -365,7 +365,7 @@
|
||||
pkgs.nodejs_22
|
||||
];
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-bqxnoXhbM2HK+xW+pBOy71WjSuAhsbjbr429b+uT6WU=";
|
||||
outputHash = "sha256-wyyCEEMFBR82IvoPeTH4IpdDR8EjmZ6QgXMVjVQBK2g=";
|
||||
sourceProvenance = null;
|
||||
} ''
|
||||
export HOME=$TMPDIR
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
"""The Python CI shards partition tests/ exactly: every test runs in one shard."""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def _collect(shard: str | None) -> set[str]:
|
||||
env = {**os.environ}
|
||||
env.pop("VOICESTUDIO_TEST_SHARD", None)
|
||||
if shard:
|
||||
env["VOICESTUDIO_TEST_SHARD"] = shard
|
||||
out = subprocess.run(
|
||||
[sys.executable, "-m", "pytest", "tests/test_ci_pass_cache.py", "tests/test_ci_pytest_parallel.py",
|
||||
"--collect-only", "-q", "-p", "no:xdist", "-p", "no:cacheprovider"],
|
||||
cwd=ROOT, env=env, capture_output=True, text=True, check=True,
|
||||
).stdout
|
||||
return {line for line in out.splitlines() if "::" in line}
|
||||
|
||||
|
||||
def test_shards_are_a_disjoint_cover_of_the_full_collection():
|
||||
full = _collect(None)
|
||||
first, second = _collect("1/2"), _collect("2/2")
|
||||
assert first and second
|
||||
assert not first & second
|
||||
assert first | second == full
|
||||
|
||||
|
||||
def test_workflow_shard_count_matches_the_matrix():
|
||||
job = yaml.safe_load((ROOT / ".github/workflows/ci.yml").read_text(encoding="utf-8"))["jobs"]["test-python"]
|
||||
shards = job["strategy"]["matrix"]["shard"]
|
||||
assert sorted(shards) == list(range(1, len(shards) + 1))
|
||||
pytest_step = next(s for s in job["steps"] if "pytest tests/" in s.get("run", ""))
|
||||
assert pytest_step["env"]["VOICESTUDIO_TEST_SHARD"] == "${{ matrix.shard }}/" + str(len(shards))
|
||||
# the serial backend session must run in exactly one shard
|
||||
backend = next(s for s in job["steps"] if "pytest backend/tests/" in s.get("run", ""))
|
||||
assert re.search(r"matrix\.shard == \d", backend["if"])
|
||||
|
||||
|
||||
def test_a_nested_pytest_run_does_not_inherit_the_shard(tmp_path, monkeypatch):
|
||||
probe = tmp_path / "test_probe.py"
|
||||
probe.write_text("def test_ok():\n pass\n")
|
||||
monkeypatch.setenv("VOICESTUDIO_TEST_SHARD", "2/2")
|
||||
# Sharding consumes the variable at collection, so a child started later
|
||||
# by a test in this session collects everything. Emulate that session.
|
||||
import importlib.util
|
||||
|
||||
spec = importlib.util.spec_from_file_location("root_conftest_for_shard", ROOT / "conftest.py")
|
||||
root_conftest = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(root_conftest)
|
||||
|
||||
class _Cfg:
|
||||
class hook:
|
||||
@staticmethod
|
||||
def pytest_deselected(items):
|
||||
pass
|
||||
|
||||
root_conftest.pytest_collection_modifyitems(_Cfg, [])
|
||||
assert "VOICESTUDIO_TEST_SHARD" not in os.environ
|
||||
out = subprocess.run([sys.executable, "-m", "pytest", str(probe), "-q", "-p", "no:cacheprovider"],
|
||||
cwd=tmp_path, capture_output=True, text=True)
|
||||
assert out.returncode == 0, out.stdout
|
||||
@@ -13,9 +13,9 @@ ROOT = Path(__file__).resolve().parents[1]
|
||||
@pytest.mark.parametrize('flavor,empty,success', [('cuda', False, True), ('rocm', False, True), ('cuda', True, False)])
|
||||
def test_compat_install_is_isolated_and_cuda_only(tmp_path, flavor, empty, success, machine='x86_64'):
|
||||
dockerfile = (ROOT / 'deploy/Dockerfile').read_text(encoding="utf-8")
|
||||
match = re.search(r'RUN if \[ "\$GPU_FLAVOR" = "cuda" \] && \[ "\$\(uname -m\)" != "aarch64" \]; then \\\n.*? fi', dockerfile, re.S)
|
||||
match = re.search(r'RUN (?:--mount=\S+ \\\n )?if \[ "\$GPU_FLAVOR" = "cuda" \] && \[ "\$\(uname -m\)" != "aarch64" \]; then \\\n.*? fi', dockerfile, re.S)
|
||||
assert match, 'CUDA compatibility install is absent'
|
||||
script = match[0].removeprefix('RUN ').replace('\\\n', '')
|
||||
script = re.sub(r'^RUN (--mount=\S+ \\\n )?', '', match[0]).replace('\\\n', '')
|
||||
bindir = tmp_path / 'bin'
|
||||
bindir.mkdir()
|
||||
prefix = tmp_path / 'runtime'
|
||||
@@ -46,8 +46,8 @@ if not {empty!r}: (root/'nvidia/cudnn/lib/libcudnn_ops_infer.so.8').touch()
|
||||
def test_compat_install_is_skipped_on_aarch64(tmp_path):
|
||||
"""#2831: no aarch64 cuDNN 8 wheel exists, so a CUDA arm64 build must not fail on it."""
|
||||
dockerfile = (ROOT / 'deploy/Dockerfile').read_text(encoding="utf-8")
|
||||
match = re.search(r'RUN if \[ "\$GPU_FLAVOR" = "cuda" \] && \[ "\$\(uname -m\)" != "aarch64" \]; then \\\n.*? fi', dockerfile, re.S)
|
||||
script = match[0].removeprefix('RUN ').replace('\\\n', '')
|
||||
match = re.search(r'RUN (?:--mount=\S+ \\\n )?if \[ "\$GPU_FLAVOR" = "cuda" \] && \[ "\$\(uname -m\)" != "aarch64" \]; then \\\n.*? fi', dockerfile, re.S)
|
||||
script = re.sub(r'^RUN (--mount=\S+ \\\n )?', '', match[0]).replace('\\\n', '')
|
||||
bindir = tmp_path / 'bin'
|
||||
bindir.mkdir()
|
||||
(bindir / 'uname').write_text('#!/bin/sh\necho aarch64\n')
|
||||
|
||||
@@ -97,7 +97,7 @@ def test_image_builds_keep_their_layer_cache_in_ghcr_not_the_actions_cache():
|
||||
"""The Actions cache is capped at 10 GB per repository. Docker layers (5+ GB, one of
|
||||
4 GB) filled it and evicted the iOS native-runtime, Gradle and bun caches, so mobile CI
|
||||
rebuilt for 17 minutes. The cache lives in a registry package instead; a failed export
|
||||
must never fail the image publish, and only the CUDA job writes it."""
|
||||
must never fail the image publish, and each job writes only its own cache ref."""
|
||||
workflow = _load(_DOCKER)
|
||||
assert workflow["env"]["REGISTRY"] == "ghcr.io"
|
||||
builds = [
|
||||
@@ -112,7 +112,12 @@ def test_image_builds_keep_their_layer_cache_in_ghcr_not_the_actions_cache():
|
||||
assert options["cache-from"].startswith("type=registry,ref=${{ env.BUILDCACHE_IMAGE }}")
|
||||
cuda, rocm, arm64 = builds
|
||||
assert "ignore-error=true" in cuda["cache-to"] and "mode=max" in cuda["cache-to"]
|
||||
assert "cache-to" not in rocm
|
||||
# ROCm reads its own cache first, then the CUDA one (shared frontend stage), and
|
||||
# writes a separate ref so its runtime layers never overwrite the CUDA cache.
|
||||
assert rocm["cache-from"].splitlines()[0].endswith(":buildkit-rocm")
|
||||
assert rocm["cache-from"].splitlines()[1].endswith(":buildkit")
|
||||
assert ":buildkit-rocm," in rocm["cache-to"] and "ignore-error=true" in rocm["cache-to"]
|
||||
assert ":buildkit," in cuda["cache-to"]
|
||||
# arm64 layers are useless to the amd64 jobs, so the arm64 job keeps its own
|
||||
# cache tag and never writes the CUDA job's.
|
||||
assert arm64["cache-from"].endswith(":buildkit-cuda-arm64")
|
||||
|
||||
@@ -99,7 +99,7 @@ def test_the_pins_carry_no_local_version(file_constraints):
|
||||
|
||||
def test_the_dockerfile_passes_the_constraint():
|
||||
text = _DOCKERFILE.read_text(encoding="utf-8")
|
||||
install_start = text.index("RUN uv pip install")
|
||||
install_start = text.index("RUN --mount=type=cache,target=/root/.cache/uv,sharing=locked \\\n uv pip install")
|
||||
install_end = text.index("\n\n", install_start)
|
||||
install = text[install_start:install_end]
|
||||
assert "--constraint" in install and "torch-constraints.txt" in install, (
|
||||
@@ -112,7 +112,7 @@ def test_docker_install_and_runtime_use_the_guarded_python():
|
||||
"""#1274: ROCm's `python3` had HIP torch, while `--system` installed and
|
||||
bare `uvicorn` launched through `/usr/bin/python` with CUDA torch."""
|
||||
text = _DOCKERFILE.read_text(encoding="utf-8")
|
||||
install_start = text.index("RUN uv pip install")
|
||||
install_start = text.index("RUN --mount=type=cache,target=/root/.cache/uv,sharing=locked \\\n uv pip install")
|
||||
install_end = text.index("\n\n", install_start)
|
||||
install = text[install_start:install_end]
|
||||
assert '--python "$(command -v python3)"' in install
|
||||
@@ -216,7 +216,7 @@ def test_the_overrides_file_matches_pyproject():
|
||||
|
||||
def test_the_dockerfile_passes_copies_and_checks_the_overrides():
|
||||
text = _DOCKERFILE.read_text(encoding="utf-8")
|
||||
install_start = text.index("RUN uv pip install")
|
||||
install_start = text.index("RUN --mount=type=cache,target=/root/.cache/uv,sharing=locked \\\n uv pip install")
|
||||
install = text[install_start:text.index("\n\n", install_start)]
|
||||
assert "--override deploy/uv-overrides.txt" in install, install
|
||||
assert re.search(r"^COPY .*uv-overrides\.txt", text, re.MULTILINE)
|
||||
@@ -302,11 +302,11 @@ def _security_floors_module():
|
||||
|
||||
def test_the_dockerfile_raises_and_checks_the_security_floors():
|
||||
text = _DOCKERFILE.read_text(encoding="utf-8")
|
||||
install_start = text.index("RUN uv pip install")
|
||||
install_start = text.index("RUN --mount=type=cache,target=/root/.cache/uv,sharing=locked \\\n uv pip install")
|
||||
install = text[install_start:text.index("\n\n", install_start)]
|
||||
assert "--constraint deploy/security-constraints.txt" in install, install
|
||||
assert re.search(r"^COPY .*security-constraints\.txt.*security_floors\.py", text, re.MULTILINE)
|
||||
floors = text[text.index('RUN floors="$(python3 deploy/security_floors.py requirements)"'):]
|
||||
floors = text[text.index('RUN --mount=type=cache,target=/root/.cache/uv,sharing=locked \\\n floors="$(python3 deploy/security_floors.py requirements)"'):]
|
||||
floors = floors[:floors.index("\n\n")]
|
||||
# Upgrades what the main install left below its floor, then fails the build on any.
|
||||
assert "uv pip install" in floors and "$floors" in floors
|
||||
|
||||
Reference in new issue
Block a user