From cffb1d89625b199fbdc9e920fe34bb7a95b722bd Mon Sep 17 00:00:00 2001 From: loki5512344 Date: Sun, 1 Nov 2026 17:21:09 +0100 Subject: [PATCH] ci: verify system dependencies instead of installing them --- .gitea/workflows/ci.yml | 28 ++++++++++------------- .gitea/workflows/release.yml | 44 +++++++++++------------------------- 2 files changed, 25 insertions(+), 47 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 53d664d..e28c1c1 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -21,21 +21,18 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install system dependencies + - name: Verify system dependencies run: | - # Self-hosted host: install packages only if we may; otherwise assume they are preinstalled. - if [ "$(id -u)" != 0 ] && ! sudo -n true 2>/dev/null; then - echo "::warning::no root/passwordless sudo on the runner, skipping apt (dependencies must be preinstalled)" - exit 0 - fi - SUDO=$(command -v sudo || true) - export DEBIAN_FRONTEND=noninteractive - $SUDO apt-get update - $SUDO apt-get install -y --no-install-recommends \ - build-essential curl ca-certificates pkg-config cmake protobuf-compiler \ - libasound2-dev libopus-dev libudev-dev \ - libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev \ - libssl-dev libxkbcommon-dev libwayland-dev libfontconfig1-dev libdbus-1-dev + set -euo pipefail + # The runner is a developer machine (not Debian): never install system packages from CI. + miss=0 + for t in cmake protoc zip pkg-config python3 curl git; do + command -v "$t" >/dev/null || { echo "::error::missing tool: $t"; miss=1; } + done + for m in alsa opus libudev gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0 gstreamer-webrtc-1.0 gstreamer-sdp-1.0 openssl xkbcommon wayland-client fontconfig dbus-1; do + pkg-config --exists "$m" || { echo "::error::missing pkg-config module: $m"; miss=1; } + done + [ "$miss" = 0 ] - name: Install Rust toolchain run: | @@ -44,8 +41,7 @@ jobs: fi . "$HOME/.cargo/env" 2>/dev/null || true rustup toolchain install stable --profile minimal -c rustfmt -c clippy - rustup default stable - echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + rustup component add rustfmt clippy cargo --version - name: Cache cargo diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index a6df187..30453c1 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -42,29 +42,18 @@ jobs: python3 scripts/release/extract_changelog.py "$VERSION" CHANGELOG.md > /dev/null echo "releasing $VERSION on channel $CHANNEL" - - name: Install system dependencies + - name: Verify system dependencies run: | - # Self-hosted host: install packages only if we may; otherwise assume they are preinstalled. - if [ "$(id -u)" != 0 ] && ! sudo -n true 2>/dev/null; then - echo "::warning::no root/passwordless sudo, verifying preinstalled dependencies instead of installing" - for t in cmake protoc zip x86_64-w64-mingw32-gcc pkg-config; do - command -v "$t" >/dev/null || { echo "::error::missing required tool: $t"; exit 1; } - done - exit 0 - fi - SUDO=$(command -v sudo || true) - export DEBIAN_FRONTEND=noninteractive - $SUDO apt-get update - $SUDO apt-get install -y --no-install-recommends \ - build-essential curl ca-certificates pkg-config cmake protobuf-compiler zip \ - python3 \ - libasound2-dev libopus-dev libudev-dev \ - libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev \ - libssl-dev libxkbcommon-dev libwayland-dev libfontconfig1-dev libdbus-1-dev \ - mingw-w64 - # Posix threading model is required by the Rust windows-gnu target. - $SUDO update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix || true - $SUDO update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix || true + set -euo pipefail + # The runner is a developer machine (not Debian): never install system packages from CI. + miss=0 + for t in cmake protoc zip pkg-config python3 curl git x86_64-w64-mingw32-gcc; do + command -v "$t" >/dev/null || { echo "::error::missing tool: $t"; miss=1; } + done + for m in alsa opus libudev gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0 gstreamer-webrtc-1.0 gstreamer-sdp-1.0 openssl xkbcommon wayland-client fontconfig dbus-1; do + pkg-config --exists "$m" || { echo "::error::missing pkg-config module: $m"; miss=1; } + done + [ "$miss" = 0 ] - name: Install pinned Rust toolchain into a throwaway home run: | @@ -138,16 +127,9 @@ jobs: echo "WIN_ASSET=vnox-client-${VERSION}-windows-x86_64.zip" >> "$GITHUB_ENV" python3 scripts/release/extract_changelog.py "$VERSION" CHANGELOG.md > "$RUNNER_TEMP/changelog.md" - - name: Install signing dependencies + - name: Verify signing dependencies run: | - # Self-hosted host: install packages only if we may; otherwise assume they are preinstalled. - if [ "$(id -u)" != 0 ] && ! sudo -n true 2>/dev/null; then - python3 -I -c 'import cryptography' || { echo "::error::python3 cryptography is not installed and cannot be installed"; exit 1; } - exit 0 - fi - SUDO=$(command -v sudo || true) - $SUDO apt-get update - $SUDO apt-get install -y --no-install-recommends python3 python3-cryptography + python3 -I -c 'import cryptography' || { echo "::error::python cryptography is missing"; exit 1; } - name: Download build artifacts uses: actions/download-artifact@v3