Files
VoelinClient/docs/ci.md
faumarayandClaude Fable 5.1 b8ba43f0c9
CI / Linux checks (pull_request) Failing after 21m18s
Check each OpenSSH tool on its own and stop only an agent this job started
command -v with two names returns 0 when one resolves, so the guards were
weaker than they read. The release workflow's final step killed whatever agent
SSH_AGENT_PID named; it now needs the marker the start step writes after it
succeeded. Two documentation lines re-wrapped (the review's three minors).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-24 14:24:19 +03:00

14 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://ghcr.io/catthehacker/ubuntu:act-24.04
    

    Configure this in the runner's labels when registering/configuring it; an ubuntu-latest label alone does not match. 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), GHCR (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.

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.