Remove remaining unsafe #965
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 ] | |
pull_request: | |
branches: [ master, main, next ] | |
schedule: | |
- cron: '5 16 * * 6' | |
jobs: | |
test_features: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
features: ['', default, gif, jpeg, png, tiff, ico, pnm, tga, webp, bmp, hdr, dxt, dds, farbfeld, openexr, jpeg_rayon, webp-encoder] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Cache Cargo Dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- 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.61.0", nightly, beta] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Cache Cargo Dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Install MSRV Cargo.lock | |
if: ${{ matrix.rust == '1.61.0' }} | |
run: mv Cargo.lock.msrv Cargo.lock | |
- name: build | |
run: cargo build -v --features webp,webp-encoder | |
- name: test | |
if: ${{ matrix.rust != '1.61.0' }} | |
run: > | |
cargo test -v --features webp,webp-encoder && | |
cargo doc -v --features webp,webp-encoder | |
test_big_endian: | |
# github actions does not support 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: | |
matrix: | |
features: ['', default, webp, webp-encoder] | |
# we are using the cross project for cross compilation to mips: | |
# https://github.com/cross-rs/cross | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install or use cached cross-rs/cross | |
uses: baptiste0928/cargo-install@v1 | |
with: | |
crate: cross | |
- name: Cache Cargo Dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Start Docker (required for cross-rs) | |
run: sudo systemctl start docker | |
- name: Cross-Compile project to powerpc-unknown-linux-gnu | |
run: | | |
cross build --target=powerpc-unknown-linux-gnu --verbose -v --no-default-features --features "$FEATURES" | |
env: | |
FEATURES: ${{ matrix.features }} | |
# https://github.com/cross-rs/cross#supported-targets | |
- name: Cross-Run Tests in powerpc-unknown-linux-gnu using Qemu | |
continue-on-error: true | |
run: | | |
cross test --target powerpc-unknown-linux-gnu --verbose -v --no-default-features --features "$FEATURES" | |
env: | |
FEATURES: ${{ matrix.features }} | |
test_avif: | |
runs-on: ubuntu-latest | |
steps: | |
- name: install-dependencies | |
run: sudo apt update && sudo apt install nasm | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: build | |
run: cargo build -v --no-default-features --features="avif" | |
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@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: build | |
run: cargo build -v --no-default-features --features="avif-decoder" | |
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@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- run: cargo clippy --all-features -- -D warnings | |
env: | |
SYSTEM_DEPS_DAV1D_BUILD_INTERNAL: always | |
build_fuzz_afl: | |
name: "Fuzz targets (afl)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: install-deps | |
run: sudo apt-get -y install clang llvm | |
- name: build | |
run: | | |
cargo install cargo-afl | |
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@v2 | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: build | |
run: | | |
cargo install cargo-fuzz | |
cargo fuzz build | |
- name: fuzz | |
run: | | |
for format in $(cargo fuzz list); do | |
cargo fuzz run "$format" -- -runs=0; | |
done | |
public_private_dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: build | |
run: | | |
mv ./Cargo.toml.public-private-dependencies ./Cargo.toml | |
echo "#![deny(exported_private_dependencies)]" | cat - src/lib.rs > src/lib.rs.0 | |
mv src/lib.rs.0 src/lib.rs | |
cargo check | |
build_benchmarks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: build | |
run: cargo build -v --benches --features=benchmarks | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Run rustfmt check | |
run: cargo fmt -- --check | |
cargo-deny: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: EmbarkStudios/cargo-deny-action@v1 | |
verify_msrv: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install or use cached `cargo-msrv` | |
uses: baptiste0928/cargo-install@v1 | |
with: | |
crate: cargo-msrv | |
- name: Install MSRV Cargo.lock | |
run: mv Cargo.lock.msrv Cargo.lock | |
- name: Verify Minimum Rust Version | |
run: cargo-msrv verify |