xtask: Don't short-circuit on ci failure
This commit is contained in:
parent
48c71dbe4d
commit
cdcefa1e53
116
xtask/src/ci.rs
116
xtask/src/ci.rs
@ -1,16 +1,13 @@
|
||||
#![allow(clippy::vec_init_then_push)]
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use xshell::pushd;
|
||||
|
||||
use crate::{cmd, Result};
|
||||
|
||||
const MSRV: &str = "1.45";
|
||||
|
||||
macro_rules! run_in {
|
||||
($dir:expr, $($c:tt),+ $(,)?) => {{
|
||||
let _p = xshell::pushd($dir)?;
|
||||
$(super::cmd!($c).run()?;)+
|
||||
}};
|
||||
}
|
||||
|
||||
/// Task to run CI tests.
|
||||
pub struct CiTask {
|
||||
/// Which version of Rust to test against.
|
||||
@ -29,59 +26,90 @@ impl CiTask {
|
||||
let _p = xshell::pushd(&self.project_root)?;
|
||||
|
||||
match self.version.as_deref() {
|
||||
Some("msrv") => self.build_msrv(),
|
||||
Some("stable") => self.build_stable(),
|
||||
Some("nightly") => self.build_nightly(),
|
||||
Some(_) => Err("Wrong Rust version specified.".into()),
|
||||
Some("msrv") => self.build_msrv()?,
|
||||
Some("stable") => self.build_stable()?,
|
||||
Some("nightly") => self.build_nightly()?,
|
||||
Some(_) => return Err("Wrong Rust version specified.".into()),
|
||||
None => {
|
||||
self.build_msrv()?;
|
||||
self.build_stable()?;
|
||||
self.build_nightly()
|
||||
self.build_msrv().and(self.build_stable()).and(self.build_nightly())?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn build_msrv(&self) -> Result<()> {
|
||||
run_in!("ruma", "rustup run {MSRV} cargo build --features full --quiet");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn build_stable(&self) -> Result<()> {
|
||||
cmd!("rustup run stable cargo test --workspace --quiet").run()?;
|
||||
fn build_msrv(&self) -> xshell::Result<()> {
|
||||
let _p = pushd("ruma")?;
|
||||
cmd!("rustup run {MSRV} cargo build --features full --quiet").run()
|
||||
}
|
||||
|
||||
fn build_stable(&self) -> xshell::Result<()> {
|
||||
let mut r = Vec::new();
|
||||
r.push(cmd!("rustup run stable cargo test --workspace --quiet").run());
|
||||
|
||||
{
|
||||
let _p = xshell::pushd("ruma-identifiers")?;
|
||||
cmd!("rustup run stable cargo test --no-default-features --quiet").run()?;
|
||||
cmd!("rustup run stable cargo test --all-features --quiet").run()?;
|
||||
let _p = pushd("ruma-identifiers")?;
|
||||
r.push(cmd!("rustup run stable cargo test --no-default-features --quiet").run());
|
||||
r.push(cmd!("rustup run stable cargo test --all-features --quiet").run());
|
||||
}
|
||||
|
||||
run_in!("ruma-client-api", "rustup run stable cargo test --all-features --quiet");
|
||||
|
||||
{
|
||||
let _p = xshell::pushd("ruma-client")?;
|
||||
cmd!("rustup run stable cargo check --no-default-features --features http1,http2 --quiet")
|
||||
.run()?;
|
||||
cmd!("rustup run stable cargo check --no-default-features --features http1,http2,tls-rustls-native-roots --quiet")
|
||||
.run()?;
|
||||
cmd!("rustup run stable cargo check --no-default-features --features http1,http2,tls-rustls-webpki-roots --quiet")
|
||||
.run()?;
|
||||
let _p = pushd("ruma-client-api");
|
||||
r.push(cmd!("rustup run stable cargo test --all-features --quiet").run());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
{
|
||||
let _p = pushd("ruma-client")?;
|
||||
r.push(
|
||||
cmd!(
|
||||
"rustup run stable cargo check
|
||||
--no-default-features --features http1,http2 --quiet"
|
||||
)
|
||||
.run(),
|
||||
);
|
||||
r.push(
|
||||
cmd!(
|
||||
"rustup run stable cargo check
|
||||
--no-default-features --features http1,http2,tls-rustls-native-roots
|
||||
--quiet"
|
||||
)
|
||||
.run(),
|
||||
);
|
||||
r.push(
|
||||
cmd!(
|
||||
"rustup run stable cargo check
|
||||
--no-default-features --features http1,http2,tls-rustls-webpki-roots
|
||||
--quiet"
|
||||
)
|
||||
.run(),
|
||||
);
|
||||
}
|
||||
|
||||
r.into_iter().collect()
|
||||
}
|
||||
|
||||
fn build_nightly(&self) -> Result<()> {
|
||||
cmd!("rustup run nightly cargo fmt --all").run()?;
|
||||
run_in!(
|
||||
"ruma",
|
||||
"rustup run nightly cargo clippy --all-targets --all-features --quiet -- -D warnings"
|
||||
);
|
||||
run_in!(
|
||||
"ruma-client",
|
||||
"rustup run nightly cargo clippy --all-targets --quiet -- -D warnings"
|
||||
);
|
||||
fn build_nightly(&self) -> xshell::Result<()> {
|
||||
let mut r = Vec::new();
|
||||
r.push(cmd!("rustup run nightly cargo fmt --all").run());
|
||||
|
||||
Ok(())
|
||||
{
|
||||
let _p = pushd("ruma");
|
||||
r.push(
|
||||
cmd!(
|
||||
"rustup run nightly cargo clippy
|
||||
--all-targets --all-features --quiet -- -D warnings"
|
||||
)
|
||||
.run(),
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
let _p = pushd("ruma-client");
|
||||
r.push(
|
||||
cmd!("rustup run nightly cargo clippy --all-targets --quiet -- -D warnings").run(),
|
||||
);
|
||||
}
|
||||
|
||||
r.into_iter().collect()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user