name: CI on: push: branches: [main] pull_request: branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: CARGO_TERM_COLOR: always jobs: fmt: name: fmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Rust (stable + rustfmt) uses: dtolnay/rust-toolchain@stable with: components: rustfmt - name: cargo fmt --check run: cargo fmt --check clippy: name: clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Rust (stable + clippy) uses: dtolnay/rust-toolchain@stable with: components: clippy - name: Install system dependencies run: | sudo apt-get update sudo apt-get install -y --no-install-recommends \ libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev - uses: Swatinem/rust-cache@v2 - name: cargo clippy run: cargo clippy --all-targets -- -D warnings test: name: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Rust (stable) uses: dtolnay/rust-toolchain@stable - name: Install system dependencies run: | sudo apt-get update sudo apt-get install -y --no-install-recommends \ libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev - uses: Swatinem/rust-cache@v2 - name: cargo test --release run: cargo test --release build: name: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Rust (stable) uses: dtolnay/rust-toolchain@stable - name: Install system dependencies run: | sudo apt-get update sudo apt-get install -y --no-install-recommends \ libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev - uses: Swatinem/rust-cache@v2 - name: cargo build --release run: cargo build --release - name: Upload release binary uses: actions/upload-artifact@v4 with: name: wifi_lab-release path: target/release/wifi_lab retention-days: 7 smoke: name: smoke (mock UI under xvfb) needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Rust (stable) uses: dtolnay/rust-toolchain@stable - name: Install system dependencies (incl. xvfb) run: | sudo apt-get update sudo apt-get install -y --no-install-recommends \ xvfb libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev \ libxkbcommon-x11-0 libxcb-xkb1 libegl1 libgl1 - uses: Swatinem/rust-cache@v2 - name: cargo build --release run: cargo build --release - name: Run --mock under xvfb for 25s id: smoke run: | set +e xvfb-run -a timeout 25 ./target/release/wifi_lab --mock >smoke.log 2>&1 status=$? set -e cat smoke.log echo "exit_status=$status" >> "$GITHUB_OUTPUT" # Success criteria: # - 124: killed by timeout (still alive, no early crash), AND no panic # - 0: exited cleanly on its own # - any other status with no panic in the log is still treated as # failure to be explicit about the process dying abnormally. if grep -q "panicked" smoke.log; then echo "::error::panic detected in mock-mode output" exit 1 fi if [ "$status" -eq 124 ] || [ "$status" -eq 0 ]; then echo "smoke OK (status $status)" exit 0 fi echo "::error::mock-mode exited abnormally with status $status" exit 1