Skip to content

Commit

Permalink
try: fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ssddOnTop committed Nov 7, 2024
1 parent eb5a1fc commit 6943d0f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI
env:
RUSTFLAGS: -D Warnings
RUSTFLAGS: -DWarnings
on:
push:
branches:
Expand All @@ -23,7 +23,8 @@ jobs:
uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable,nightly
toolchain: stable, nightly
components: clippy, rustfmt
- run: cargo test --all-features --workspace
- run: cargo +nightly fmt --check
- run: cargo +nightly clippy --all-features --workspace
5 changes: 3 additions & 2 deletions workspace/gh-workflow-gen/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use gh_workflow::{Job, Permissions, RustFlags, Step, Toolchain, Workflow};
use gh_workflow::{Component, Job, Permissions, RustFlags, Step, Toolchain, Workflow};

fn main() {
let rust_flags = RustFlags::deny("Warnings");
Expand All @@ -8,7 +8,8 @@ fn main() {
.add_step(
Step::setup_rust()
.add_toolchain(Toolchain::Stable)
.add_toolchain(Toolchain::Nightly),
.add_toolchain(Toolchain::Nightly)
.components(vec![Component::Clippy, Component::Rustfmt]),
)
.add_step(Step::cargo("test", vec!["--all-features", "--workspace"]))
.add_step(Step::cargo_nightly("fmt", vec!["--check"]))
Expand Down
12 changes: 6 additions & 6 deletions workspace/gh-workflow/src/rust_flag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ impl Display for RustFlags {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
RustFlags::Lint(name, lint) => match lint {
Lint::Allow => write!(f, "-A {}", name),
Lint::Warn => write!(f, "-W {}", name),
Lint::Deny => write!(f, "-D {}", name),
Lint::Forbid => write!(f, "-F {}", name),
Lint::Codegen => write!(f, "-C {}", name),
Lint::Experiment => write!(f, "-Z {}", name),
Lint::Allow => write!(f, "-A{}", name),
Lint::Warn => write!(f, "-W{}", name),
Lint::Deny => write!(f, "-D{}", name),
Lint::Forbid => write!(f, "-F{}", name),
Lint::Codegen => write!(f, "-C{}", name),
Lint::Experiment => write!(f, "-Z{}", name),
},
RustFlags::Combine(lhs, rhs) => write!(f, "{} {}", lhs, rhs),
}
Expand Down
7 changes: 4 additions & 3 deletions workspace/gh-workflow/src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl Toolchain {
}
}

#[derive(Clone)]
#[derive(Clone, Debug)]
pub enum Component {
Clippy,
Rustfmt,
Expand Down Expand Up @@ -172,7 +172,7 @@ impl AddStep for ToolchainStep {
format!("{}.{}.{}", major, minor, patch)
}
})
.reduce(|acc, a| format!("{},{}", acc, a));
.reduce(|acc, a| format!("{}, {}", acc, a));

if let Some(toolchain) = toolchain {
step = step.with(("toolchain", toolchain));
Expand All @@ -195,7 +195,8 @@ impl AddStep for ToolchainStep {
.components
.iter()
.map(|c| c.to_string())
.fold("".to_string(), |acc, a| format!("{},{}", acc, a));
.reduce(|acc, a| format!("{}, {}", acc, a))
.unwrap_or_default();

step = step.with(("components", components));
}
Expand Down

0 comments on commit 6943d0f

Please sign in to comment.