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
17 changes: 17 additions & 0 deletions .github/workflows/lazurio-cli-archives.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ jobs:
platform: linux
arch: x64
rust_target: x86_64-unknown-linux-gnu
transcribe_native: linux-x64-cpu-vulkan
transcribe_library: libtranscribe.so
- key: darwin-arm64
runner: macos-15
platform: mac
arch: arm64
rust_target: aarch64-apple-darwin
transcribe_native: darwin-arm64-metal
transcribe_library: libtranscribe.dylib
env:
VERSION: ${{ inputs.version }}
steps:
Expand Down Expand Up @@ -155,6 +159,19 @@ jobs:
- name: Smoke-test CLI archive
run: node scripts/smoke-cli-archive.ts --archive "release-cli/t3-$VERSION-${{ matrix.key }}.tar.gz" --expect-version "$VERSION"

# Dictation's packages stay external to the bundle (scripts/lib/cli-external-packages.ts), so
# they must be staged beside it; without them dictation fails while the server still starts.
- name: Check the archive carries dictation's packages
shell: bash
run: |
set -euo pipefail
stem="t3-$VERSION-${{ matrix.key }}"
native="node_modules/@transcribe-cpp/${{ matrix.transcribe_native }}"
tar -tzf "release-cli/$stem.tar.gz" > "$RUNNER_TEMP/archive-files"
for file in node_modules/transcribe-cpp/package.json "$native/package.json" "$native/${{ matrix.transcribe_library }}"; do
grep -Fqx "$stem/$file" "$RUNNER_TEMP/archive-files" || { echo "::error::The archive has no $file"; exit 1; }
done

- name: Upload CLI archive
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
Expand Down
187 changes: 187 additions & 0 deletions .github/workflows/lazurio-dictation-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: Lazurio dictation check

# Rebuild decision A12: dictation is best-effort on Environments. For a published release, each
# platform's archive is checked against the release's SHA256SUMS and attestation and served three
# times: as published, without transcribe-cpp and without the platform's native library. Every
# time the server must answer and keep running; dictation must work only with both present.
# Runbook: docs/operations/lazurio-fork-release.md, stage 7. A change to this file runs it on the
# newest published release.

on:
workflow_dispatch:
inputs:
version:
description: Published release version (X.Y.Z-lazurio.N or X.Y.Z-preview.YYYYMMDD.N)
required: true
type: string
pull_request:
paths:
- .github/workflows/lazurio-dictation-check.yml

permissions:
contents: read
attestations: read
id-token: none

env:
# The catalog entry in apps/server/src/speech/catalog.json; the server checks the same hash.
MODEL_ID: handy-computer/whisper-tiny.en-gguf
MODEL_REVISION: becb8bcb804405dc97b380a523d9975888820986
MODEL_FILE: whisper-tiny.en-Q8_0.gguf
MODEL_SHA256: e8c9b73c06344307d8b346e07fbe93dd88d894627854bcff31523f1ce44394fa

jobs:
dictation:
name: Dictation ${{ matrix.key }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- key: linux-x64
runner: ubuntu-24.04
native: linux-x64-cpu-vulkan
- key: darwin-arm64
runner: macos-15
native: darwin-arm64-metal
env:
KEY: ${{ matrix.key }}
NATIVE: ${{ matrix.native }}
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
steps:
- name: Download and verify the published archive
shell: bash
env:
REQUESTED_VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
version="$REQUESTED_VERSION"
if [ -z "$version" ]; then
version="$(gh release list --repo "$REPO" --exclude-drafts --limit 1 --json tagName --jq '.[0].tagName')"
version="${version#v}"
fi
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+-(lazurio\.[0-9]+|preview\.[0-9]{8}\.[0-9]+)$ ]]
echo "VERSION=$version" >> "$GITHUB_ENV"
archive="t3-$version-$KEY.tar.gz"
mkdir -p "$RUNNER_TEMP/release"
cd "$RUNNER_TEMP/release"
gh release download "v$version" --repo "$REPO" --pattern "$archive" --pattern SHA256SUMS
awk -v file="$archive" '$2 == file' SHA256SUMS > expected
test "$(wc -l < expected)" -eq 1
shasum -a 256 -c expected
gh attestation verify "$archive" --repo "$REPO"
tar -xzf "$archive"
root="t3-$version-$KEY"
test "$("$root/t3" --version)" = "t3 v$version"
for file in node_modules/transcribe-cpp/package.json "node_modules/@transcribe-cpp/$NATIVE/package.json"; do
test -f "$root/$file" || { echo "::error::The archive has no $file"; exit 1; }
done

- name: Download the speech model
shell: bash
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/model"
curl --fail --location --silent --show-error --retry 3 \
--output "$RUNNER_TEMP/model/$MODEL_FILE" \
"https://huggingface.co/$MODEL_ID/resolve/$MODEL_REVISION/$MODEL_FILE"
echo "$MODEL_SHA256 $RUNNER_TEMP/model/$MODEL_FILE" | shasum -a 256 -c -

# The model is placed and selected beforehand so that prepare and transcribe reach the
# native module. A missing package or library must fail as an HTTP error, not a crash.
- name: Serve the archive with and without dictation
shell: bash
run: |
set -euo pipefail
root="$RUNNER_TEMP/release/t3-$VERSION-$KEY"
python3 -I -c '
import json, math, struct, sys
options = json.dumps({"speechLanguage": "auto", "speechTranslateToEnglish": False,
"speechCustomWords": [], "speechRemoveFillerWords": True,
"speechSilenceFiltering": False}).encode()
# Two seconds of 16 kHz mono Float32 PCM: a quiet 440 Hz tone.
pcm = b"".join(struct.pack("<f", 0.2 * math.sin(2 * math.pi * 440 * i / 16000)) for i in range(32000))
sys.stdout.buffer.write(struct.pack("<I", len(options)) + options + pcm)
' > "$RUNNER_TEMP/speech.bin"

{
echo "### Dictation on the published $KEY archive of $VERSION"
echo
echo "| Case | \`/\` | voice status | prepare | transcribe ×2 | \`/\` after | Process after |"
echo "| --- | --- | --- | --- | --- | --- | --- |"
} >> "$GITHUB_STEP_SUMMARY"

failed=0
port=47811
for mode in normal no-transcribe-cpp no-native-library; do
work="$RUNNER_TEMP/case-$mode"
tree="$work/t3"
home="$work/home"
mkdir -p "$work"
cp -R "$root" "$tree"
case "$mode" in
no-transcribe-cpp) rm -rf "$tree/node_modules/transcribe-cpp" ;;
no-native-library) rm -rf "$tree/node_modules/@transcribe-cpp/$NATIVE" ;;
esac
mkdir -p "$home/userdata/speech/models"
cp "$RUNNER_TEMP/model/$MODEL_FILE" "$home/userdata/speech/models/"
printf '{"speechModelId":"%s"}\n' "$MODEL_ID" > "$home/userdata/settings.json"

HOME="$home" T3CODE_TELEMETRY_ENABLED=false \
"$tree/t3" serve --base-dir "$home" --host 127.0.0.1 --port "$port" --no-browser \
> "$work/server.log" 2>&1 &
pid=$!
origin="http://127.0.0.1:$port"
request() { curl --silent --max-time 120 --output "$work/$1.body" --write-out '%{http_code}' "${@:2}" || true; }
ready=0
for _ in $(seq 1 180); do
if [ "$(request ready "$origin/")" = 200 ]; then ready=1; break; fi
kill -0 "$pid" 2>/dev/null || break
sleep 0.5
done
if [ "$ready" != 1 ]; then
echo "::error::$mode: the server did not answer / with 200"
echo "| $mode | no answer | | | | | |" >> "$GITHUB_STEP_SUMMARY"
cat "$work/server.log"
kill "$pid" 2>/dev/null || true
failed=1
port=$((port + 1))
continue
fi
token="$(HOME="$home" "$tree/t3" auth session issue --base-dir "$home" --token-only --ttl 1h --label dictation-check)"
auth=(--header "authorization: Bearer $token")
pcm=(--header "content-type: application/octet-stream" --data-binary "@$RUNNER_TEMP/speech.bin")
root_before="$(request root "$origin/")"
voice="$(request voice "${auth[@]}" "$origin/api/voice/status")"
prepare="$(request prepare "${auth[@]}" --request POST "$origin/api/voice/models/prepare")"
first="$(request transcribe1 "${auth[@]}" "${pcm[@]}" "$origin/api/voice/transcribe")"
second="$(request transcribe2 "${auth[@]}" "${pcm[@]}" "$origin/api/voice/transcribe")"
root_after="$(request root-after "$origin/")"
if kill -0 "$pid" 2>/dev/null; then alive=running; else alive=exited; fi
echo "| $mode | $root_before | $voice | $prepare | $first, $second | $root_after | $alive |" >> "$GITHUB_STEP_SUMMARY"
echo "$mode: / $root_before, voice status $voice $(cat "$work/voice.body"), prepare $prepare, transcribe $first $second $(cat "$work/transcribe1.body"), / after $root_after, process $alive"

ok=1
for code in "$root_before" "$voice" "$root_after"; do [ "$code" = 200 ] || ok=0; done
[ "$alive" = running ] || ok=0
for code in "$prepare" "$first" "$second"; do
if [ "$mode" = normal ]; then
[ "$code" = 200 ] || ok=0
else
[[ "$code" =~ ^[45][0-9][0-9]$ ]] || ok=0
fi
done
if [ "$ok" != 1 ]; then
echo "::error::$mode: unexpected result"
cat "$work/server.log"
failed=1
else
grep -E 'ERR_MODULE_NOT_FOUND|native library' "$work/server.log" | head -n 2 || true
fi
kill "$pid" 2>/dev/null || true
wait "$pid" 2>/dev/null || true
port=$((port + 1))
done
exit "$failed"
36 changes: 36 additions & 0 deletions .github/workflows/lazurio-fork-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,42 @@ jobs:
docker run --rm --network none --entrypoint cat lazurio/t3code:ci \
/opt/lazurio-t3/dist/client/favicon.ico | cmp - assets/prod/t3-black-web-favicon.ico

# Dictation's native library is resolved the way transcribe-cpp resolves it, and the image's
# own entrypoint, command and user must serve the web client (Lazurio/t3code#189).
- name: Start the release image and check dictation ships in it
run: |
set -euo pipefail
docker run --rm --network none --entrypoint node lazurio/t3code:ci -e '
const { createRequire } = require("node:module");
const { existsSync, realpathSync } = require("node:fs");
const { dirname, join } = require("node:path");
const manifest = realpathSync("/opt/lazurio-t3/node_modules/transcribe-cpp/package.json");
const native = createRequire(manifest).resolve("@transcribe-cpp/linux-x64-cpu-vulkan/package.json");
const library = join(dirname(native), "libtranscribe.so");
if (!existsSync(library)) throw new Error(`missing ${library}`);
console.log(`dictation ships: ${manifest}, ${library}`);
'
container="$(docker run --detach --network none lazurio/t3code:ci)"
served=0
for _ in $(seq 1 60); do
if docker exec "$container" node -e '
fetch("http://127.0.0.1:3773/").then((response) => process.exit(response.status === 200 ? 0 : 1), () => process.exit(1));
'; then
served=1
break
fi
sleep 1
done
state="$(docker inspect "$container" --format '{{.State.Running}} {{.RestartCount}}')"
if [ "$served" != 1 ] || [ "$state" != "true 0" ]; then
echo "::error::The image's default command did not serve / on 127.0.0.1:3773 (state: $state)"
docker logs "$container"
docker rm --force "$container" > /dev/null
exit 1
fi
docker rm --force "$container" > /dev/null
echo "The image's default command serves / on 127.0.0.1:3773."

# The same archive build and launcher install the release runs, under the
# never-released version <upstream>-lazurio.0. Keep it in step with UPSTREAM_TAG.
cli-archives:
Expand Down
Loading
Loading