feat: add sccache to the build pipeline #1463
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust CI | |
on: | |
push: | |
branches: [ master, main, next-version-0.25 ] | |
pull_request: | |
branches: [ master, main, next-version-0.25 ] | |
schedule: | |
- cron: '5 16 * * 6' | |
env: | |
CARGO_INCREMENTAL: 0 | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
jobs: | |
test_features: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
features: ['', default, rayon, avif, bmp, dds, exr, ff, gif, hdr, ico, jpeg, png, pnm, qoi, tga, tiff, webp] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Cache Cargo Dependencies | |
uses: mozilla-actions/[email protected] | |
- name: build | |
run: cargo build -v --no-default-features --features "$FEATURES" | |
env: | |
FEATURES: ${{ matrix.features }} | |
- name: test | |
run: > | |
cargo test -v --no-default-features --features "$FEATURES" && | |
cargo doc -v --no-default-features --features "$FEATURES" | |
env: | |
FEATURES: ${{ matrix.features }} | |
test_toolchains: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: ["1.67.1", nightly, beta] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
if: ${{ matrix.rust == '1.67.1' }} | |
- name: Generate Cargo.lock with minimal-version dependencies | |
if: ${{ matrix.rust == '1.67.1' }} | |
run: cargo -Zminimal-versions generate-lockfile | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Cache Cargo Dependencies | |
uses: mozilla-actions/[email protected] | |
- name: build | |
run: cargo build -v | |
- name: test | |
if: ${{ matrix.rust != '1.67.1' }} | |
run: cargo test -v && cargo doc -v | |
test_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 in | |
# an emulated mips system. NOTE: you can also use this approach to test for | |
# big endian locally. | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [powerpc-unknown-linux-gnu, i686-unknown-linux-gnu] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install or use cached cross-rs/cross | |
uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: cross | |
- name: Cache Cargo Dependencies | |
uses: mozilla-actions/[email protected] | |
- name: Start Docker (required for cross-rs) | |
run: sudo systemctl start docker | |
- name: Cross-Run Tests using QEMU | |
run: cross test --target ${{ matrix.arch }} | |
test_avif_decoding: | |
runs-on: ubuntu-latest | |
steps: | |
- name: install-dependencies | |
run: sudo apt update && sudo apt install ninja-build meson nasm | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Cache Cargo Dependencies | |
uses: mozilla-actions/[email protected] | |
- name: build | |
run: cargo build -v --no-default-features --features="avif,avif-native" | |
env: | |
SYSTEM_DEPS_DAV1D_BUILD_INTERNAL: always | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: install-dependencies | |
run: sudo apt update && sudo apt install ninja-build meson nasm | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: clippy | |
- name: Cache Cargo Dependencies | |
uses: mozilla-actions/[email protected] | |
- run: cargo clippy --all-features --all-targets -- -D warnings | |
env: | |
SYSTEM_DEPS_DAV1D_BUILD_INTERNAL: always | |
build_fuzz_afl: | |
name: "Fuzz targets (afl)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: install-deps | |
run: sudo apt-get -y install clang llvm | |
- name: Cache Cargo Dependencies | |
uses: mozilla-actions/[email protected] | |
- name: Install cargo-afl | |
run: cargo install --locked -f cargo-afl | |
- name: build | |
run: | | |
cd fuzz-afl | |
cargo check --bin reproduce_webp | |
cargo check --bin reproduce_pnm | |
cargo afl check --bin fuzz_webp | |
cargo afl check --bin fuzz_pnm | |
env: | |
RUSTFLAGS: "" | |
build_fuzz_cargo-fuzz: | |
name: "Fuzz targets (cargo-fuzz)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: Cache Cargo Dependencies | |
uses: mozilla-actions/[email protected] | |
- name: Install cargo-fuzz | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: cargo-fuzz | |
- name: check | |
run: cargo fuzz check | |
env: | |
CARGO_INCREMENTAL: 0 | |
public_private_dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: Cache Cargo Dependencies | |
uses: mozilla-actions/[email protected] | |
- name: build | |
run: | | |
echo "#![deny(exported_private_dependencies)]" | cat - src/lib.rs > src/lib.rs.0 | |
mv src/lib.rs.0 src/lib.rs | |
echo 'cargo-features = ["public-dependency"]' | cat - Cargo.toml > Cargo.toml.0 | |
mv Cargo.toml.0 Cargo.toml | |
cargo check | |
build_benchmarks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: Cache Cargo Dependencies | |
uses: mozilla-actions/[email protected] | |
- name: build | |
run: cargo build -v --benches --features=benchmarks | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Cache Cargo Dependencies | |
uses: mozilla-actions/[email protected] | |
- name: Run rustfmt check | |
run: cargo fmt -- --check | |
cargo-deny: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: EmbarkStudios/cargo-deny-action@v1 | |
cargo-semver-checks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Cargo Dependencies | |
uses: mozilla-actions/[email protected] | |
- uses: obi1kenobi/cargo-semver-checks-action@v2 | |
with: | |
feature-group: default-features |