Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fc7e8ba
Create a justfile template
hukasu Sep 21, 2025
20d76db
Wrong name on comment
hukasu Sep 21, 2025
9d4e3e3
Add `bevy_a11y`
hukasu Sep 21, 2025
567814f
Add `bevy_android` and meta `clippy_android` recipes
hukasu Sep 21, 2025
60ffb87
Adjustments to parameters and docs on android recipes
hukasu Sep 21, 2025
7115e9c
Add `bevy_animation`
hukasu Sep 21, 2025
5f43af8
Add `bevy_anti_alias`
hukasu Sep 21, 2025
7c3261c
Add a ci recipe for crates/features that require `DLSS_SDK`
hukasu Sep 21, 2025
e3f2549
Convert `bevy_ecs` recipe into `ci` tool
hukasu Sep 21, 2025
5131e7b
Convert `bevy_app` recipe into `ci` tool
hukasu Sep 21, 2025
9a4c2ee
Convert `bevy_animation` recipe into `ci` tool
hukasu Sep 21, 2025
9abcb30
Convert `bevy_a11y` recipe into `ci` tool
hukasu Sep 21, 2025
2ffddb0
Convert `bevy_anti_alias` recipe into `ci` tool
hukasu Sep 21, 2025
1f74c2f
Convert `clippy_dlss` recipe into `ci` tool
hukasu Sep 21, 2025
389ef9c
Fixes to `clippy_permutations`
hukasu Sep 21, 2025
9bf7377
Add `target` argument
hukasu Sep 21, 2025
6d65af0
Fix wrong paramenter returned for `target`
hukasu Sep 21, 2025
0b2e1fd
Add helper to test if target is Android
hukasu Sep 21, 2025
8fb76e7
Convert `clippy_android` and `bevy_android` recipes into `ci` tools
hukasu Sep 21, 2025
7cfcb2a
Add `bevy_android` to release notes
hukasu Sep 21, 2025
9950c9f
Use `target` on clippy permutations
hukasu Sep 21, 2025
e2daf76
Super linter
hukasu Sep 21, 2025
2d2e208
Add PR number
hukasu Sep 21, 2025
6ce3f9a
Linter
hukasu Sep 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions release-content/release-notes/pedantic_ci_commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: Pedantic CI commands
authors: ["@hukasu"]
pull_requests: [21145]
---

New commands were added to CI tool to allow running clippy with multiple permutations of
features. For a crate it is run with:

* `--no-default-features`
* Multiple `--no-default-features --features="..."`
* Default features
* Multiple `--all-features --features="..."`

There are crates that are run with multiple `--all-features` due to them depending
another crate that has a switchable features. Examples are `bevy_image/zstd_c` or
`bevy_image/zstd_rust`, or `bevy_reflect/auto_register_inventory` or `bevy_reflect/auto_register_static`.

## Commands

### `clippys`

This is a meta commands that runs the other clippy permutation commands.

If you are on the workspace, run `cargo run -p ci -- --build-jobs 4 clippys`.

### `clippy_android`

Runs clippy on crates for Android targets. Requires an Android
target.

If you are on the workspace, run `cargo run -p ci -- --build-jobs 4 --target aarch64-linux-android clippy_android`.

### `clippy_dlss`

Runs clippy on crates and features that require the Dlss SDK.

If you are on the workspace, run `cargo run -p ci -- --build-jobs 4 clippy_dlss`.

### `bevy_a11y`

Runs clippy on `bevy_a11y` with multiple feature permutations.

If you are on the workspace, run `cargo run -p ci -- --build-jobs 4 bevy_a11y`.

### `bevy_android`

Runs clippy on `bevy_android` with multiple feature permutations. Requires an Android
target.

If you are on the workspace, run `cargo run -p ci -- --build-jobs 4 --target aarch64-linux-android bevy_android`.

### `bevy_animation`

Runs clippy on `bevy_animation` with multiple feature permutations.

If you are on the workspace, run `cargo run -p ci -- --build-jobs 4 bevy_animation`.

### `bevy_anti_alias`

Runs clippy on `bevy_anti_alias` with multiple feature permutations.

If you are on the workspace, run `cargo run -p ci -- --build-jobs 4 bevy_anti_alias`.

### `bevy_app`

Runs clippy on `bevy_app` with multiple feature permutations.

If you are on the workspace, run `cargo run -p ci -- --build-jobs 4 bevy_app`.

### `bevy_ecs`

Runs clippy on `bevy_ecs` with multiple feature permutations.

If you are on the workspace, run `cargo run -p ci -- --build-jobs 4 bevy_ecs`.
25 changes: 25 additions & 0 deletions tools/ci/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
use crate::CI;

/// Android targets
const ANDROID_TARGETS: &[&str] = &[
"aarch64-linux-android",
// Help expand this
];

/// Arguments that are available to CI commands.
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct Args {
keep_going: bool,
test_threads: Option<usize>,
build_jobs: Option<usize>,
target: Option<&'static str>,
}

impl Args {
Expand All @@ -24,6 +31,20 @@ impl Args {
self.test_threads
.map(|threads| format!("--test-threads={threads}"))
}

#[inline(always)]
pub fn target(&self) -> Option<String> {
self.target.map(|target| format!("--target={target}"))
}

/// Tests if the target is an android target
pub fn is_android_target(&self) -> bool {
if let Some(target) = &self.target {
ANDROID_TARGETS.contains(target)
} else {
cfg!(target_os = "android")
}
}
}

impl From<&CI> for Args {
Expand All @@ -32,6 +53,10 @@ impl From<&CI> for Args {
keep_going: value.keep_going,
test_threads: value.test_threads,
build_jobs: value.build_jobs,
target: value.target.as_ref().map(|string| {
let s: &'static str = string.clone().leak();
s
}),
}
}
}
23 changes: 23 additions & 0 deletions tools/ci/src/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ pub struct CI {
/// number of build jobs
#[argh(option)]
pub(crate) build_jobs: Option<usize>,

/// target to compile to
#[argh(option)]
pub(crate) target: Option<String>,
}

impl CI {
Expand Down Expand Up @@ -75,6 +79,7 @@ impl CI {
let mut cmds = vec![];
cmds.append(&mut commands::FormatCommand::default().prepare(sh, args));
cmds.append(&mut commands::ClippyCommand::default().prepare(sh, args));
cmds.append(&mut commands::ClippysCommand::default().prepare(sh, args));
cmds.append(&mut commands::TestCommand::default().prepare(sh, args));
cmds.append(&mut commands::TestCheckCommand::default().prepare(sh, args));
cmds.append(&mut commands::IntegrationTestCommand::default().prepare(sh, args));
Expand Down Expand Up @@ -105,9 +110,12 @@ enum Commands {
Lints(commands::LintsCommand),
Doc(commands::DocCommand),
Compile(commands::CompileCommand),
Clippys(commands::ClippysCommand),
// Actual subcommands
Format(commands::FormatCommand),
Clippy(commands::ClippyCommand),
ClippyAndroid(commands::ClippyAndroidCommand),
ClippyDlss(commands::ClippyDlssCommand),
Test(commands::TestCommand),
TestCheck(commands::TestCheckCommand),
IntegrationTest(commands::IntegrationTestCommand),
Expand All @@ -119,6 +127,12 @@ enum Commands {
CompileFail(commands::CompileFailCommand),
BenchCheck(commands::BenchCheckCommand),
ExampleCheck(commands::ExampleCheckCommand),
BevyA11y(commands::BevyA11y),
BevyAndroid(commands::BevyAndroid),
BevyAnimation(commands::BevyAnimation),
BevyAntiAlias(commands::BevyAntiAlias),
BevyApp(commands::BevyApp),
BevyEcs(commands::BevyEcs),
}

impl Prepare for Commands {
Expand All @@ -127,9 +141,12 @@ impl Prepare for Commands {
Commands::Lints(subcommand) => subcommand.prepare(sh, args),
Commands::Doc(subcommand) => subcommand.prepare(sh, args),
Commands::Compile(subcommand) => subcommand.prepare(sh, args),
Commands::Clippys(subcommand) => subcommand.prepare(sh, args),

Commands::Format(subcommand) => subcommand.prepare(sh, args),
Commands::Clippy(subcommand) => subcommand.prepare(sh, args),
Commands::ClippyAndroid(subcommand) => subcommand.prepare(sh, args),
Commands::ClippyDlss(subcommand) => subcommand.prepare(sh, args),
Commands::Test(subcommand) => subcommand.prepare(sh, args),
Commands::TestCheck(subcommand) => subcommand.prepare(sh, args),
Commands::IntegrationTest(subcommand) => subcommand.prepare(sh, args),
Expand All @@ -141,6 +158,12 @@ impl Prepare for Commands {
Commands::CompileFail(subcommand) => subcommand.prepare(sh, args),
Commands::BenchCheck(subcommand) => subcommand.prepare(sh, args),
Commands::ExampleCheck(subcommand) => subcommand.prepare(sh, args),
Commands::BevyA11y(subcommand) => subcommand.prepare(sh, args),
Commands::BevyAndroid(subcommand) => subcommand.prepare(sh, args),
Commands::BevyAnimation(subcommand) => subcommand.prepare(sh, args),
Commands::BevyAntiAlias(subcommand) => subcommand.prepare(sh, args),
Commands::BevyApp(subcommand) => subcommand.prepare(sh, args),
Commands::BevyEcs(subcommand) => subcommand.prepare(sh, args),
}
}
}
20 changes: 20 additions & 0 deletions tools/ci/src/commands/bevy_a11y.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use crate::{
args::Args, commands::clippy_permutations::ClippyPermutations, Prepare, PreparedCommand,
};
use argh::FromArgs;

/// Check for clippy warnings and errors on `bevy_a11y`.
#[derive(FromArgs, Default)]
#[argh(subcommand, name = "bevy_a11y")]
pub struct BevyA11y {}

impl Prepare for BevyA11y {
fn prepare<'a>(&self, sh: &'a xshell::Shell, args: Args) -> Vec<PreparedCommand<'a>> {
ClippyPermutations {
crate_name: "bevy_a11y",
features: &["bevy_reflect", "serialize", "std", "critical-section"],
all_features_features: &[],
}
.build::<Self>(sh, args)
}
}
24 changes: 24 additions & 0 deletions tools/ci/src/commands/bevy_android.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use crate::{
args::Args, commands::clippy_permutations::ClippyPermutations, Prepare, PreparedCommand,
};
use argh::FromArgs;

/// Check for clippy warnings and errors on `bevy_android`.
#[derive(FromArgs, Default)]
#[argh(subcommand, name = "bevy_android")]
pub struct BevyAndroid {}

impl Prepare for BevyAndroid {
fn prepare<'a>(&self, sh: &'a xshell::Shell, args: Args) -> Vec<PreparedCommand<'a>> {
if !args.is_android_target() {
panic!("BevyAndroid requires an Android target.");
}

ClippyPermutations {
crate_name: "bevy_android",
features: &[],
all_features_features: &[],
}
.build::<Self>(sh, args)
}
}
20 changes: 20 additions & 0 deletions tools/ci/src/commands/bevy_animation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use crate::{
args::Args, commands::clippy_permutations::ClippyPermutations, Prepare, PreparedCommand,
};
use argh::FromArgs;

/// Check for clippy warnings and errors on `bevy_animation`.
#[derive(FromArgs, Default)]
#[argh(subcommand, name = "bevy_animation")]
pub struct BevyAnimation {}

impl Prepare for BevyAnimation {
fn prepare<'a>(&self, sh: &'a xshell::Shell, args: Args) -> Vec<PreparedCommand<'a>> {
ClippyPermutations {
crate_name: "bevy_animation",
features: &[],
all_features_features: &[],
}
.build::<Self>(sh, args)
}
}
25 changes: 25 additions & 0 deletions tools/ci/src/commands/bevy_anti_alias.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use crate::{
args::Args, commands::clippy_permutations::ClippyPermutations, Prepare, PreparedCommand,
};
use argh::FromArgs;

/// Check for clippy warnings and errors on `bevy_anti_alias`.
#[derive(FromArgs, Default)]
#[argh(subcommand, name = "bevy_anti_alias")]
pub struct BevyAntiAlias {}

impl Prepare for BevyAntiAlias {
fn prepare<'a>(&self, sh: &'a xshell::Shell, args: Args) -> Vec<PreparedCommand<'a>> {
ClippyPermutations {
crate_name: "bevy_anti_alias",
features: &[
"trace",
"smaa_luts bevy_image/zstd_rust",
"smaa_luts bevy_image/zstd_c",
"dlss force_disable_dlss",
],
all_features_features: &["bevy_image/zstd_rust", "bevy_image/zstd_c"],
}
.build::<Self>(sh, args)
}
}
35 changes: 35 additions & 0 deletions tools/ci/src/commands/bevy_app.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use crate::{
args::Args, commands::clippy_permutations::ClippyPermutations, Prepare, PreparedCommand,
};
use argh::FromArgs;

/// Check for clippy warnings and errors on `bevy_app`.
#[derive(FromArgs, Default)]
#[argh(subcommand, name = "bevy_app")]
pub struct BevyApp {}

impl Prepare for BevyApp {
fn prepare<'a>(&self, sh: &'a xshell::Shell, args: Args) -> Vec<PreparedCommand<'a>> {
ClippyPermutations {
crate_name: "bevy_app",
features: &[
"bevy_reflect",
"reflect_functions",
"reflect_auto_register bevy_reflect/auto_register_inventory",
"reflect_auto_register bevy_reflect/auto_register_static",
"trace",
"bevy_debug_stepping",
"error_panic_hook",
"std",
"critical-section",
"web",
"hotpatching",
],
all_features_features: &[
"bevy_reflect/auto_register_inventory",
"bevy_reflect/auto_register_static",
],
}
.build::<Self>(sh, args)
}
}
38 changes: 38 additions & 0 deletions tools/ci/src/commands/bevy_ecs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use crate::{
args::Args, commands::clippy_permutations::ClippyPermutations, Prepare, PreparedCommand,
};
use argh::FromArgs;

/// Check for clippy warnings and errors on `bevy_ecs`.
#[derive(FromArgs, Default)]
#[argh(subcommand, name = "bevy_ecs")]
pub struct BevyEcs {}

impl Prepare for BevyEcs {
fn prepare<'a>(&self, sh: &'a xshell::Shell, args: Args) -> Vec<PreparedCommand<'a>> {
ClippyPermutations {
crate_name: "bevy_ecs",
features: &[
//"multi_threaded",
"serialize",
"bevy_reflect",
"reflect_functions",
"reflect_auto_register bevy_reflect/auto_register_inventory",
"reflect_auto_register bevy_reflect/auto_register_static",
"backtrace",
"trace",
"detailed_trace",
"track_location",
"async_executor",
"std",
"critical-section",
"hotpatching",
],
all_features_features: &[
"bevy_reflect/auto_register_inventory",
"bevy_reflect/auto_register_static",
],
}
.build::<Self>(sh, args)
}
}
21 changes: 21 additions & 0 deletions tools/ci/src/commands/clippy_android.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use crate::{args::Args, commands::BevyAndroid, Prepare, PreparedCommand};
use argh::FromArgs;

/// Check for clippy warnings and errors for Android targets.
#[derive(FromArgs, Default)]
#[argh(subcommand, name = "clippy_android")]
pub struct ClippyAndroidCommand {}

impl Prepare for ClippyAndroidCommand {
fn prepare<'a>(&self, sh: &'a xshell::Shell, args: Args) -> Vec<PreparedCommand<'a>> {
if !args.is_android_target() {
panic!("ClippyAndroidCommand requires an Android target.");
}

let mut commands = Vec::new();

commands.append(&mut BevyAndroid::default().prepare(sh, args));

commands
}
}
Loading
Loading