66 lines
2 KiB
YAML
66 lines
2 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: ["**"]
|
|
pull_request:
|
|
|
|
concurrency:
|
|
group: ci-${{ github.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: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
|
|
runs-on: self-hosted
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Verify system dependencies
|
|
run: |
|
|
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: |
|
|
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 component add rustfmt clippy
|
|
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
|