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 std::path::PathBuf;
|
||||||
|
|
||||||
|
use xshell::pushd;
|
||||||
|
|
||||||
use crate::{cmd, Result};
|
use crate::{cmd, Result};
|
||||||
|
|
||||||
const MSRV: &str = "1.45";
|
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.
|
/// Task to run CI tests.
|
||||||
pub struct CiTask {
|
pub struct CiTask {
|
||||||
/// Which version of Rust to test against.
|
/// Which version of Rust to test against.
|
||||||
@ -29,59 +26,90 @@ impl CiTask {
|
|||||||
let _p = xshell::pushd(&self.project_root)?;
|
let _p = xshell::pushd(&self.project_root)?;
|
||||||
|
|
||||||
match self.version.as_deref() {
|
match self.version.as_deref() {
|
||||||
Some("msrv") => self.build_msrv(),
|
Some("msrv") => self.build_msrv()?,
|
||||||
Some("stable") => self.build_stable(),
|
Some("stable") => self.build_stable()?,
|
||||||
Some("nightly") => self.build_nightly(),
|
Some("nightly") => self.build_nightly()?,
|
||||||
Some(_) => Err("Wrong Rust version specified.".into()),
|
Some(_) => return Err("Wrong Rust version specified.".into()),
|
||||||
None => {
|
None => {
|
||||||
self.build_msrv()?;
|
self.build_msrv().and(self.build_stable()).and(self.build_nightly())?;
|
||||||
self.build_stable()?;
|
|
||||||
self.build_nightly()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn build_msrv(&self) -> Result<()> {
|
|
||||||
run_in!("ruma", "rustup run {MSRV} cargo build --features full --quiet");
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_stable(&self) -> Result<()> {
|
fn build_msrv(&self) -> xshell::Result<()> {
|
||||||
cmd!("rustup run stable cargo test --workspace --quiet").run()?;
|
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")?;
|
let _p = pushd("ruma-identifiers")?;
|
||||||
cmd!("rustup run stable cargo test --no-default-features --quiet").run()?;
|
r.push(cmd!("rustup run stable cargo test --no-default-features --quiet").run());
|
||||||
cmd!("rustup run stable cargo test --all-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")?;
|
let _p = pushd("ruma-client-api");
|
||||||
cmd!("rustup run stable cargo check --no-default-features --features http1,http2 --quiet")
|
r.push(cmd!("rustup run stable cargo test --all-features --quiet").run());
|
||||||
.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()?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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<()> {
|
fn build_nightly(&self) -> xshell::Result<()> {
|
||||||
cmd!("rustup run nightly cargo fmt --all").run()?;
|
let mut r = Vec::new();
|
||||||
run_in!(
|
r.push(cmd!("rustup run nightly cargo fmt --all").run());
|
||||||
"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"
|
|
||||||
);
|
|
||||||
|
|
||||||
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