sdl3 0.19.0

Bindings to SDL3, a cross-platform library to abstract the platform-specific details for building applications.
Documentation
name: Checks

env:
  CARGO_INCREMENTAL: 0
  CARGO_TERM_COLOR: "always"

on:
  push:
    branches: ["master"]
  pull_request:

jobs:
  clippy-version-features:
    name: Clippy - ${{ matrix.build_mode }} - feature ${{ matrix.feature }}
    runs-on: ubuntu-latest
    
    strategy:
      fail-fast: false
      matrix:
        build_mode:
          - build-from-source
          - build-from-source-static
        feature:
          - ash
          - unsafe_textures
          - ttf
          - hidapi
          - raw-window-handle
          - image
          - mixer

    steps:
      - name: checkout sources
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Install Linux dependencies
        uses: ./.github/actions/install-linux-deps

      - name: Install toolchain
        uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # master
        with:
          toolchain: stable
          components: clippy

      - name: Fetch dependencies
        run: cargo +stable fetch --locked

      # TODO: deny all warnings
      - name: Clippy
        run: |
          cargo +stable \
            clippy \
            --verbose \
            --locked \
            --offline \
            --all-targets \
            --features "${{ matrix.build_mode }} ${{ matrix.feature }}" \
            -- \
            -A warnings \
            -W clippy::not_unsafe_ptr_arg_deref

  build-version-features:
    name: Build - ${{ matrix.os }} - ${{ matrix.build_mode }} - feature ${{ matrix.feature }}
    runs-on: ${{ matrix.os }}

    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, ubuntu-latest, windows-latest]
        build_mode:
          - build-from-source
          - build-from-source-static
        feature:
          - ash
          - unsafe_textures
          - ttf
          - hidapi
          - raw-window-handle
          - image
          - mixer
        exclude:
          # harfbuzz has CRT linking issues on Windows static builds
          # https://github.com/libsdl-org/SDL_ttf/issues/289
          - os: windows-latest
            build_mode: build-from-source-static
            feature: ttf

    steps:
      - name: checkout sources
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Install Linux dependencies
        uses: ./.github/actions/install-linux-deps

      # cmake 0.1.x (build-dep of sdl3-sys) can't auto-detect the Visual Studio
      # generator on recent windows-latest images and panics with "couldn't
      # determine visual studio generator". Set up the MSVC env and force the
      # Ninja generator (bundled with VS) to sidestep the broken detection.
      - name: Set up MSVC
        if: runner.os == 'Windows'
        uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0

      - name: Use Ninja generator for CMake on Windows
        if: runner.os == 'Windows'
        shell: bash
        run: echo "CMAKE_GENERATOR=Ninja" >> "$GITHUB_ENV"

      - name: Install toolchain
        uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # master
        with:
          toolchain: stable

      - name: Fetch dependencies
        run: cargo +stable fetch --locked

      # Use the default shell (pwsh on Windows) rather than bash: under Git bash
      # rustc picks up Git's usr/bin/link.exe instead of the MSVC linker. Keep
      # the command on one line so it runs the same in bash and pwsh.
      - name: Build
        run: cargo +stable build --verbose --locked --offline --examples --all-targets --features "${{ matrix.build_mode }} ${{ matrix.feature }}"

  tests:
    name: Tests - ${{ matrix.name }}
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        include:
          - name: default (build-from-source)
            build_mode: build-from-source
            features: ""
          - name: default (build-from-source-static)
            build_mode: build-from-source-static
            features: ""
          - name: image (build-from-source)
            build_mode: build-from-source
            features: "image"
          - name: image (build-from-source-static)
            build_mode: build-from-source-static
            features: "image"
          - name: mixer (build-from-source)
            build_mode: build-from-source
            features: "mixer"
          - name: mixer (build-from-source-static)
            build_mode: build-from-source-static
            features: "mixer"

    steps:
      - name: checkout sources
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Install Linux dependencies
        uses: ./.github/actions/install-linux-deps

      - name: Install Xvfb
        if: runner.os == 'Linux'
        run: |
          sudo apt-get update
          sudo apt-get install --no-install-recommends -y xvfb
      - name: Install toolchain
        uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # master
        with:
          toolchain: stable

      - name: Fetch dependencies
        run: cargo +stable fetch --locked

      - name: Test
        env:
          SDL_VIDEODRIVER: x11
          SDL_AUDIODRIVER: dummy
        run: |
          FEATURES="$(echo "${{ matrix.build_mode }} ${{ matrix.features }}" | xargs)"
          xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" \
            cargo +stable \
              test \
              --verbose \
              --locked \
              --offline \
              --lib \
              --tests \
              --examples \
              --features "$FEATURES"

  fmt:
    name: Formatting
    runs-on: ubuntu-latest

    steps:
      - name: Checkout sources
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Install toolchain
        uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # master
        with:
          toolchain: stable
          components: rustfmt

      - name: Check formatting
        run: cargo fmt --all -- --check