Skip to content

Commit

Permalink
Update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Oct 8, 2023
1 parent 9bc5858 commit e161f20
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MOON_PROJECT_ID=node
MOON_PROJECT_ROOT=<WORKSPACE>/base
MOON_PROJECT_SNAPSHOT=<WORKSPACE>/.moon/cache/states/node/snapshot.json
MOON_PROJECT_SOURCE=base
MOON_RUNNING_ACTION=run-target
MOON_RUNNING_ACTION=run-task
MOON_TARGET=node:envVarsMoon
MOON_TOOLCHAIN_DIR=~/.proto
MOON_WORKING_DIR=<WORKSPACE>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MOON_PROJECT_ID=rust
MOON_PROJECT_ROOT=<WORKSPACE>
MOON_PROJECT_SNAPSHOT=<WORKSPACE>/.moon/cache/states/rust/snapshot.json
MOON_PROJECT_SOURCE=.
MOON_RUNNING_ACTION=run-target
MOON_RUNNING_ACTION=run-task
MOON_TARGET=rust:envVarsMoon
MOON_TOOLCHAIN_DIR=~/.proto
MOON_WORKING_DIR=<WORKSPACE>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MOON_PROJECT_ID=unix
MOON_PROJECT_ROOT=<WORKSPACE>/unix
MOON_PROJECT_SNAPSHOT=<WORKSPACE>/.moon/cache/states/unix/snapshot.json
MOON_PROJECT_SOURCE=unix
MOON_RUNNING_ACTION=run-target
MOON_RUNNING_ACTION=run-task
MOON_TARGET=unix:envVarsMoon
MOON_TOOLCHAIN_DIR=~/.proto
MOON_WORKING_DIR=<WORKSPACE>
Expand Down
17 changes: 9 additions & 8 deletions crates/core/action-pipeline/src/actions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::env;

pub mod install_deps;
pub mod run_target;
pub mod run_task;
pub mod setup_tool;
pub mod sync_project;
pub mod sync_workspace;
Expand Down Expand Up @@ -30,13 +30,14 @@ fn matches_pattern(value: &str, pattern: &str) -> bool {
let mut right = value.split(':');

return match ((left.next(), left.next()), (right.next(), right.next())) {
#[allow(clippy::nonminimal_bool)]
((Some(a1), Some(a2)), (Some(b1), Some(b2))) => {
// foo:bar == foo:bar
a1 == b1 && a2 == b2 ||
// foo:bar == foo:*
a1 == b1 && b2 == "*" ||
// foo:bar == *:bar
a2 == b2 && b1 == "*"
// foo:bar == foo:*
a1 == b1 && b2 == "*" ||
// foo:bar == *:bar
a2 == b2 && b1 == "*"
}
((Some(a1), Some(_)), (Some(b1), None)) => {
// foo:bar == foo
Expand Down Expand Up @@ -66,8 +67,8 @@ mod tests {
assert!(!matches_pattern("rust", "node:20.0.0"));
assert!(!matches_pattern("node:19.0.0", "node:20.0.0"));

assert!(matches_pattern("foo", "foo,bar"));
assert!(matches_pattern("bar", "foo,bar"));
assert!(!matches_pattern("baz", "foo,bar"));
assert!(matches_pattern("foo,bar", "foo"));
assert!(matches_pattern("foo,bar", "bar"));
assert!(!matches_pattern("foo,bar", "baz"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use std::env;
use std::sync::Arc;
use tokio::sync::RwLock;

const LOG_TARGET: &str = "moon:action:run-target";
const LOG_TARGET: &str = "moon:action:run-task";

pub async fn run_target(
pub async fn run_task(
action: &mut Action,
context: Arc<RwLock<ActionContext>>,
emitter: Arc<RwLock<Emitter>>,
Expand All @@ -24,7 +24,7 @@ pub async fn run_target(
target: &Target,
runtime: &Runtime,
) -> miette::Result<ActionStatus> {
env::set_var("MOON_RUNNING_ACTION", "run-target");
env::set_var("MOON_RUNNING_ACTION", "run-task");

let emitter = emitter.read().await;
let workspace = workspace.read().await;
Expand All @@ -33,7 +33,7 @@ pub async fn run_target(

debug!(
target: LOG_TARGET,
"Running target {}",
"Running task {}",
color::label(&task.target)
);

Expand Down
4 changes: 2 additions & 2 deletions crates/core/action-pipeline/src/processor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::actions::install_deps::install_deps;
use crate::actions::run_target::run_target;
use crate::actions::run_task::run_task;
use crate::actions::setup_tool::setup_tool;
use crate::actions::sync_project::sync_project;
use crate::actions::sync_workspace::sync_workspace;
Expand Down Expand Up @@ -178,7 +178,7 @@ pub async fn process_action(

local_emitter.emit(Event::TargetRunning { target }).await?;

let run_result = run_target(
let run_result = run_task(
&mut action,
context,
emitter,
Expand Down
2 changes: 1 addition & 1 deletion crates/node/platform/src/actions/run_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustc_hash::FxHashMap;
use starbase_styles::color;
use std::path::Path;

const LOG_TARGET: &str = "moon:node-platform:run-target";
const LOG_TARGET: &str = "moon:node-platform:run-task";

fn create_node_options(
node_config: &NodeConfig,
Expand Down
7 changes: 7 additions & 0 deletions website/src/utils/renderGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ export function renderGraph(element: HTMLElement, graph: cytoscape.ElementsDefin
width: 60,
},
},
{
selector: 'node[type="run-task"], node[type="sm"]',
style: {
// @ts-expect-error Types incorrect
'background-gradient-stop-colors': '#6e58d1 #4a2ec6 #3b259e',
},
},
{
selector: 'node[type="run-target"], node[type="sm"]',
style: {
Expand Down

0 comments on commit e161f20

Please sign in to comment.