Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions .github/ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ RUN set -eux; \
| xargs -0 sha256sum \
> payload.sha256

FROM ubuntu:24.04@sha256:1e0a86e57d247923571b75e0aaf48a1449cf8c543d51fb3e07a4a7d7bfa79316 AS music-core-builder
FROM ubuntu:24.04@sha256:1e0a86e57d247923571b75e0aaf48a1449cf8c543d51fb3e07a4a7d7bfa79316 AS music-core-tools

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

Expand Down Expand Up @@ -103,15 +103,50 @@ COPY .github/ci/ .github/ci/
COPY packages/music-core/ packages/music-core/
COPY packaging/soxr/ packaging/soxr/
COPY scripts/ scripts/
COPY .python-version .python-version

RUN node scripts/ci-image-impact.mjs --manifest > /tmp/producer-inputs.sha256

FROM music-core-tools AS music-core-builder
RUN node scripts/build-music-core.mjs --target wasm --summary \
&& node packages/music-core/test/artifact-metadata.mjs \
&& node packages/music-core/test/wasm-boundary.mjs \
&& node packages/music-core/test/runtime-parity.mjs \
&& node scripts/ci-music-core.mjs stage /opt/tuneforge-ci/music-core

FROM ubuntu:24.04@sha256:1e0a86e57d247923571b75e0aaf48a1449cf8c543d51fb3e07a4a7d7bfa79316
FROM music-core-tools AS cross-runtime-builder

RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends clang-18; \
rm -rf /var/lib/apt/lists/*; \
runtime=/opt/tuneforge-ci/cross-runtime; \
deps=.github/ci/cross-runtime-requirements.txt; \
test "$MUSIC_PYTHON_VERSION" = "$(cat .python-version)"; \
mkdir -p "$runtime"; \
cp -a /opt/music-tools/python "$runtime/python"; \
rm -rf "$runtime/python/lib/python3.14/ensurepip"; \
uv venv --no-cache --python "$runtime/python/bin/python3.14" "$runtime/venv"; \
uv pip install --no-cache --python "$runtime/venv/bin/python" \
--require-hashes --only-binary :all: -r "$deps"; \
CC=/usr/bin/clang-18 CXX=/usr/bin/clang++-18 node scripts/build-music-core.mjs --target python --python 3.14 --summary; \
node scripts/build-music-core.mjs --target python --python 3.14 --check > "$runtime/music-core.json"; \
wheel="$(node -p "require('$runtime/music-core.json').files[0].path")"; \
uv pip install --offline --no-cache --no-index --no-deps --python "$runtime/venv/bin/python" \
"packages/music-core/build/artifacts/python/cp314/$wheel"; \
uv pip check --offline --no-cache --python "$runtime/venv/bin/python"; \
uv pip freeze --offline --no-cache --python "$runtime/venv/bin/python" --exclude tuneforge-music-core > "$runtime/packages.txt"; \
if grep -Ei '^(torch|(openai-)?whisper|demucs[^=]*|onnxruntime[^=]*|beat-this|tensorflow[^=]*|nvidia-[^=]*)==' "$runtime/packages.txt"; then exit 1; fi; \
"$runtime/venv/bin/python" -IB -c 'import librosa, soundfile; from tuneforge_music_core import _native'; \
printf '%s\n' "$MUSIC_PYTHON_VERSION" "$MUSIC_PYTHON_URL" "$MUSIC_PYTHON_SHA256" > "$runtime/python-source.txt"; \
{ /usr/bin/clang-18 --version; /usr/bin/clang++-18 --version; uv --version; } > "$runtime/build-tools.txt"; \
cp "$deps" "$runtime/requirements.txt"; \
cp -a packages/music-core/LICENSE "$runtime/music-core-LICENSE"; \
cp -a packages/music-core/licenses "$runtime/music-core-notices"; \
cd "$runtime"; \
find . -type f ! -name payload.sha256 -print0 | LC_ALL=C sort -z | xargs -0 sha256sum > payload.sha256

FROM ubuntu:24.04@sha256:1e0a86e57d247923571b75e0aaf48a1449cf8c543d51fb3e07a4a7d7bfa79316 AS shared-base

ARG FFMPEG_VERSION=7:6.1.1-3ubuntu5
ARG FFMPEG_DEB_URL=https://archive.ubuntu.com/ubuntu/pool/universe/f/ffmpeg/ffmpeg_6.1.1-3ubuntu5_amd64.deb
Expand Down Expand Up @@ -242,3 +277,6 @@ RUN set -eux; \
rm -rf /var/lib/apt/lists/*

COPY .github/ci/README.md /usr/share/doc/tuneforge-ci/README.md

FROM shared-base AS shared-final
COPY --from=cross-runtime-builder /opt/tuneforge-ci/cross-runtime /opt/tuneforge-ci/cross-runtime
2 changes: 2 additions & 0 deletions .github/ci/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
!.github/ci/Dockerfile
!.github/ci/Dockerfile.dockerignore
!.github/ci/README.md
!.github/ci/cross-runtime-requirements.txt
!.github/ci/image-inputs.json
!.python-version
!packages/music-core/CMakeLists.txt
!packages/music-core/LICENSE
!packages/music-core/bindings/python/native.cpp
Expand Down
33 changes: 33 additions & 0 deletions .github/ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ manifest digest and Docker config image ID retain their distinct meanings.
selected-image consumers verify its integrity and notices. CI script-tests check generated
contracts and metadata. Native ABI, Python 3.14/3.11 wheel and Rust transport checks remain
local validation in this producer change. Existing applications do not consume it yet.
- Cross-runtime fixture pilot: a separate layer at `/opt/tuneforge-ci/cross-runtime`
contains the checksum-pinned CPython 3.14.7 archive's runtime, a wheel-only test
environment, and the native music-core Python binding built from this recipe's
current source snapshot. The package subset comes from
`apps/backend/uv.lock`; CI checks the projection whenever script tests run.
The layer keeps distribution license files, resolved package versions, upstream
Python source pins, the verified music-core wheel manifest and notices, and a
payload checksum manifest. The environment excludes inference runtimes, model
weights, installer caches, and the backend checkout.
- CI utilities: only tools needed by setup actions and native builds. No
repository checkout, dependency directory, model, user data, or credential is
included; SoXR corresponding sources are the documented exception.
Expand Down Expand Up @@ -161,6 +170,30 @@ the same run, verify metadata and bytes, and bind Docker's loaded config ID to t
metadata. A config image ID is distinct from the registry manifest digest. Missing
or expired rerun artifacts, selector failures and identity failures fail closed.

The cross-runtime job runs alongside the ordinary backend and Tauri jobs when
CI selects a candidate. It restores the same image-keyed Cargo cache as
`desktop_tauri`, which remains the only writer. Both Rust jobs disable uv
dependency caching. The pilot leaves the promoted digest unchanged. Routine
scope-based runs require trusted main publication, verified digest promotion,
and explicit activation in the promotion PR.

For a lock change, regenerate the committed projection with the pinned uv
0.13.6 and review the changed requirements and wheel hashes:

```sh
uv export --offline --locked --project apps/backend --no-header --no-annotate \
--only-group cross-runtime > .github/ci/cross-runtime-requirements.txt
```

Compare the shared image with a separately transferred payload on the same
Linux AMD64 engine using `bash scripts/qualify-ci-cross-runtime.sh`.
It builds `shared-final` and its payload-free `shared-base`, compares gzip
archive sizes and local build/load times, and validates and times a separate
payload archive mounted into `shared-base`. These are Docker-archive and local
setup measurements. For a promotion decision, measure real candidate artifact
transfer separately from registry layer bytes and pull, and compare hosted
job wall times, Cargo cache hit/miss, and restore time.

All three consumers run on the host with the same
[Docker helper](../../scripts/ci-image-run.sh) as their absolute custom shell.
Actions, caches and artifact uploads remain on the host; installs, strict image
Expand Down
Loading
Loading