xtask: Simplify code for ci task

This commit is contained in:
Jonas Platte 2021-05-02 14:02:54 +02:00
parent d53f2ba71b
commit f5955cee9e
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -1,5 +1,3 @@
#![allow(clippy::vec_init_then_push)]
use std::path::PathBuf; use std::path::PathBuf;
use xshell::pushd; use xshell::pushd;
@ -45,51 +43,35 @@ impl CiTask {
} }
fn build_stable(&self) -> xshell::Result<()> { fn build_stable(&self) -> xshell::Result<()> {
let mut r = Vec::new(); vec![
r.push(cmd!("rustup run stable cargo test --workspace --quiet").run()); cmd!("rustup run stable cargo test --workspace --quiet").run(),
cmd!("rustup run stable cargo test -p ruma-identifiers --no-default-features --quiet")
{ .run(),
let _p = pushd("ruma-identifiers")?; cmd!("rustup run stable cargo test -p ruma-identifiers --all-features --quiet").run(),
r.push(cmd!("rustup run stable cargo test --no-default-features --quiet").run()); cmd!("rustup run stable cargo test -p ruma-client-api --all-features --quiet").run(),
r.push(cmd!("rustup run stable cargo test --all-features --quiet").run()); cmd!("rustup run stable cargo check -p ruma-client --no-default-features --quiet")
} .run(),
cmd!("rustup run stable cargo check -p ruma-client --all-features --quiet").run(),
{ ]
let _p = pushd("ruma-client-api"); .into_iter()
r.push(cmd!("rustup run stable cargo test --all-features --quiet").run()); .collect()
}
{
let _p = pushd("ruma-client")?;
r.push(cmd!("rustup run stable cargo check --no-default-features --quiet").run());
r.push(cmd!("rustup run stable cargo check --all-features --quiet").run());
}
r.into_iter().collect()
} }
fn build_nightly(&self) -> xshell::Result<()> { fn build_nightly(&self) -> xshell::Result<()> {
let mut r = Vec::new(); vec![
r.push(cmd!("rustup run nightly cargo fmt -- --check").run()); cmd!("rustup run nightly cargo fmt -- --check").run(),
cmd!(
{ "rustup run nightly cargo clippy -p ruma
let _p = pushd("ruma"); --all-targets --all-features --quiet -- -D warnings"
r.push( )
cmd!( .run(),
"rustup run nightly cargo clippy cmd!(
--all-targets --all-features --quiet -- -D warnings" "rustup run nightly cargo clippy -p ruma-client
) --all-targets --quiet -- -D warnings"
.run(), )
); .run(),
} ]
.into_iter()
{ .collect()
let _p = pushd("ruma-client");
r.push(
cmd!("rustup run nightly cargo clippy --all-targets --quiet -- -D warnings").run(),
);
}
r.into_iter().collect()
} }
} }