mpv-engine 0.2.1

Toolkit-agnostic libmpv embedding core: handle lifecycle, commands, typed events, and render seams.
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: test (stable)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      # rsmpv-sys links libmpv via pkg-config; the headless tests generate
      # their media with ffmpeg (and skip themselves when it's missing).
      - name: Install libmpv and ffmpeg
        run: |
          sudo apt-get update
          sudo apt-get install -y --no-install-recommends libmpv-dev ffmpeg
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo test --locked --all-targets
      - run: cargo test --locked --doc

  msrv:
    name: check (MSRV 1.85)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@1.85
      - uses: Swatinem/rust-cache@v2
      # check doesn't link, so no libmpv needed: rsmpv-sys's build script
      # degrades to a bare `rustc-link-lib` when pkg-config finds nothing.
      - run: cargo check --locked --all-targets

  # Compile-check every platform × feature combination. The default `test`
  # job builds none of the `export`/`wgpu` code (it's off by default and
  # platform-gated) — this is where `macos.rs`, `windows.rs`, and the wgpu
  # import backends actually get type-checked and linted, on their own OS.
  # clippy is check-based (no link step), so — like the msrv job — it needs
  # no libmpv: rsmpv-sys degrades to a bare `rustc-link-lib` when
  # pkg-config finds nothing.
  platforms:
    name: clippy ${{ matrix.os }} / ${{ matrix.features }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        # `wgpu` implies `export`; `export` alone is the combo a
        # Metal/Vulkan/D3D consumer who doesn't want wgpu would build.
        features: [export, wgpu]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo clippy --locked --all-targets --features ${{ matrix.features }} -- -D warnings

  lint:
    name: fmt + clippy + doc
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo fmt --check
      - run: cargo clippy --locked --all-targets -- -D warnings
      - run: cargo doc --locked --no-deps
        env:
          RUSTDOCFLAGS: -D warnings
      # Doc the feature surface too — the export/wgpu rustdoc (and its
      # intra-doc links) is otherwise never checked.
      - run: cargo doc --locked --no-deps --features wgpu
        env:
          RUSTDOCFLAGS: -D warnings