Tests and docs #31
This file contains hidden or 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: Tests, doc tests, MIRI, violations coverage | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| # Cargo.toml has "rust-version" (MSRV) 1.31. But, 1.37 is the oldest Alpine docker image. See | |
| # https://hub.docker.com/_/rust/tags?name=alpine&ordering=-last_updated. | |
| # | |
| # rust:1.37-alpine was failing some GitHub's extra checks: | |
| # https://github.com/peter-lyons-kehl/prudent/actions/runs/18773758118/job/53563574851 | |
| # | |
| # Other Rust Alpine images that I've tried and they failed: rust:1.54.0-alpine. | |
| # | |
| # Also, our tests use usize::unchecked_add, which was stabilized in Rust 1.79. | |
| # | |
| # However, with Rust 1.88.0 or older, we were getting false positive errors from `cargo test`, | |
| # reporting constants in doctests as unused, even though they were used. That's why we need at | |
| # least 1.89. | |
| container: rust:1.89.0-alpine | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: rustup components | |
| shell: sh | |
| run: | | |
| rustup component add clippy rustfmt | |
| rustup install nightly --profile minimal | |
| rustup +nightly component add miri | |
| - name: Clippy, fmt | |
| shell: sh | |
| run: | | |
| cargo clippy | |
| cargo fmt --check | |
| cd violations_coverage/format_files | |
| cargo fmt --check | |
| - name: Doc (stable, nightly) | |
| shell: sh | |
| run: | | |
| cargo doc --no-deps --quiet | |
| RUSTDOCFLAGS="--forbid rustdoc::invalid_codeblock_attributes \ | |
| --forbid rustdoc::missing_doc_code_examples \ | |
| -Zcrate-attr=feature(rustdoc_missing_doc_code_examples)" \ | |
| cargo +nightly doc --no-deps --quiet | |
| - name: Tests (debug, release, MIRI) | |
| shell: sh | |
| run: | | |
| cargo test | |
| # We need "cargo +nightly test" to validate error numbers, see src/lib.rs. | |
| cargo +nightly test | |
| cargo test --release | |
| cargo +nightly miri test |