ci: Make sure compiling for wasm works

This commit is contained in:
Jonas Platte 2022-04-20 17:27:45 +02:00 committed by Jonas Platte
parent 4f65489e8d
commit d73f84ebcc

View File

@ -54,6 +54,8 @@ pub enum CiCmd {
NightlyFull,
/// Lint default features with clippy (nightly)
ClippyDefault,
/// Lint ruma-common with clippy on a wasm target (nightly)
ClippyWasm,
/// Lint almost all features with clippy (nightly)
ClippyAll,
/// Run all lints that don't need compilation
@ -102,6 +104,7 @@ impl CiTask {
Some(CiCmd::Fmt) => self.fmt()?,
Some(CiCmd::NightlyFull) => self.nightly_full()?,
Some(CiCmd::ClippyDefault) => self.clippy_default()?,
Some(CiCmd::ClippyWasm) => self.clippy_wasm()?,
Some(CiCmd::ClippyAll) => self.clippy_all()?,
Some(CiCmd::Lint) => self.lint()?,
Some(CiCmd::Dependencies) => self.dependencies()?,
@ -203,6 +206,7 @@ impl CiTask {
self.fmt()?;
self.nightly_full()?;
self.clippy_default()?;
self.clippy_wasm()?;
self.clippy_all()
}
@ -244,6 +248,21 @@ impl CiTask {
.map_err(Into::into)
}
/// Lint ruma-common with clippy with the nightly version and wasm target.
///
/// ruma-common is currently the only crate with wasm-specific code. If that changes, this
/// method should be updated.
fn clippy_wasm(&self) -> Result<()> {
cmd!(
"
rustup run {NIGHTLY} cargo clippy --target wasm32-unknown-unknown
-p ruma-common --features api,events,js,markdown,rand
"
)
.run()
.map_err(Into::into)
}
/// Lint almost all features with clippy with the nightly version.
fn clippy_all(&self) -> Result<()> {
cmd!(