layer-shika/.github/workflows/ci.yml

100 lines
3.6 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libwayland-dev \
libxkbcommon-dev \
libegl1-mesa-dev \
libgles2-mesa-dev \
libfontconfig1-dev \
weston
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Build workspace
run: cargo build --workspace --verbose
- name: Run tests
run: cargo test --workspace --verbose
- name: Build documentation
run: cargo doc --workspace --no-deps --verbose
- name: Build examples
run: |
cargo build -p simple-bar
cargo build -p multi-surface
cargo build -p declarative-config
cargo build -p event-loop-examples
cargo build -p runtime-surface-config
- name: Run examples in headless Wayland compositor
run: |
export XDG_RUNTIME_DIR=/tmp
export WAYLAND_DISPLAY=wayland-ci-test
weston --backend=headless-backend.so --no-config --socket=$WAYLAND_DISPLAY &
WESTON_PID=$!
until test -S "/tmp/$WAYLAND_DISPLAY"; do
echo "Waiting for weston..."
sleep 0.5
done
echo "Weston started successfully"
timeout 5 cargo run -p simple-bar || echo "simple-bar timed out (expected)"
timeout 5 cargo run -p multi-surface || echo "multi-surface timed out (expected)"
timeout 5 cargo run -p declarative-config || echo "declarative-config timed out (expected)"
timeout 5 cargo run -p event-loop-examples --bin timer || echo "timer timed out (expected)"
timeout 5 cargo run -p event-loop-examples --bin channel || echo "channel timed out (expected)"
timeout 5 cargo run -p event-loop-examples --bin custom-source || echo "custom-source timed out (expected)"
timeout 5 cargo run -p runtime-surface-config || echo "runtime-surface-config timed out (expected)"
kill $WESTON_PID || true
wait $WESTON_PID 2>/dev/null || true