name: CI
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
permissions:
contents: read
jobs:
build:
name: Build & test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install system dependencies (incl. protoc for grpc)
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
pkg-config build-essential ca-certificates \
protobuf-compiler \
libx11-dev libxcb1-dev libx11-xcb-dev \
libxi-dev libxtst-dev libxrandr-dev libxinerama-dev \
libxkbcommon-dev libwayland-dev \
libgl1-mesa-dev libegl1-mesa-dev
- name: Install Rust
run: rustup toolchain install stable --profile minimal --component clippy,rustfmt
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
- name: Check formatting
run: cargo fmt -- --check
- name: Run Clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: cargo check (default features)
run: cargo check --examples
- name: cargo check (no optional features)
run: cargo check --no-default-features --features tiles --examples
- name: Cargo build
run: cargo build --all-features
- name: Run tests
run: cargo test --all-features
coverage:
name: Coverage
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
pkg-config build-essential ca-certificates \
protobuf-compiler \
libx11-dev libxcb1-dev libx11-xcb-dev \
libxi-dev libxtst-dev libxrandr-dev libxinerama-dev \
libxkbcommon-dev libwayland-dev \
libgl1-mesa-dev libegl1-mesa-dev
- name: Install Rust
run: rustup toolchain install stable --profile minimal
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
- name: Cache tarpaulin
id: cache-tarpaulin
uses: actions/cache@v6
with:
path: ~/.cargo/bin/cargo-tarpaulin
key: ${{ runner.os }}-tarpaulin-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-tarpaulin-
- name: Install cargo-tarpaulin
if: steps.cache-tarpaulin.outputs.cache-hit != 'true'
run: cargo install cargo-tarpaulin
- name: Run tarpaulin
run: cargo tarpaulin --all-features --out Xml
- uses: actions/upload-artifact@v7
with:
name: coverage-report
path: cobertura.xml
if-no-files-found: error