name: Build
on:
push:
branches: [ "main", "feature/**" ]
pull_request:
branches: [ "main", "feature/**" ]
env:
CARGO_TERM_COLOR: always
defaults:
run:
working-directory: vips-rs
jobs:
test:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
link_tests: true
toolchain: stable
- os: macos-latest
link_tests: true
toolchain: stable
- os: windows-latest
link_tests: false
toolchain: stable
- os: ubuntu-latest
link_tests: true
toolchain: nightly
steps:
- name: Checkout vips-rs
uses: actions/checkout@v7
with:
path: vips-rs
- name: Checkout vips-sys (sibling path dep)
uses: actions/checkout@v7
with:
repository: houseme/vips-sys
path: vips-sys
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Install libvips (Linux)
if: runner.os == 'Linux' && matrix.link_tests
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libvips libvips-dev libvips-tools
- 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
vips-rs/target
vips-sys/target
key: ${{ runner.os }}-${{ matrix.toolchain }}-cargo-${{ hashFiles('vips-rs/Cargo.lock', 'vips-sys/Cargo.toml') }}
- name: cargo check
run: cargo check --all-features
- name: cargo clippy
if: matrix.toolchain == 'stable'
run: cargo clippy --all-targets -- -D warnings
- name: cargo test
if: matrix.link_tests
run: cargo test --all-features
- name: cargo build (release)
if: matrix.link_tests
run: cargo build --release --all-features
rust_fmt_check:
name: RustFmt
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run cargo fmt
run: cargo fmt --all -- --check