Files
VoelinClient/docs/ci.md
T
faumarayandClaude Sonnet 5.5 d4ccb8c8b8 docs: testing/load.md, how to make a machine busy and what the load-only tests assert
The recipe of the round (32 busy loops beside many runs of a test binary, a
build before and one after run alternately), the rules the fixes followed, the
table of the tests that failed only under load with their counts before and
after, the account-change test of the seam follow-ups (not reproduced; the
timing of its steps against its deadlines, and the reading of the code that
found no race), the tests seen at heavier load and left alone, and the
engine stage of the live smoke (ts6_banners failed because the test shared the
TeamSpeak 6 server with the others; what the smoke still does not do
reliably). docs/ci.md points to it from the section on the job image.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 04:34:05 +03:00

21 KiB

CI

GitHub Actions runs .github/workflows/ci.yml, including Linux checks, Windows and Android Clippy, and TeamSpeak integration smoke tests. Automatic runs are off: CI, the dependency audit and fuzzing run only by hand (Actions → the workflow → Run workflow; the same on Gitea). Only the package builds run by themselves, on v* tags, and they run none of these checks. Both GitHub and Gitea provide release packaging; see release.md and building.md.

Cargo builds use one job in CI (ci.yml) so the generated UI library and its test target do not compile concurrently. GitHub's release workflow uses one job too, also inside its Flatpak build: on its 16 GB runners the UI library does not fit next to other crates, and the runner is killed. The Gitea release workflow, its Docker images and the Flatpak manifest itself use Cargo's defaults (one job per CPU, no incremental builds in release mode). The release profile uses ThinLTO and 16 codegen units instead of fat LTO and one unit, reducing peak compiler memory while retaining optimised builds and panic unwinding. This trades some whole-program optimisation for lower build-memory requirements; release runtime performance has not been benchmarked for this change.

Gitea Actions

.gitea/workflows/ci.yml runs a single Linux job when dispatched by hand (automatic runs on pushes and pull requests are off).

The job runs:

  • formatting and warnings-as-errors Clippy for our crates;
  • workspace Clippy (vendored warnings are reported, compilation errors fail);
  • a locked workspace all-targets build and workspace tests under Xvfb;
  • cargo-deny 0.20.2 workspace policy checks and the cargo-about 0.9.2 notices check;
  • offline regression tests of the Gitea draft-release uploader.

The workspace tests are not disabled. Xvfb supplies the display for X11 capture and hotkey tests. This is Linux CI, not parity with every GitHub job: it does not run Windows/Android checks, Docker-based TeamSpeak smoke tests, opt-in browser interop, or package builds. Gitea release packaging runs in the separate release.yml workflow below.

Runner setup

  1. Enable Actions on the Gitea instance and in the repository settings.

  2. Register an x86_64 Linux act_runner with a Docker-capable host and this label (the left side must match the workflow's runs-on):

    ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04
    

    Configure this in the runner's labels when registering/configuring it; an ubuntu-latest label alone does not match. This is the image of the runner that runs this repository's CI, and the one the tests are checked against (Tests under the job image). The job image must provide Bash, Git, the OpenSSH client, Node.js for checkout v4, and root or passwordless sudo for apt.

  3. Allow network access from the runner and job container to the Gitea instance, GitHub (checkout action, dependencies and RustSec advisories), docker.gitea.com (runner image), Ubuntu apt mirrors, rustup distribution servers, crates.io and dependency/license sources used by cargo-about. The workspace also depends on the private VoelinProtocol repository (voelin-identity, over SSH), so the job needs read access to it and the server's SSH port. The workflows set that up themselves from a repository secret: VoelinProtocol access. A runner needs nothing for it beyond the network access and the image tools above.

  4. Provision enough RAM, swap and free disk for a full Slint workspace build plus cargo-deny/cargo-about compilation. These are large builds; monitor the first run and size the runner accordingly. The workflow limits Cargo to one build job, disables incremental compilation, and reuses build outputs between steps in one job. It does not create swap or modify the Gitea host.

  5. The workflow requests a three-hour job timeout. Legacy act_runner versions ignore timeout-minutes; configure their runner-level limit in the runner configuration instead:

    runner:
      timeout: 3h
    

    Newer gitea-runner (2.0+) supports the workflow-level timeout. Check the installed runner's configuration rather than assuming the YAML timeout is enforced. The Gitea server also stops any task running longer than ENDLESS_TASK_TIMEOUT (default 3h, [actions] in app.ini), whatever the runner or the workflow say; raise it above the longest job (see the release runner below).

The workflow shares the repository's local system-dependencies action with GitHub CI and bootstraps rustup if absent, then installs the toolchain and components pinned in rust-toolchain.toml. Checkout uses a fully qualified GitHub action URL rather than depending on the instance's action-source configuration.

No GitHub cache/artifact service or reusable-workflow support is required. The job does not need a Docker socket mounted inside its container; the runner itself still needs Docker access to start that container. Keep this runner isolated from production services and credentials, particularly when accepting untrusted pull requests. CI needs one secret, the VoelinProtocol deploy key below; it needs no release signing or publishing secrets.

After registering the runner, dispatch CI in Gitea Actions and inspect all step results. Local YAML/shell checks do not prove that a particular Gitea instance, runner registration, network policy or resource allocation can complete this job.

Tests under the job image

The test step runs as root in an Ubuntu 24.04 container of the ubuntu-24.04 label (Runner setup: docker.gitea.com/runner-images:ubuntu-24.04, HOME=/root) to which only the apt packages of the system-dependencies action are added. A test that assumes a developer machine fails there, and a run takes about an hour, so check a change to the tests the way CI runs them, with every failing test of every crate listed in one go (--no-fail-fast):

# A bare clone of the private VoelinProtocol repository (see below the block):
#   git clone --bare ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git <dir>
: "${PROTOCOL_GIT:?path of a bare clone of VoelinProtocol}"
# Root owns what the container writes: keep it in a directory of its own
# (.scratch/ is in .gitignore; see below the block for its removal).
mkdir -p .scratch
docker run --rm --init -v "$PWD":/src -w /src -e HOME=/root \
  -v "$PROTOCOL_GIT":/protocol.git:ro -e CARGO_NET_GIT_FETCH_WITH_CLI=true \
  -e CARGO_HOME=/src/.scratch/cargo -e RUSTUP_HOME=/src/.scratch/rustup \
  -e CARGO_TARGET_DIR=/src/.scratch/target \
  docker.gitea.com/runner-images:ubuntu-24.04 bash -c '
    git -C / config --global url."file:///protocol.git".insteadOf \
      ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git
    apt-get update && apt-get install -y --no-install-recommends \
      build-essential ca-certificates cmake curl git jq pkg-config python3 \
      libasound2-dev libfontconfig1-dev libxkbcommon-dev libvpx-dev \
      libdav1d-dev libpipewire-0.3-dev libspa-0.2-dev libclang-dev xvfb xauth
    curl --proto =https --tlsv1.2 -sSf https://sh.rustup.rs | \
      sh -s -- -y --profile minimal --default-toolchain none
    . "$CARGO_HOME/env" && rustup toolchain install
    xvfb-run -a bash -c "VOELIN_X11_TEST_DISPLAY=\$DISPLAY \
      cargo test --workspace --locked --no-fail-fast"'

--init is required: bash -c runs its last command, xvfb-run, as the container's process 1, and that never gets to start cargo (the command hangs). The runner starts its steps with docker exec in a container whose process 1 is something else, so CI itself is not affected.

The private VoelinProtocol dependency needs the deploy key (below). The block reads it from a local bare clone instead: PROTOCOL_GIT is mounted at /protocol.git and git is told to use it in place of the SSH URL (with CARGO_NET_GIT_FETCH_WITH_CLI=true, as in CI, so that cargo runs the git command), which leaves Cargo.lock as it is. The git config is run with -C / because a git worktree's .git file points outside the mount, and git config in /src then fails with fatal: not a git repository: (null) (exit 128). To use the deploy key instead, set it up as described below and leave out the PROTOCOL_GIT lines and the git config command. What the container wrote under .scratch/ belongs to root; remove it from a container as well:

docker run --rm -v "$PWD/.scratch":/s alpine:3.20 rm -rf /s/target /s/cargo /s/rustup

What the image lacks, and what the tests do about it. A test that is about the missing piece returns without testing it, in most cases after printing a line that says it skipped and names the piece (the wording differs from test to test), or is #[ignore]d with the reason, and passes; any other test does not need the piece.

A test cannot count on What the tests do
Regular user (root writes anywhere and creates missing directories) Nothing relies on a permission bit or a missing directory failing. A path that cannot be written is built from something that fails for root too: below a regular file (ENOTDIR) or naming a directory (EISDIR), as an_unwritable_path_fails_at_once of the recorder does.
Sound card (/dev/snd), PipeWire and WirePlumber daemons libpipewire and ALSA are there to build against only. tests/pipewire_apps.rs needs pipewire, wireplumber and dbus-daemon and, without them, prints a skipped line that names them. The camera tests are #[ignore]d (a camera and PipeWire).
D-Bus session bus voelin-platform's portal proxy test runs itself again under dbus-run-session on a bus of its own and, where that cannot be run, prints skipped, nothing was checked: dbus-run-session cannot be run; the notification and capture-portal tests run only where no bus is configured, and check that talking to a missing service fails cleanly.
GPU, /dev/dri, VA-API, /dev/udmabuf The VA-API and DMA-BUF tests print a skipped line that names what is missing: a usable h264_vaapi, /dev/udmabuf or VA-API surfaces to export.
FFmpeg libraries, ffmpeg and ffprobe The FFmpeg tests of voelin-media and voelin-core print a skipped line that names what is missing (the libraries, ffmpeg, ffprobe). The studio tests that read a recording back with ffprobe write and check the file themselves and skip only the ffprobe check; the RTMP tests need all three and skip.
H.264 encoder (no FFmpeg, no GPU, no OpenH264 library: VOELIN_OPENH264_LIB is unset and the download test is #[ignore]d) Tests that need an H.264 encoder print a skipped line that says no H.264 encoder is there. Tests of codec choice state what preferred_codec promises with whatever the machine can encode. VP8 and VP9 (libvpx) are built in, so their round trips run.
X11 or Wayland display xvfb-run supplies one X11 display and the step hands it over as VOELIN_X11_TEST_DISPLAY to the X11 capture and hotkey tests. VOELIN_WLROOTS_TEST_DISPLAY is unset, so the wlroots capture test prints skipped.
Playwright and Chromium (the image has Node) The browser interop tests print skipped: set VOELIN_INTEROP=1 (needs node, Playwright and Chromium).
TeamSpeak dev servers Without VOELIN_LIVE=1 the live tests return at once (some print skipped: set VOELIN_LIVE=1 with the dev servers running); the gateway's live test is #[ignore]d (needs a running tsgw and TeamSpeak server).
DNS and internet while the tests run (the job needs the network for apt, rustup and crates before they start) The tests use no DNS or internet; those that would are #[ignore]d with the reason: four resolver tests of tsclientlib (needs DNS and the internet) and the OpenH264 download test.

localhost resolves to ::1 first in this image (it also has 127.0.0.1). The tests that reach a server of their own go to 127.0.0.1 by name, not through localhost, so a machine where connections to ::1 hang (a development machine with a VPN does that) changes nothing for them.

A test that passes in the image and fails now and then on a busy runner or development machine is another kind of failure, a test of the machine's load: testing/load.md says how to make a machine busy to reproduce one, what the tests that failed that way assert now, and which are known and left alone.

VoelinProtocol access

The workspace depends on voelin-identity from the private repository Voelin/VoelinProtocol, as a git dependency over SSH (building.md). Cargo resolves the whole workspace before it builds anything, so every cargo command needs that access: all of CI, all three package images and the gateway image (whose crate does not use voelin-identity itself). Without it the first cargo command fails with unknown SSH host key (runs 1037 and 1050 did).

What is set up:

  • The deploy key. A read-only SSH deploy key is registered on Voelin/VoelinProtocol (Settings → Deploy Keys, write access off). It has no other use and no access to any other repository. Its private half is the repository secret VOELIN_PROTOCOL_DEPLOY_KEY of Voelin/VoelinClient (Settings → Actions → Secrets): the whole OpenSSH private key file, BEGIN and END lines included, without a passphrase. To rotate it, make a new pair (ssh-keygen -t ed25519 -N '' -C voelin-client-ci -f key), register key.pub on VoelinProtocol, replace the secret with the contents of key, run CI, then delete the old deploy key and key.

  • CI (ci.yml). The workflow hands the secret to the checks action as its input protocol-deploy-key (a repository secret is not visible inside a composite action). The action's first step fails at once, naming the secret, if the input is empty or is not a private key. Otherwise it writes the key to ~/.ssh/voelin_protocol (mode 0600, ~/.ssh 0700), appends the host key line to ~/.ssh/known_hosts, writes a Host git.faumaray.com block to ~/.ssh/config (User gitea, that IdentityFile, IdentitiesOnly yes, StrictHostKeyChecking yes) and exports CARGO_NET_GIT_FETCH_WITH_CLI=true and GIT_SSH_COMMAND for the rest of the job (ci.yml sets the first one in its own env as well). It prints only the key's public fingerprint; the key is never echoed. After the system packages a second step runs git ls-remote on VoelinProtocol, so a wrong key or host key fails there, with the reason, and not inside a cargo command. The key lives in the job container and goes with it.

  • Release (release.yml). A step after checkout starts an ssh-agent on the release host, loads the key into it from stdin (it is never written to disk) and exports SSH_AUTH_SOCK; the agent forgets the key after nine hours, and a last step, which also runs after a failure, stops it. The builds pass the agent on with docker build --ssh default (scripts/docker-build.sh does it for the three packages; the gateway image step does it itself).

  • The images. Each cargo RUN of docker/*.Dockerfile and crates/voelin-gateway/Dockerfile has --mount=type=ssh,required=true, so the key exists only inside that step, through the agent socket, and never reaches a layer, a build argument or the cache; a build without --ssh stops there with unset ssh forward key default. The build stage copies .gitea/known_hosts to /etc/ssh/ssh_known_hosts and sets the same CARGO_NET_GIT_FETCH_WITH_CLI=true; the toolchain stages install git and openssh-client.

  • Cargo uses the system git (CARGO_NET_GIT_FETCH_WITH_CLI=true) because Cargo's built-in git client does not read ~/.ssh/config (so it cannot use an IdentityFile), authenticates with an ssh-agent and checks the host against ~/.ssh/known_hosts and its own net.ssh.known-hosts setting. The system git runs ssh, which reads the config above (and /etc/ssh/ssh_known_hosts in the images), so the same files serve a plain git call, Cargo and the access check.

  • The host key is committed in .gitea/known_hosts, never fetched while a job runs. Gitea's built-in SSH server (SSH-2.0-Go) offers an RSA host key only (ssh-keyscan -t ed25519 git.faumaray.com prints nothing), so the line is ssh-rsa; its fingerprint is SHA256:fugBYnqAnqmTLsGpafVgQF9gPQzJqps7uHvs48blg2A. Re-check it:

    ssh-keygen -lf .gitea/known_hosts                   # the committed line
    ssh-keyscan -t rsa git.faumaray.com | ssh-keygen -lf -   # what the server offers now
    

    Both print the fingerprint above. If the server's key is ever replaced on purpose, confirm the new fingerprint with the server's administrator, put the new ssh-keyscan -t rsa line and the date in .gitea/known_hosts and the fingerprint here, and commit all of it in one change. Until then a changed key makes every job stop with Host key verification failed, which is the point.

Pull requests from forks get no secrets: their CI run stops at the first step with the message about the empty deploy key. Anyone who can change a workflow of this repository, or run code in one of its jobs, can read the key; it can only read VoelinProtocol, and it is replaced as above. That is one more reason to keep the CI runner isolated, as said above.

If a run fails here:

Message Cause
The VoelinProtocol deploy key is empty the secret is missing, empty or not visible (a fork's pull request)
… is not an unencrypted OpenSSH or PEM private key the secret holds something else, or a key with a passphrase
Permission denied (publickey) in "Check read access to VoelinProtocol" the key is valid but is not a deploy key of VoelinProtocol: compare the fingerprint "Deploy key installed" printed with the one in VoelinProtocol's deploy key settings
Host key verification failed .gitea/known_hosts does not match the server: check as above before changing anything
unset ssh forward key default a Docker build ran without --ssh default: a plain docker build (scripts/docker-build.sh passes it itself and stops earlier when the agent has no key)

Gitea release runner

The instance at https://git.faumaray.ru reported Gitea 1.25.4 on 2026-10-04. Release publishing uses its REST API; artifact upload uses the pinned Gitea artifact-action fork, not stock GitHub upload-artifact v4.

Register a separate repository-scoped, x86_64 Ubuntu 24.04 native host runner with the label:

voelin-release:host

Provision Bash, Git, the OpenSSH client (ssh-agent and ssh-add), Node.js 20+, Python 3.11+, curl, tar, gzip and rootful Docker 23+ with BuildKit. Use act_runner 0.2.7 or newer (prefer the latest maintained release), or gitea-runner 2+. Older act_runner does not provide ACTIONS_RESULTS_URL, which the pinned artifact action needs. Register the runner against https://git.faumaray.ru, reachable from both the host and build containers. Gitea 1.25.4 provides the required artifact-v4 API. The shared checks install native build dependencies through root or passwordless sudo and bootstrap Rust. Docker builds install Windows cross-toolchains, Android SDK/NDK and Java themselves; no Windows runner or preinstalled Android SDK is needed. The Flatpak builder runs a privileged container using the same Freedesktop 25.08 image as GitHub. Allow network access to the existing CI sources, Flathub, Google's Android downloads/Maven, Chromium's libvpx git server, Docker Hub, GHCR and the gateway image's distroless base at GCR. Configure Gitea release attachment types/size limits and reverse-proxy upload limits for the APKs, Flatpak and gateway image; artifact and release storage must fit the full package set.

This host is not the container runner used for pull requests. Restrict it to this repository's trusted release workflow, protect v* tags, and only dispatch trusted branches. Do not advertise this label on an instance-wide runner that untrusted repositories or PR workflows can select. Docker and Flatpak privileges effectively grant host access. Use an isolated machine with no production services or credentials.

Configure one release runner, with capacity 1, so runs do not race:

runner:
  capacity: 1
  timeout: 8h

The workflow requests eight hours; older act_runner ignores job-level timeouts, so the runner limit is required. The server's own limit must allow it too, or Gitea stops the release after three hours:

[actions]
ENDLESS_TASK_TIMEOUT = 9h

Keep sufficient RAM/swap and free disk for all package builds and their Docker caches. The package builds run one after another, each with as many Cargo jobs as the host has CPUs. The workflow never prunes shared Docker state or creates host swap. The secrets are the VoelinProtocol deploy key (below), RELEASE_TOKEN and the optional Android signing secrets, both documented in Gitea releases.

The Gitea release job builds packages only: it runs no formatting, Clippy, tests, native Windows, Android Clippy or TS3/TS6 smoke tests; run CI by hand for those. Full hosted builds and a draft upload must be verified on the registered runner; local shell/API fixtures do not establish deployment acceptance.