ci: Check that all features that are used exist

With the new `check-cfg=features` option
This commit is contained in:
Kévin Commaille 2022-05-20 11:37:00 +02:00 committed by Kévin Commaille
parent 1c90770d93
commit 6f7bb9aa1d
2 changed files with 16 additions and 0 deletions

View File

@ -23,6 +23,9 @@ jobs:
- name: Full Features
cmd: nightly-full
- name: All Features
cmd: nightly-all
- name: Clippy Default Features
cmd: clippy-default
components: clippy

View File

@ -52,6 +52,8 @@ pub enum CiCmd {
Fmt,
/// Check ruma crate with `full` features (nightly)
NightlyFull,
/// Check all crates with all features (nightly)
NightlyAll,
/// Lint default features with clippy (nightly)
ClippyDefault,
/// Lint ruma-common with clippy on a wasm target (nightly)
@ -103,6 +105,7 @@ impl CiTask {
Some(CiCmd::Nightly) => self.nightly()?,
Some(CiCmd::Fmt) => self.fmt()?,
Some(CiCmd::NightlyFull) => self.nightly_full()?,
Some(CiCmd::NightlyAll) => self.nightly_all()?,
Some(CiCmd::ClippyDefault) => self.clippy_default()?,
Some(CiCmd::ClippyWasm) => self.clippy_wasm()?,
Some(CiCmd::ClippyAll) => self.clippy_all()?,
@ -220,6 +223,16 @@ impl CiTask {
cmd!("rustup run {NIGHTLY} cargo check -p ruma --features full").run().map_err(Into::into)
}
/// Check all crates with all features with the nightly version.
///
/// Also checks that all features that are used in the code exist.
fn nightly_all(&self) -> Result<()> {
cmd!("rustup run {NIGHTLY} cargo check --workspace --all-features -Z unstable-options -Z check-cfg=features")
.env("RUSTFLAGS", "-D warnings")
.run()
.map_err(Into::into)
}
/// Check ruma-common with `ruma_identifiers_storage="Box"`
fn msrv_owned_id_box(&self) -> Result<()> {
cmd!("rustup run {MSRV} cargo check -p ruma-common")