Files
rustscreen/.gitea/workflows/ci.yml
T
Guillaume ASSIERandClaude Opus 5.5 78954b90dc
CI / Formatting, tests and builds (push) Successful in 2m44s
feat(windows): compilation croisée depuis Linux, l'hôte tourne sous Wine
Le shell Nix `.#windows` (#93) fournit un rustc pour la cible
x86_64-pc-windows-gnu (en cache dans nixpkgs), mingw-w64 et une libvpx
1.13 statique construite par nix/libvpx.nix, dont la variante Linux
garde son empreinte. aws-lc demande les en-têtes de winpthreads, que
le shell ajoute.

rs-platform se compile pour Windows:
- le portail et zbus ne sont plus que sous Linux; ailleurs, le même API
  répond `Unsupported`, traduit côté coque (`portal_unsupported`);
- la veille a un sous-module par système. Sous Windows, une requête
  d'alimentation (système et écran requis) empêche la veille, et la
  notification de suspension et de reprise remplace PrepareForSleep.

Les réglages vont dans %APPDATA%\rustscreen, le journal dans
%LOCALAPPDATA%\rustscreen\logs.

Vérifié sous Wine: `rustscreen-cli.exe --synthetic` prend le verrou de
veille, sert la mire et Chromium la reçoit (ICE, DTLS, première image
en 170 ms). Les tests du workspace passent sous Wine, sauf la
résolution mDNS de rustscreen.local, à vérifier sur un vrai Windows
(#94). La CI compile et passe clippy pour Windows quand Nix est présent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 20:39:17 +01:00

196 lines
7.6 KiB
YAML

# rustscreen continuous integration.
#
# It runs on Gitea, on the `rustscreen-ci` runner, which is a host and not a
# container: the machine has no Docker daemon, but it has cargo, node and nasm.
# This runner is registered for this repository: Exoledge's only sees jobs from
# the Exoledge organization, and rustscreen lives under `heap`. The label is
# explicit so that an environment change shows up in the diff rather than in
# the middle of a run.
#
# Two precautions that cost a lot when forgotten:
#
# - libvpx is not provided by the system. `env-libvpx-sys` requires an explicit
# prefix, so the pipeline builds libvpx once into the cache and reuses it.
# Without that cache, every run would pay ten minutes of C compilation again.
# - caches are kept per repository. The runner is shared with other projects:
# a common `CARGO_TARGET_DIR` would make unrelated builds trample each other.
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
integrate:
name: Formatting, tests and builds
runs-on: rustscreen-ci
steps:
- uses: actions/checkout@v7
- name: Tools and caches
run: |
set -euo pipefail
# Caches live outside the repository, in a directory specific to this
# project: the CI machine is shared with others.
cache="${RUSTSCREEN_CACHE_DIR:-$HOME/.cache/rustscreen-ci}"
mkdir -p "$cache"
{
echo "CARGO_TARGET_DIR=$cache/cargo-target"
echo "VPX_PREFIX=$cache/libvpx"
echo "npm_config_cache=$cache/npm"
} >> "$GITHUB_ENV"
# nasm, file and desktop-file-validate may be installed by the runner's
# administrator in ~/.local/bin, outside the session PATH. When they
# are missing there, the pipeline falls back on what the system provides.
if [ -d "$HOME/.local/bin" ]; then
echo "PATH=$HOME/.local/bin:$PATH" >> "$GITHUB_ENV"
fi
- name: Versions
run: |
set -euo pipefail
cargo --version
cargo clippy --version
cargo fmt --version
node --version
npm --version
nasm -v || echo "nasm missing: libvpx will be built without an assembler, slower encoding"
- name: libvpx library
run: |
set -euo pipefail
# The version is pinned by the script: beyond 1.13, the pre-generated
# bindings of `env-libvpx-sys` are no longer enough.
if [ -f "$VPX_PREFIX/lib/libvpx.a" ]; then
echo "libvpx already built in $VPX_PREFIX"
else
./scripts/build-libvpx.sh "$VPX_PREFIX"
fi
{
echo "VPX_LIB_DIR=$VPX_PREFIX/lib"
echo "VPX_INCLUDE_DIR=$VPX_PREFIX/include"
echo "VPX_VERSION=1.13.0"
} >> "$GITHUB_ENV"
- name: Viewer dependencies
run: |
set -euo pipefail
cd apps/viewer
# `npm ci` rather than `npm install`: the lock file is the reference,
# the pipeline negotiates no version.
npm ci --no-audit --no-fund
- name: Viewer lint and types
run: |
set -euo pipefail
cd apps/viewer
npm run lint
npx tsc --noEmit
- name: Viewer tests
run: |
set -euo pipefail
cd apps/viewer
npm test
- name: Viewer bundle
run: |
set -euo pipefail
cd apps/viewer
npm run build
- name: Licenses
# Every shipped dependency stays compatible with Apache-2.0 (#59): a
# new crate under GPL, or without a license, fails here.
run: node scripts/check-licenses.mjs
- name: Formatting
run: cargo fmt --all --check
- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Tests
# The `export_bindings` tests write the TypeScript types: they run
# here, with the rest, and the "up to date" step only compares. A
# second cargo invocation, with different features, rebuilt half of
# the workspace (34 s, #78).
run: cargo test --workspace
- name: Wayland capture (PipeWire)
run: |
set -euo pipefail
# The feature requires libpipewire-0.3 and libclang (bindgen). The
# runner does not always have them: without them, the step says so and
# passes, and the release is the one that fails (see release.yml).
if pkg-config --exists libpipewire-0.3; then
cargo clippy -p rs-capture -p rs-session --features rs-session/pipewire --all-targets -- -D warnings
cargo test -p rs-capture --features pipewire
else
echo "libpipewire-0.3 missing on the runner: Wayland capture not checked"
fi
- name: Hardware encoding (VA-API)
run: |
set -euo pipefail
# The `vaapi` feature links GStreamer (#57). Without its development
# files the step says so and passes, like the PipeWire one. The
# encoder tests skip themselves on a runner without a GPU.
if pkg-config --exists gstreamer-app-1.0 gstreamer-video-1.0; then
cargo clippy -p rs-codec -p rs-session --features rs-session/vaapi --all-targets -- -D warnings
cargo test -p rs-codec --features vaapi
else
echo "GStreamer development files missing on the runner: hardware encoding not checked"
fi
- name: Windows build (cross-compiled)
run: |
set -euo pipefail
# Windows is built from Linux with mingw-w64 (#93): the `windows`
# shell of the flake brings a rustc for that target, its linker and
# a static libvpx. Without Nix on the runner the step says so and
# passes, like the PipeWire one.
if command -v nix >/dev/null 2>&1; then
nix develop .#windows -c cargo clippy --workspace --all-targets -- -D warnings
nix develop .#windows -c cargo build -p rs-session --bin rustscreen-cli
else
echo "Nix missing on the runner: the Windows build is not checked"
fi
- name: The binary starts
run: |
set -euo pipefail
# The pipeline does not stop at tests: it checks that the binary
# starts, because a product that does not start passes every unit
# test. The integration tests have already built it.
"$CARGO_TARGET_DIR/debug/rustscreen-cli" --version
- name: Release binary
# On main only: the whole stack in release costs more than a minute,
# and the release workflow rebuilds it anyway (#78).
if: github.event_name == 'push'
run: |
set -euo pipefail
cargo build --release -p rs-session --bin rustscreen-cli
"$CARGO_TARGET_DIR/release/rustscreen-cli" --version
- name: The TypeScript protocol is up to date
run: |
set -euo pipefail
# The protocol types are generated from Rust. A gap between the
# repository and the generated output means the viewer compiles
# against a stale protocol, which only shows in production.
# Written by the "Tests" step: all that is left is to compare.
# `status` rather than `diff`: a new type, never committed, counts too.
drift=$(git status --porcelain -- apps/viewer/src/proto apps/desktop/src/bindings)
if [ -n "$drift" ]; then
echo "$drift" >&2
echo "generated TypeScript types are out of date: run make proto and commit" >&2
exit 1
fi