name: Linux on: push: branches: [main] tags: ['v*'] pull_request: workflow_dispatch: inputs: keyless_gpu: description: Run synthetic Keyless CUDA tests on the private GPU runner type: boolean default: false hosted_cuda_package: description: Build actual CUDA package on isolated hosted CPU (no GPU, private artifact) type: boolean default: false permissions: contents: read jobs: verify: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # The configured Gitea ubuntu-latest label runs a root node:24-bookworm job container; # sudo is not installed there, so install packages directly. - name: Install build tools run: apt-get update && apt-get install -y ca-certificates curl cmake ninja-build g++ python3-numpy - name: Install pinned Rust run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain none echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" export PATH="$HOME/.cargo/bin:$PATH" rustup toolchain install 1.99.0 --profile minimal --component rustfmt --component clippy - name: Local checks run: scripts/check-local.sh keyless-cuda: if: github.event_name == 'workflow_dispatch' && github.event.inputs.keyless_gpu == 'true' needs: verify runs-on: [self-hosted, linux, x64, strata-gpu] steps: - uses: actions/checkout@v4 - name: Query-routing, streaming and snapshot GPU tests run: scripts/check-keyless-gpu.sh - name: Bounded KAR expert component GPU tests run: scripts/check-kar-expert-gpu.sh hosted-cuda-package: if: github.event_name == 'workflow_dispatch' && inputs.hosted_cuda_package && github.event.repository.private needs: verify runs-on: ubuntu-latest timeout-minutes: 150 permissions: contents: write env: CUDA_VISIBLE_DEVICES: '' BUILD_JOBS: '1' CARGO_BUILD_JOBS: '2' CUDA_ARCHITECTURES: '120' steps: - uses: actions/checkout@v4 - name: Install Docker and package tools (no drivers) run: | echo "CUDACXX=$RUNNER_TEMP/strata-cuda-toolkit/bin/nvcc" >> "$GITHUB_ENV" echo "CUDAToolkit_ROOT=$RUNNER_TEMP/strata-cuda-toolkit" >> "$GITHUB_ENV" echo "STRATA_BUILD_DIR=$RUNNER_TEMP/strata-hosted-cuda-engine" >> "$GITHUB_ENV" apt-get update && apt-get install -y ca-certificates curl docker.io gh musl-tools binutils python3-numpy - name: Assemble pinned build-only CUDA components run: python3 scripts/bootstrap-cuda-toolkit.py --output "$CUDAToolkit_ROOT" - name: Record actual toolchain run: | df -h "$RUNNER_TEMP" free -h python3 - <<'PYTOOL' import json, os, platform, subprocess from pathlib import Path info=json.loads((Path(os.environ['CUDAToolkit_ROOT'])/'TOOLKIT-PROVENANCE.json').read_text()) info.update(source=os.environ['GITHUB_SHA'], runner_os=platform.platform(), cuda_architectures=os.environ['CUDA_ARCHITECTURES'], driver_tested=False, model_tested=False) (Path(os.environ['RUNNER_TEMP'])/'CUDA-TOOLCHAIN.json').write_text(json.dumps(info,indent=2)+'\n') PYTOOL - name: Compile and audit actual CUDA engine in CPU-only Docker run: | python3 scripts/build-cuda-engine-in-docker.py \ --toolkit "$CUDAToolkit_ROOT" \ --build-dir "$RUNNER_TEMP/strata-hosted-cuda-build" \ --output "$STRATA_BUILD_DIR/strata" \ --metadata "$RUNNER_TEMP/strata-hosted-cuda-metadata/CUDA-BUILDER.json" \ --image-tag "${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" - name: Install pinned Rust and musl target run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain none echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" export PATH="$HOME/.cargo/bin:$PATH" rustup toolchain install 1.99.0 --profile minimal rustup target add --toolchain 1.99.0 x86_64-unknown-linux-musl - name: Assemble actual combined executable and runtime image run: | # Keep resource evidence even if the hosted runner terminates this job. (while sleep 20; do date -u free -m df -m "$RUNNER_TEMP" test ! -r /sys/fs/cgroup/memory.events || cat /sys/fs/cgroup/memory.events done) & resource_sampler=$! trap 'kill "$resource_sampler" 2>/dev/null || true; wait "$resource_sampler" 2>/dev/null || true' EXIT engine="$STRATA_BUILD_DIR/strata" package="$RUNNER_TEMP/strata-hosted-cuda-package" /usr/bin/time -v python3 scripts/build-linux-package.py --engine "$engine" \ --sha256 "$(sha256sum "$engine" | cut -d ' ' -f 1)" --revision "$GITHUB_SHA" \ --cargo-target-dir "$RUNNER_TEMP/strata-hosted-package-build" --output "$package" python3 scripts/build-runtime-image.py --package "$package" \ --receipt-sha256 "$(sha256sum "$package/SHA256SUMS" | cut -d ' ' -f 1)" \ > "$RUNNER_TEMP/strata-hosted-image.json" image="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["image"])' "$RUNNER_TEMP/strata-hosted-image.json")" docker save --output "$package/runtime-image.tar" "$image" cp "$RUNNER_TEMP/strata-hosted-image.json" "$package/IMAGE-PROVENANCE.json" python3 - "$RUNNER_TEMP/CUDA-TOOLCHAIN.json" "$RUNNER_TEMP/strata-hosted-cuda-metadata/CUDA-BUILDER.json" "$package/CUDA-TOOLCHAIN.json" <<'PYTOOL' import json, sys from pathlib import Path bootstrap=json.loads(Path(sys.argv[1]).read_text()) builder=json.loads(Path(sys.argv[2]).read_text()) bootstrap['docker_builder']=builder Path(sys.argv[3]).write_text(json.dumps(bootstrap,indent=2)+'\n') PYTOOL tar -C "$CUDAToolkit_ROOT" -cf "$package/CUDA-LICENSES.tar" licenses (cd "$package" && sha256sum runtime-image.tar IMAGE-PROVENANCE.json CUDA-TOOLCHAIN.json CUDA-LICENSES.tar > IMAGE-SHA256SUMS) - name: Publish private CUDA preview release env: GH_TOKEN: ${{ github.token }} run: | export GH_HOST="${GITHUB_SERVER_URL#https://}" export GH_HOST="${GH_HOST#http://}" tag="cuda-preview-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" gh release create "$tag" "$RUNNER_TEMP/strata-hosted-cuda-package/"* \ --target "$GITHUB_SHA" --repo "$GITHUB_REPOSITORY" \ --title "CUDA build preview ${GITHUB_RUN_ID}.${GITHUB_RUN_ATTEMPT}" \ --notes 'Actual CUDA compilation and packaging from this commit. Built in a GPU-hidden Docker container. This is not driver, inference, model-quality or performance qualification.' \ --prerelease - name: Remove privately published package copy run: rm -rf -- "$RUNNER_TEMP/strata-hosted-cuda-package" - name: Remove owned intermediate image and build files if: always() run: | receipt="$RUNNER_TEMP/strata-hosted-image.json" if test -s "$receipt"; then image="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["image"])' "$receipt")" docker image rm "$image" || true fi builder_label="leleka.cuda-builder.run=${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" if command -v docker >/dev/null 2>&1; then docker ps -aq --filter "label=$builder_label" | xargs -r docker rm -f || true docker volume ls -q --filter "label=$builder_label" | xargs -r docker volume rm --force || true docker image ls -q --filter "label=$builder_label" | sort -u | xargs -r docker image rm || true fi rm -rf -- "$RUNNER_TEMP/strata-cuda-toolkit" "$RUNNER_TEMP/strata-hosted-cuda-engine" "$RUNNER_TEMP/strata-hosted-cuda-build" "$RUNNER_TEMP/strata-hosted-cuda-metadata" "$RUNNER_TEMP/strata-hosted-package-build" linux-static-cli: needs: verify runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install musl toolchain run: apt-get update && apt-get install -y ca-certificates curl docker.io musl-tools cmake binutils python3-numpy - name: Install pinned Rust and target run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain none echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" export PATH="$HOME/.cargo/bin:$PATH" rustup toolchain install 1.99.0 --profile minimal rustup target add --toolchain 1.99.0 x86_64-unknown-linux-musl - name: Build static CLI run: cargo build --manifest-path control-plane/Cargo.toml --locked --release --target x86_64-unknown-linux-musl --bin strata-next - name: Verify ELF and checksum run: | binary=target/x86_64-unknown-linux-musl/release/strata-next if readelf -l "$binary" | grep -q INTERP; then echo 'ELF has a dynamic interpreter' >&2 exit 1 fi if readelf -d "$binary" | grep -q NEEDED; then echo 'ELF has a dynamic library dependency' >&2 exit 1 fi "$binary" --version mkdir -p dist cp "$binary" dist/strata-next-linux-x86_64-musl { echo "Commit: $GITHUB_SHA" echo "Workflow: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" rustc --version cargo --version musl-gcc --version readelf --version } > dist/BUILD-PROVENANCE.txt { readelf -h "$binary" readelf -l "$binary" readelf -d "$binary" } > dist/ELF-AUDIT.txt cd dist sha256sum strata-next-linux-x86_64-musl BUILD-PROVENANCE.txt ELF-AUDIT.txt > SHA256SUMS - name: Static CLI model smoke run: python3 scripts/smoke-static-cli.py target/x86_64-unknown-linux-musl/release/strata-next - name: Engine loader probe before model acquisition run: python3 scripts/smoke-engine-probe.py target/x86_64-unknown-linux-musl/release/strata-next - name: Explicit GPU profile driver policy without GPU run: python3 scripts/smoke-gpu-requirement.py target/x86_64-unknown-linux-musl/release/strata-next - name: Declared GPU memory admission and child UUID pin without GPU run: python3 scripts/smoke-cuda-memory.py target/x86_64-unknown-linux-musl/release/strata-next - name: Atomic pinned assets before native serving run: python3 scripts/smoke-asset-bootstrap.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native GGUF pack preparation against upstream oracle run: python3 scripts/smoke-native-pack.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native fetch prepare serve and verified offline reuse run: python3 scripts/smoke-native-bootstrap.py target/x86_64-unknown-linux-musl/release/strata-next - name: Pinned MTP structural preflight and native bootstrap run: python3 scripts/smoke-mtp-pack.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native runtime profile metadata admission run: python3 scripts/smoke-runtime-profile.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native systemd unit and lifecycle tests in isolated container run: | image="leleka-systemd-smoke:${GITHUB_RUN_ID}" container="leleka-systemd-smoke-${GITHUB_RUN_ID}" cleanup() { docker rm --force "$container" >/dev/null 2>&1 || true docker image rm "$image" >/dev/null 2>&1 || true } trap cleanup EXIT docker build --file deploy/Dockerfile.systemd-smoke --tag "$image" . docker run --detach --privileged --cgroupns=private --name "$container" \ --tmpfs /run --tmpfs /run/lock \ --stop-signal SIGRTMIN+3 "$image" for attempt in $(seq 1 30); do if docker exec "$container" systemctl show-environment >/dev/null 2>&1; then break; fi test "$attempt" -lt 30 || { docker logs "$container"; exit 1; } sleep 1 done uid=1000 docker exec "$container" systemctl start "user@$uid.service" for attempt in $(seq 1 30); do if docker exec "$container" test -S "/run/user/$uid/bus"; then break; fi test "$attempt" -lt 30 || { docker logs "$container"; exit 1; } sleep 1 done docker cp target/x86_64-unknown-linux-musl/release/strata-next "$container:/tmp/strata-next" docker cp scripts/smoke-service-unit.py "$container:/tmp/smoke-service-unit.py" docker cp scripts/smoke-native-switch.py "$container:/tmp/smoke-native-switch.py" docker cp scripts/smoke-worker-cancel.py "$container:/tmp/smoke-worker-cancel.py" docker exec --user "$uid" \ --env HOME=/home/leleka \ --env XDG_RUNTIME_DIR="/run/user/$uid" \ --env DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" \ "$container" python3 /tmp/smoke-service-unit.py /tmp/strata-next docker exec --user "$uid" \ --env HOME=/home/leleka \ --env XDG_RUNTIME_DIR="/run/user/$uid" \ --env DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" \ "$container" python3 /tmp/smoke-service-unit.py /tmp/strata-next --lifecycle docker exec --user "$uid" \ --env HOME=/home/leleka \ --env XDG_RUNTIME_DIR="/run/user/$uid" \ --env DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" \ "$container" python3 /tmp/smoke-native-switch.py /tmp/strata-next - name: Native deployment configuration without worker launch run: python3 scripts/smoke-config-check.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native deployment readiness deadline without GPU run: python3 scripts/smoke-wait-ready.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native API authentication without GPU run: python3 scripts/smoke-native-auth.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native custom text and regex tools without GPU run: python3 scripts/smoke-custom-tools.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native auto/none/required/forced tool policy without GPU run: python3 scripts/smoke-tool-policy.py target/x86_64-unknown-linux-musl/release/strata-next - name: Live Responses replay and corrupt SSE evidence without GPU run: PYTHONDONTWRITEBYTECODE=1 python3 scripts/test-live-responses-replay.py target/x86_64-unknown-linux-musl/release/strata-next - name: Input token count exact GEN wire parity without inference run: python3 scripts/smoke-input-tokens.py target/x86_64-unknown-linux-musl/release/strata-next - name: Chat Completions live protocol and wire parity run: python3 scripts/smoke-chat-completions.py target/x86_64-unknown-linux-musl/release/strata-next - name: Messages named SSE and tool protocol without GPU run: python3 scripts/smoke-messages.py target/x86_64-unknown-linux-musl/release/strata-next - name: SSE idle keep-alive, terminal parity and disconnect without GPU run: PYTHONDONTWRITEBYTECODE=1 python3 scripts/smoke-sse-keepalive.py target/x86_64-unknown-linux-musl/release/strata-next - name: Stored Responses retrieval and deletion without GPU run: python3 scripts/smoke-response-history.py target/x86_64-unknown-linux-musl/release/strata-next - name: Durable Responses restart and disk failure gate run: python3 scripts/smoke-response-history.py target/x86_64-unknown-linux-musl/release/strata-next --durable - name: Native drain and resume without GPU run: python3 scripts/smoke-native-drain.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native signal shutdown grace without GPU run: python3 scripts/smoke-signal-drain.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native generation deadline and recovery without GPU run: python3 scripts/smoke-generation-deadline.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native queue deadline without expiring active work run: python3 scripts/smoke-queue-deadline.py target/x86_64-unknown-linux-musl/release/strata-next - name: Static CLI HTTP cancellation failure isolation run: python3 scripts/smoke-worker-cancel.py target/x86_64-unknown-linux-musl/release/strata-next - name: Static CLI HTTP crash recovery without request replay run: python3 scripts/smoke-worker-cancel.py target/x86_64-unknown-linux-musl/release/strata-next --restart - name: Embedded CPU worker packaging without GPU run: | musl-gcc -O2 -static scripts/fixtures/embedded-worker.c -o "$RUNNER_TEMP/embedded-worker" python3 scripts/build-linux-package.py --cpu-fixture --engine "$RUNNER_TEMP/embedded-worker" \ --sha256 "$(sha256sum "$RUNNER_TEMP/embedded-worker" | cut -d ' ' -f 1)" --revision "$GITHUB_SHA" \ --cargo-target-dir control-plane/target --output "$RUNNER_TEMP/combined-fixture" cd "$RUNNER_TEMP/combined-fixture" sha256sum -c SHA256SUMS cd "$GITHUB_WORKSPACE" python3 scripts/smoke-embedded-engine.py "$RUNNER_TEMP/combined-fixture/strata-next-linux-x86_64-musl" "$RUNNER_TEMP/embedded-worker" python3 scripts/smoke-controller-deployment.py "$RUNNER_TEMP/combined-fixture/strata-next-linux-x86_64-musl" python3 scripts/build-runtime-image.py --cpu-fixture --package "$RUNNER_TEMP/combined-fixture" \ --receipt-sha256 "$(sha256sum "$RUNNER_TEMP/combined-fixture/SHA256SUMS" | cut -d ' ' -f 1)" \ > "$RUNNER_TEMP/combined-image.json" python3 scripts/smoke-runtime-image.py "$RUNNER_TEMP/combined-image.json" rm "$RUNNER_TEMP/embedded-worker" - name: Remove owned CPU fixture image if: always() run: | receipt="$RUNNER_TEMP/combined-image.json" if test -s "$receipt"; then image="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["image"])' "$receipt")" docker image rm "$image" rm "$receipt" fi linux-cli-container: needs: verify runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install the Docker CLI run: command -v docker >/dev/null 2>&1 || { apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker.io >/dev/null; } - name: Build actual CLI-only scratch image run: docker build --file deploy/Dockerfile.static-cli --tag strata-cli-check . - name: Check isolated CLI container startup and shutdown run: python3 scripts/smoke-cli-container.py strata-cli-check - name: Remove test image if: always() run: docker image rm strata-cli-check || true release-cli: if: startsWith(github.ref, 'refs/tags/v') needs: [linux-static-cli, linux-cli-container] runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 - name: Install release build tools run: apt-get update && apt-get install -y ca-certificates curl gh musl-tools cmake binutils python3-numpy - name: Install pinned Rust and target run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain none echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" export PATH="$HOME/.cargo/bin:$PATH" rustup toolchain install 1.99.0 --profile minimal rustup target add --toolchain 1.99.0 x86_64-unknown-linux-musl - name: Rebuild release CLI assets on the tag commit run: | cargo build --manifest-path control-plane/Cargo.toml --locked --release --target x86_64-unknown-linux-musl --bin strata-next binary=target/x86_64-unknown-linux-musl/release/strata-next if readelf -l "$binary" | grep -q INTERP; then echo 'ELF has a dynamic interpreter' >&2 exit 1 fi if readelf -d "$binary" | grep -q NEEDED; then echo 'ELF has a dynamic library dependency' >&2 exit 1 fi "$binary" --version mkdir -p dist cp "$binary" dist/strata-next-linux-x86_64-musl { echo "Commit: $GITHUB_SHA" echo "Workflow: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" rustc --version cargo --version musl-gcc --version readelf --version } > dist/BUILD-PROVENANCE.txt { readelf -h "$binary" readelf -l "$binary" readelf -d "$binary" } > dist/ELF-AUDIT.txt (cd dist && sha256sum strata-next-linux-x86_64-musl BUILD-PROVENANCE.txt ELF-AUDIT.txt > SHA256SUMS) - name: Publish CLI preview release env: GH_TOKEN: ${{ github.token }} run: | export GH_HOST="${GITHUB_SERVER_URL#https://}" export GH_HOST="${GH_HOST#http://}" gh release create "${GITHUB_REF_NAME}" dist/strata-next-linux-x86_64-musl dist/SHA256SUMS dist/BUILD-PROVENANCE.txt dist/ELF-AUDIT.txt \ --repo "${GITHUB_REPOSITORY}" --title "Strata Next ${GITHUB_REF_NAME}" \ --notes 'CLI/control-plane preview. CUDA engine and model files are not included.' --prerelease