Skip to content

Latest commit

 

History

History
150 lines (114 loc) · 4.82 KB

COMMANDS.md

File metadata and controls

150 lines (114 loc) · 4.82 KB

Commands

Copy-paste commands for working on heifer. Run them from the repository root. Rules and context: CONTRIBUTING.md.

Before every push (the CI gates)

cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
# Decode-only builds, without the encoder: what downstream decoders depend on.
cargo clippy -p heifer --no-default-features --all-targets -- -D warnings
cargo clippy -p heifer --no-default-features --features image --all-targets -- -D warnings
./scripts/fetch-fixtures.sh   # once: tests that need real files skip when they are missing
cargo test --workspace --all-features
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps
rustup target add wasm32-unknown-unknown   # once
cargo build --workspace --target wasm32-unknown-unknown

All of it in one line:

cargo fmt --all --check && cargo clippy --workspace --all-targets --all-features -- -D warnings && cargo clippy -p heifer --no-default-features --all-targets -- -D warnings && cargo test --workspace --all-features && RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps && cargo build --workspace --target wasm32-unknown-unknown

Targeted tests

cargo test -p heifer-av1-dec --test av1_streams       # small AV1 streams vs aomdec
cargo test -p heifer-av1-dec --test dav1d_corpus      # AV1 items vs dav1d
cargo test -p heifer --test dav1d_rgb                 # AVIF after RGB conversion vs dav1d
cargo test -p heifer --test decode <test_name>        # one end-to-end decode test
cargo test -p heifer-hevc-dec --test fuzz_regressions # replay saved HEVC fuzz crashes
cargo test -p heifer-isobmff                          # container parser

Fuzzing and regressions

rustup toolchain install nightly && cargo install cargo-fuzz   # once
./scripts/fetch-fuzz-corpus.sh                                 # once: libheif seeds
ls fuzz/fuzz_targets                                           # target names
./scripts/fuzz.sh 30m <target>   # after touching a parser
./scripts/fuzz.sh 8h             # every target, all cores

A crash lands in fuzz/artifacts/<target>/. Replay it, shrink it, then keep it:

cd fuzz && cargo +nightly fuzz run <target> artifacts/<target>/<crash-file>
cd fuzz && cargo +nightly fuzz tmin <target> artifacts/<target>/<crash-file>
cp fuzz/artifacts/<target>/<minimized-file> fuzz/regressions/<target>/

Count a session run on your machine or a VPS in the README table (Local column; the badge counts CI only), then commit the two files:

./scripts/fuzz-hours.py --add <target> <hours>   # e.g. --add hevc 8 after ./scripts/fuzz.sh 8h hevc
git add -- docs/fuzz-stats.json && git commit -m "chore(fuzz): add local fuzzing hours" -- docs/fuzz-stats.json && git push
git add -- README.md && git commit -m "docs(readme): update fuzzing hours table" -- README.md && git push

./scripts/fuzz.sh 8h without a target runs every target in parallel for 8 hours: add 8 to each.

for t in $(ls fuzz/fuzz_targets | sed 's/\.rs$//'); do ./scripts/fuzz-hours.py --add "$t" 8; done

Files in fuzz/regressions/ seed scripts/fuzz.sh and are replayed by tests (heifer-hevc-dec/tests/fuzz_regressions.rs, heifer/tests/sequence.rs).

Conformance

# HEVC: reference picture hashes, then byte comparison with ffmpeg.
./scripts/fetch-conformance.sh   # about 23 MB from itu.int
cargo test --release -p heifer-hevc-dec --test conformance
cargo build --release -p heifer-hevc-dec --example decode
./scripts/conformance.py         # optional filter: ./scripts/conformance.py <name>
# Regenerate the small AV1 test streams (needs ffmpeg, aomenc, aomdec).
./scripts/make-av1-streams.sh

Benchmarks (idle machine: no fuzzing, no build)

./scripts/fetch-real.sh
cargo build --release -p heifer --example bench
./scripts/bench.py               # writes docs/benchmark.json

CLI and demo

cargo run --release -p heifer-cli -- IMG_1234.heic photo.jpg
cargo run --release -p heifer-cli -- info IMG_1234.heic
cargo run --release -p heifer-cli -- *.HEIC --to png -o out
cargo run --release -p heifer-cli -- --help
./scripts/build-demo.sh && python3 -m http.server -d demo/web 8000

Git and releases

# One commit and push per file (git-guard blocks add -A, commit -a, push -f).
git add -- <file> && git commit -m "type(scope): message" -- <file> && git push
git pull --rebase --autostash origin main   # push rejected because main moved
gh run list --limit 5   # latest CI runs
gh run watch            # follow a run live
# Release: the tag starts the Release workflow (GitHub release + crates.io).
git tag -a vX.Y.Z -m "X.Y.Z — what changed" && git push origin vX.Y.Z