xilem/.github
Kaur Kuut 91b23431cd
Add more robust `debug_assertions` verification to CI. (#751)
When a workspace uses `debug_assertions` for conditional compilation
(*like Xilem does*), especially of the `#[cfg(debug_assertions)]` kind,
it is not sufficient to just test with it either set to `true` or
`false`. Both need testing as we don't know in advance which path
contains faulty code.

An initial response to this issue was done in #431 which added some
`--release --all-targets` steps to the CI.

This PR here improves that verification in some key ways:
* In addition to the stable toolchain, also verify MSRV.
* Only turn off the `debug_assertions` configuration option as that is
the differentiator for our testing. The full `--release` option spends
time on optimizations. It may be worth doing occasional `--release`
tests to detect bugs in code optimization, but those checks aren't worth
it as part of the `cargo clippy` / `cargo check` bundle we run most
frequently.
* No longer use `--all-targets` which has known issues as explained in
the rationale section of the CI script. Instead we duplicate the regular
steps with `cargo-hack`.
* External dependencies are always built with `debug_assertions` set to
`true` which allows for cache reuse. This is a trade-off. I think the
cache reuse performance gains are worth it for regular CI runs. However
some external dependency might e.g. sneak in a higher MSRV requirement
into a `#[cfg(not(debug_assertions))]` block. Unlikely but possible.
This is again where a less frequent `--release` check would help. Maybe
scheduled, maybe just before publishing a new version. In any case,
future work.

Additionally there is a new env variable `USING_DEBUG_ASSERTIONS` and a
presence verification script `debug_assertions.sh`. These in combination
make the CI script generic across workspaces regardless of
`debug_assertions` usage. The env variable dictates whether we will
spend the time doing the extra compiling. The bash script will detect if
the variable goes out of sync with actual usage in code.
2024-11-22 13:05:24 +00:00
..
workflows Add more robust `debug_assertions` verification to CI. (#751) 2024-11-22 13:05:24 +00:00
copyright.sh Standardize copyright headers. (#246) 2024-05-03 08:50:39 +00:00
debug_assertions.sh Add more robust `debug_assertions` verification to CI. (#751) 2024-11-22 13:05:24 +00:00