name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
env:
CARGO_TERM_COLOR: always
MSRV: "1.95"
jobs:
fmt:
name: Format & manifest
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all --check
- name: Check that rust-version matches MSRV
run: |
declared=$(grep -m1 '^rust-version' Cargo.toml | cut -d'"' -f2)
if [ "$declared" != "${MSRV}" ]; then
echo "rust-version in Cargo.toml ($declared) does not match MSRV in ci.yml (${MSRV})" >&2
exit 1
fi
check:
name: Check (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libxdo-dev libgl1-mesa-dev
- name: Build (all features)
run: cargo build --release
- name: Build (egui only)
run: cargo build --release --no-default-features --features egui-backend
- name: Build (webview only)
run: cargo build --release --no-default-features --features webview-backend
- name: Build (tui only)
run: cargo build --release --no-default-features --features tui-backend
- name: Run clippy (all features)
run: cargo clippy --all-features --all-targets -- -D warnings
- name: Run clippy (single backends)
shell: bash
run: |
for feature in egui-backend webview-backend tui-backend; do
cargo clippy --no-default-features --features "$feature" -- -D warnings
done
- name: Run tests
run: cargo test --all-features
msrv:
name: MSRV (Rust 1.95)
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- name: Install Rust ${{ env.MSRV }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-msrv-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-msrv-cargo-
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libxdo-dev libgl1-mesa-dev
- name: Check (all features)
run: cargo check --all-features --all-targets
- name: Test
run: cargo test --all-features