Skip to content

Commit

Permalink
new: Implement a brand new task runner. (#1463)
Browse files Browse the repository at this point in the history
* Start on archives.

* More impl work.

* Add task command.

* Add hashing.

* More cache work.

* Add logs.

* Persist cache.

* Add executor.

* Add console.

* Start on reporter.

* Move handles.

* Add default reporter.

* Implement reporter.

* Hook up reporter.

* Fix output.

* Sync outputs.

* Start on command tests.

* Add more tests.

* Rely on fixtures.

* Start on archive tests.

* Finish archive tests.

* Test scenarios.

* Remove old runner.

* Update lints.

* Hook up reporter.

* Improve reporter.

* Add summary.

* Clean up reporter.

* Clean up attempt usage.

* Fix issues.

* More fixes.

* More fixes.

* More fixes.

* Add exec tests.

* Start on new utils.

* Clean up more tests.

* Rework args.

* Start on runner tests.

* Add more tests.

* Test skip and archive.

* Rework archive.

* Rename things.

* Rework run.

* Rename attempt to operation.

* Rework op output.

* Fix package.

* Fix some tests.

* Start on run tests.

* Add more tests.

* Fix some tests.

* Fix webhooks.

* Fixes.

* Fix windows.

* Fix moonbase.
  • Loading branch information
milesj committed May 23, 2024
1 parent b3bb592 commit b67516a
Show file tree
Hide file tree
Showing 178 changed files with 6,226 additions and 2,808 deletions.
2 changes: 1 addition & 1 deletion .yarn/versions/d3fb7bae.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ releases:
'@moonrepo/core-macos-arm64': minor
'@moonrepo/core-macos-x64': minor
'@moonrepo/core-windows-x64-msvc': minor
'@moonrepo/report': patch
'@moonrepo/types': patch

declined:
- '@moonrepo/nx-compat'
- '@moonrepo/report'
- '@moonrepo/runtime'
- website
92 changes: 52 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,7 @@ warpgate_pdk = "0.3.1"
# warpgate = { path = "../proto/crates/warpgate" }
# warpgate_api = { path = "../proto/crates/warpgate-api" }
# warpgate_pdk = { path = "../proto/crates/warpgate-pdk" }

[workspace.lints.clippy]
# Very noisy, lots of false positives!
assigning_clones = "allow"
3 changes: 3 additions & 0 deletions crates/bun/lang/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ cached = { workspace = true }
miette = { workspace = true }
rustc-hash = { workspace = true }
yarn-lock-parser = "0.7.0"

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/bun/platform/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ tokio = { workspace = true }
moon = { path = "../../core/moon" }
moon_project_graph = { path = "../../../nextgen/project-graph" }
moon_test_utils = { path = "../../core/test-utils" }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/bun/tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ miette = { workspace = true }
proto_core = { workspace = true }
rustc-hash = { workspace = true }
starbase_utils = { workspace = true }

[lints]
workspace = true
6 changes: 5 additions & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ moon_codegen = { path = "../../nextgen/codegen" }
moon_common = { path = "../../nextgen/common" }
moon_config = { path = "../../nextgen/config", features = ["template"] }
moon_console = { path = "../../nextgen/console" }
moon_console_reporter = { path = "../../nextgen/console-reporter" }
moon_deno_lang = { path = "../deno/lang" }
moon_deno_tool = { path = "../deno/tool" }
moon_env = { path = "../../nextgen/env" }
Expand Down Expand Up @@ -95,8 +96,11 @@ tracing = { workspace = true }
[dev-dependencies]
moon_cache = { path = "../../nextgen/cache" }
moon_notifier = { path = "../core/notifier" }
moon_runner = { path = "../core/runner" }
moon_task_runner = { path = "../../nextgen/task-runner" }
moon_test_utils = { path = "../core/test-utils" }
httpmock = "0.7.0"
serial_test = "3.0.0"
starbase_archive = { workspace = true }

[lints]
workspace = true
8 changes: 8 additions & 0 deletions crates/cli/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ pub struct CheckArgs {
#[clap(group = "projects")]
all: bool,

#[arg(
long,
short = 's',
help = "Include a summary of all actions that were processed in the pipeline"
)]
pub summary: bool,

#[arg(
short = 'u',
long = "updateCache",
Expand Down Expand Up @@ -77,6 +84,7 @@ pub async fn check(
run_target(
&targets,
&RunArgs {
summary: args.summary,
update_cache: args.update_cache,
..RunArgs::default()
},
Expand Down
23 changes: 8 additions & 15 deletions crates/cli/src/commands/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ pub async fn ci(args: ArgsRef<CiArgs>, global_args: StateRef<GlobalArgs>, resour
}

let results = pipeline
.summarize(true)
.generate_report("ciReport.json")
.run(
action_graph,
Expand All @@ -297,21 +298,13 @@ pub async fn ci(args: ArgsRef<CiArgs>, global_args: StateRef<GlobalArgs>, resour

console.print_footer()?;

// Print out a summary of any failures
console.print_header("Summary")?;

pipeline.render_summary(&results, console.inner)?;

console.print_footer()?;

// Print out the results and exit if an error occurs
console.print_header("Stats")?;

let failed = pipeline.render_results(&results, console.inner)?;

pipeline.render_stats(&results, console.inner, false)?;

console.print_footer()?;
let failed = results.iter().any(|result| {
if result.has_failed() {
!result.allow_failure
} else {
false
}
});

if failed {
return Err(ExitCode(1).into());
Expand Down
12 changes: 9 additions & 3 deletions crates/cli/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ pub struct RunArgs {
#[arg(long, help = "Focus target(s) based on the result of a query")]
pub query: Option<String>,

#[arg(
long,
short = 's',
help = "Include a summary of all actions that were processed in the pipeline"
)]
pub summary: bool,

#[arg(
short = 'u',
long = "updateCache",
Expand Down Expand Up @@ -218,14 +225,13 @@ pub async fn run_target(
pipeline.concurrency(concurrency);
}

let results = pipeline
pipeline
.bail_on_error()
.summarize(args.summary)
.generate_report("runReport.json")
.run(action_graph, Arc::new(console.to_owned()), Some(context))
.await?;

pipeline.render_stats(&results, console, true)?;

Ok(())
}

Expand Down
6 changes: 5 additions & 1 deletion crates/cli/src/systems/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::app::GlobalArgs;
use moon_app_components::{Console, ExtensionRegistry, MoonEnv, ProtoEnv, WorkspaceRoot};
use moon_common::{consts::PROTO_CLI_VERSION, is_test_env, path::exe_name};
use moon_console::Checkpoint;
use moon_console_reporter::DefaultReporter;
use moon_env::MoonEnvironment;
use moon_platform_plugin::PlatformRegistry;
use moon_plugin::{PluginRegistry, PluginType};
Expand All @@ -23,7 +24,10 @@ pub async fn load_environments(states: StatesMut, resources: ResourcesMut) {
states.set(MoonEnv(Arc::new(MoonEnvironment::new()?)));
states.set(ProtoEnv(Arc::new(ProtoEnvironment::new()?)));

resources.set(Console::new(quiet));
let mut console = Console::new(quiet);
console.set_reporter(DefaultReporter::default());

resources.set(console);
}

#[system]
Expand Down
4 changes: 2 additions & 2 deletions crates/cli/tests/run_bun_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ mod bun {
}
}

// Need multiple windows versions for this to work
#[cfg(not(windows))]
mod workspace_overrides {
use super::*;

// Need multiple windows versions for this to work
#[cfg(not(windows))]
#[test]
fn can_override_version() {
let sandbox = bun_sandbox();
Expand Down

0 comments on commit b67516a

Please sign in to comment.