moon check [...projects] (or moon c) command will run all build and test tasks for one or many projects. This is a convenience command for verifying the current state of a project, instead of running multiple moon run commands.
How it works
Themoon check command simplifies project verification by:
- Selecting projects - Based on provided IDs,
--allflag, or--closestflag - Filtering tasks - Automatically finds all tasks with
buildortesttype - Building action graph - Creates dependency graph with all selected tasks
- Running tasks - Executes all build and test tasks in topological order
- Failing fast - Stops immediately if any task fails
Arguments
[...id]- List of project IDs or aliases to explicitly check, as defined inprojects.
Options
Inherits all options frommoon exec, and pre-fills with: --on-failure=bail, --upstream=deep.
Project selection
--all- Run check for all projects in the workspace. Use with caution in large workspaces.--closest- Run check for the closest project starting from the current working directory.
Common options
-f,--force- Force run and bypass cache, ignore changed files, and skip affected checks.-i,--interactive- Run the pipeline and tasks interactively.-s,--summary [LEVEL]- Print a summary of all actions that were ran in the pipeline.
Affected options
--affected [BY]- Only check tasks if affected by changed files. Optionally accepts “local” or “remote”.--base <BASE>- Base branch, commit, or revision to compare against.--head <HEAD>- Current branch, commit, or revision to compare with.-g,--include-relations- Include graph relations for affected checks.--status <STATUS>- Filter changed files based on a changed status.--stdin- Accept changed files from stdin for affected checks.
Graph options
--downstream <DEPTH>- Control the depth of downstream dependents. Supportsnone(default),direct,deep.--upstream <DEPTH>- Control the depth of upstream dependencies. Supportsnone,direct,deep(default).
Parallelism options
--job <INDEX>- Index of the current job (0 based).--job-total <TOTAL>- Total amount of jobs to run.
Examples
Check a single project
Check multiple projects
Check closest project
Navigate to a project directory and check it:Check all projects
--all in large workspaces can be very time-consuming. Consider using affected checks instead.
:::
Check only affected projects
Check only projects affected by changed files:Check with summary
Force check without cache
Interactive project selection
Runmoon check without arguments to select projects interactively:
Task types checked
Themoon check command automatically runs tasks with the following types:
- Build tasks - Tasks marked with
type: "build"in task configuration - Test tasks - Tasks marked with
type: "test"in task configuration
Environment variables
The following environment variables can be used as alternatives to command line options:MOON_FORCE- Same as--forceMOON_AFFECTED- Same as--affectedMOON_BASE- Same as--baseMOON_HEAD- Same as--headMOON_INCLUDE_RELATIONS- Same as--include-relationsMOON_JOB- Same as--jobMOON_JOB_TOTAL- Same as--job-totalMOON_SUMMARY- Same as--summary
Configuration
projectsin.moon/workspace.*tasksin.moon/tasks/*tasksinmoon.*tasks.*.typein task configuration