vips-sys 0.2.0

libvips bindings for Rust
Documentation
name: Rust

on:
  push:
    branches: [ "main", "feature/**" ]
    tags:
      - "v[0-9]+.[0-9]+.[0-9]+*"
  pull_request:
    branches: [ "main", "feature/**" ]

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            link_tests: true
          - os: macos-latest
            link_tests: true
          # Windows check/clippy with pregenerated bindings; full link tests need
          # a vcpkg libvips install (slow). Enable link_tests after vcpkg setup.
          - os: windows-latest
            link_tests: false

    steps:
      - uses: actions/checkout@v7
        with:
          submodules: recursive

      - uses: dtolnay/rust-toolchain@stable

      - name: Install libvips (Linux)
        if: runner.os == 'Linux' && matrix.link_tests
        run: |
          sudo apt-get update
          sudo apt-get install -y pkg-config libvips-dev

      - name: Install libvips (macOS)
        if: runner.os == 'macOS' && matrix.link_tests
        run: |
          brew install vips pkg-config
          echo "PKG_CONFIG_PATH=$(brew --prefix vips)/lib/pkgconfig:$(brew --prefix)/lib/pkgconfig" >> "$GITHUB_ENV"

      - name: Cache cargo
        uses: actions/cache@v6
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: cargo check
        run: cargo check --features helpers

      - name: cargo clippy
        run: cargo clippy --features helpers -- -D warnings

      - name: cargo test (with system libvips)
        if: matrix.link_tests
        run: cargo test --features helpers

      - name: cargo build (release)
        if: matrix.link_tests
        run: cargo build --release --features helpers

  # Prove `cargo test` works with no system libvips (feature `stub`).
  test-stub:
    name: no-system-libvips (stub)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
        # vendor/ not required for the stub path

      - uses: dtolnay/rust-toolchain@stable

      - name: Ensure libvips is absent
        run: |
          if pkg-config --exists vips 2>/dev/null; then
            echo "unexpected system vips; this job must run without it" >&2
            exit 1
          fi

      - name: cargo test with stub
        run: cargo test --features helpers,stub

      - name: cargo clippy with stub
        run: cargo clippy --features helpers,stub -- -D warnings