name: ci on: push: branches: ["**"] pull_request: concurrency: group: ci-${{ gitea.ref }} cancel-in-progress: true env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: "0" jobs: check: # The runner is a shared host, so never run code from forks on it. if: ${{ gitea.event_name != 'pull_request' || gitea.event.pull_request.head.repo.full_name == gitea.repository }} runs-on: self-hosted steps: - uses: actions/checkout@v4 - name: Install 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 - name: Install Rust toolchain run: | if ! command -v rustup >/dev/null; then curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal 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" cargo --version - name: Cache cargo uses: actions/cache@v4 with: path: | ~/.cargo/registry/index ~/.cargo/registry/cache ~/.cargo/git/db target key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} restore-keys: | cargo-${{ runner.os }}- - name: Format run: cargo fmt --check - name: Clippy run: cargo clippy --all-targets -- -D warnings - name: Test run: cargo test --workspace