Skip to content

Commit 08be773

Browse files
authored
Enabling Cirro validation for a specific resource in Makefile (#291)
1 parent 575d3e5 commit 08be773

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

.github/scripts/validate_cirro.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,46 @@ def validate_cirro_dir(cirro_dir):
124124

125125

126126
def main():
127+
import argparse
128+
129+
parser = argparse.ArgumentParser(description="Validate .cirro configurations in WILDS pipelines.")
130+
parser.add_argument("name", nargs="?", default=None,
131+
help="Specific pipeline name to validate (e.g., ww-star-salmon). "
132+
"If omitted, validates all pipelines.")
133+
args = parser.parse_args()
134+
127135
pipelines_dir = Path("pipelines")
128136
if not pipelines_dir.exists():
129137
print("No pipelines directory found")
130138
return 0
131139

140+
# If a specific name is given, only validate that pipeline
141+
if args.name:
142+
pipeline_dir = pipelines_dir / args.name
143+
if not pipeline_dir.is_dir():
144+
# Could be a module — modules don't have .cirro dirs, so skip silently
145+
print(f"Skipping {args.name} (not a pipeline or no pipeline directory found)")
146+
return 0
147+
148+
cirro_dir = pipeline_dir / ".cirro"
149+
if not cirro_dir.is_dir():
150+
print(f"Skipping {args.name} (no .cirro directory)")
151+
return 0
152+
153+
print(f"Validating {args.name}/.cirro/ ...")
154+
errors = validate_cirro_dir(cirro_dir)
155+
if errors:
156+
print(f" FAIL ({len(errors)} issue(s))")
157+
print(f"\n{'='*50}")
158+
print(f"Cirro validation failed for {args.name}:\n")
159+
for error in errors:
160+
print(error)
161+
return 1
162+
else:
163+
print(f" OK")
164+
print(f"\nAll Cirro configurations valid!")
165+
return 0
166+
132167
found_any = False
133168
all_errors = {}
134169

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,13 @@ lint_womtool: check_java check_womtool check_name ## Run WOMtool validate on mod
146146
done
147147

148148

149-
lint_cirro: ## Validate .cirro configurations in pipelines
149+
lint_cirro: check_name ## Validate .cirro configurations in pipelines (use NAME=foo for specific item)
150150
@echo "Validating Cirro configurations..."
151-
@python3 .github/scripts/validate_cirro.py
151+
@if [ "$(NAME)" != "*" ]; then \
152+
python3 .github/scripts/validate_cirro.py $(NAME); \
153+
else \
154+
python3 .github/scripts/validate_cirro.py; \
155+
fi
152156

153157
lint: lint_sprocket lint_miniwdl lint_womtool lint_cirro ## Run all linting checks
154158

0 commit comments

Comments
 (0)