pest icon indicating copy to clipboard operation
pest copied to clipboard

Better CI hygiene follow-up

Open tomtau opened this issue 3 years ago • 4 comments

My current understanding of best practice is different from what we're currently doing here, though. Probably in a follow-up, it would be better practice to have

  • check
    • +pin-nightly generate-lockfile -Zminimal-versions
    • +pin bootstrap --locked
    • +msrv check --locked
  • lint
    • +pin-nightly generate-lockfile -Zminimal-versions
    • +pin bootstrap --locked
    • +pin clippy --locked -Dwarnings
    • +pin fmt --check
  • test
    • +pin-nightly generate-lockfile -Zminimal-versions
    • +pin bootstrap --locked
    • +pin-stable test --locked
  • future (allow-fail)
    • +beta generate-lockfile
    • +beta bootstrap --locked
    • +beta test --locked

The goal is to avoid anything changing between CI runs except the local code.

Originally posted by @CAD97 in https://github.com/pest-parser/pest/pull/654#discussion_r922438938

tomtau avatar Jul 16 '22 05:07 tomtau

An additional challenge mode: we'd prefer if we can generate code which is warning free on all versions MSRV+, and it'd also be nice to test that the project compiles on all versions in the supported range.

cargo-hack may be of interest. For practicality reasons, I'd suggest checking a rolling stable-3 or stable-6 with hack rather than all the way down to MSRV.

But also this is probably way overengineered of a CI pipeline for what we actually need for the project (which is to be aware of MSRV bumps and run tests/lints/fmt on a recent ish toolchain)

CAD97 avatar Jul 19 '22 19:07 CAD97

@CAD97 any good references for CI pipelines? tokio is using cargo hack for testing features: https://github.com/tokio-rs/tokio/blob/master/.github/workflows/ci.yml#L94 but they don't test the version ranges.

tomtau avatar Jul 20 '22 00:07 tomtau

Tracing does check the version range; I have a separate repo component with a workflow derived from tracing's workflow; it's --version-range to test a range of versions.

If we're updating the CI pipeline, it's probably best to move off of actions-rs (unmaintained) and to either just using run: rustup or dtolnay/rust-toolchain instead.

CAD97 avatar Jul 20 '22 00:07 CAD97

One more thing to add is to test no_std support: https://github.com/pest-parser/pest/issues/409#issuecomment-1184548309

  • https://github.com/hobofan/cargo-nono
  • https://blog.dbrgn.ch/2019/12/24/testing-for-no-std-compatibility/
  • or this: rustup run nightly -- cargo build -j1 -Z build-std=core,alloc --target x86_64-unknown-linux-gnu should fail to compile if any dependency uses std

tomtau avatar Jul 22 '22 15:07 tomtau