- Upgrade actions/checkout from v2/v4 to v6 - Add test-platforms job: ubuntu, ubuntu-arm, macos-arm, macos-intel, windows, windows-arm - Add MSRV job using cargo-hack check --rust-version - Replace baptiste0928/cargo-install with taiki-e/install-action@cross for cross-compilation - Remove unnecessary Docker start step (cross handles container lifecycle) - Enable clippy -D warnings with --all-targets (was disabled with TODO)
115 lines
3.2 KiB
YAML
115 lines
3.2 KiB
YAML
name: Rust CI
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
rust: ["1.88.0", stable, beta, nightly]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
if: ${{ matrix.rust == '1.88.0' }}
|
|
- name: Generate Cargo.lock with minimal-version dependencies
|
|
if: ${{ matrix.rust == '1.88.0' }}
|
|
run: cargo -Zminimal-versions generate-lockfile
|
|
|
|
- uses: dtolnay/rust-toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
- name: Cache Cargo Dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-on-failure: true
|
|
- name: build
|
|
run: cargo build -v
|
|
- name: test
|
|
if: ${{ matrix.rust != '1.88.0' }}
|
|
run: cargo test -v && cargo doc -v
|
|
|
|
test-platforms:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, macos-26-intel, windows-latest, windows-11-arm]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- name: Cache Cargo Dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-on-failure: true
|
|
- name: test
|
|
run: cargo test -v
|
|
|
|
features:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
feature: ["", deflate, jpeg, lzw, zstd, default, "default,zstd"]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy
|
|
- name: Cargo check
|
|
run: cargo check --features "${{ matrix.feature }}" --no-default-features
|
|
|
|
- name: Cargo clippy
|
|
if: ${{ matrix.feature != '' }}
|
|
run: cargo clippy --no-deps --all-features --all-targets -- -D warnings
|
|
|
|
other_archs:
|
|
# github actions does not support 32-bit or big endian systems directly, but
|
|
# it does support QEMU. so we install qemu, then build and run the tests on
|
|
# emulated systems. NOTE: you can also use this approach to test locally.
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
arch: [powerpc-unknown-linux-gnu, i686-unknown-linux-gnu]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: taiki-e/install-action@cross
|
|
- name: Cache Cargo Dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-on-failure: true
|
|
key: ${{ matrix.arch }}
|
|
- name: Cross-Run Tests using QEMU
|
|
run: cross test --target ${{ matrix.arch }}
|
|
|
|
msrv:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: taiki-e/install-action@cargo-hack
|
|
- name: Check MSRV
|
|
run: cargo hack check --rust-version
|
|
|
|
rustfmt:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt
|
|
- name: Run rustfmt check
|
|
run: cargo fmt -- --check
|
|
|
|
clippy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy
|
|
- run: cargo clippy --all-features --all-targets -- -D warnings
|