Skip to content

Commit

Permalink
Update tools/ci to use newer xshell (#69)
Browse files Browse the repository at this point in the history
Xshell 1.0 is not compatible with nightly rust, and may not be comatible with upcoming stable rust versions. See matklad/xshell#97
  • Loading branch information
CosterM authored Dec 3, 2024
1 parent 3903271 commit 8acd123
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
1 change: 0 additions & 1 deletion macros/src/abilitylike.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use syn::{DeriveInput, Ident};
/// This approach and implementation is inspired by the `strum` crate,
/// Copyright (c) 2019 Peter Glotfelty
/// available under the MIT License at https://github.com/Peternator7/strum
pub(crate) fn abilitylike_inner(ast: &DeriveInput) -> TokenStream {
// Splitting the abstract syntax tree
let enum_name = &ast.ident;
Expand Down
1 change: 0 additions & 1 deletion src/premade_pools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pub mod life {
/// # Panics
/// Panics if `current` is greater than `max`.
/// Panics if `current` or max is negative.
pub fn new(current: Life, max: Life, regen_per_second: Life) -> Self {
assert!(current <= max);
assert!(current >= LifePool::MIN);
Expand Down
2 changes: 1 addition & 1 deletion tools/ci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
xshell = "0.1"
xshell = "0.2"
28 changes: 18 additions & 10 deletions tools/ci/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
use xshell::cmd;
use xshell::{cmd, Shell};

fn main() {
// When run locally, results may differ from actual CI runs triggered by
// .github/workflows/ci.yml
// - Official CI runs latest stable
// - Local runs use whatever the default Rust is locally

let sh = Shell::new().unwrap();

// See if any code needs to be formatted
cmd!("cargo fmt --all -- --check")
cmd!(sh, "cargo fmt --all -- --check")
.run()
.expect("Please run `cargo fmt --all` to format your code.");

// See if clippy has any complaints.
// - Type complexity must be ignored because we use huge templates for queries
cmd!("cargo clippy --workspace --all-features -- -D warnings -A clippy::type_complexity")
.run()
.expect("Please fix `cargo clippy` errors with all features enabled.");
cmd!(
sh,
"cargo clippy --workspace --all-features -- -D warnings -A clippy::type_complexity"
)
.run()
.expect("Please fix `cargo clippy` errors with all features enabled.");

// Check for errors with no features enabled
cmd!("cargo check --workspace --no-default-features")
cmd!(sh, "cargo check --workspace --no-default-features")
.run()
.expect("Please fix `cargo check` errors with no features enabled .");

// Check for errors with default features enabled
cmd!("cargo check --workspace")
cmd!(sh, "cargo check --workspace")
.run()
.expect("Please fix `cargo check` errors with default features enabled.");

// Check the examples with clippy
cmd!("cargo clippy --examples -- -D warnings -A clippy::type_complexity")
.run()
.expect("Please fix `cargo clippy` errors for the examples.");
cmd!(
sh,
"cargo clippy --examples -- -D warnings -A clippy::type_complexity"
)
.run()
.expect("Please fix `cargo clippy` errors for the examples.");
}

0 comments on commit 8acd123

Please sign in to comment.