Skip to content

fix: add .projectsignore to skip placeholder dirs in CI validation #2

fix: add .projectsignore to skip placeholder dirs in CI validation

fix: add .projectsignore to skip placeholder dirs in CI validation #2

Workflow file for this run

name: Validate Projects
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
validate:
name: Validate project configs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install PyYAML
run: pip install pyyaml
- name: Validate all YAML files
run: |
python - <<'EOF'
import sys, pathlib, yaml
errors = []
for f in pathlib.Path("projects").rglob("*.yaml"):
try:
yaml.safe_load(f.read_text())
except yaml.YAMLError as e:
errors.append(f"{f}: {e}")
if errors:
print("YAML validation errors:")
for e in errors:
print(f" {e}")
sys.exit(1)
print(f"Validated {sum(1 for _ in pathlib.Path('projects').rglob('*.yaml'))} YAML files OK")
EOF
- name: Check machine-profile.yaml exists in each project
run: |
python - <<'EOF'
import sys, pathlib
ignore_file = pathlib.Path(".projectsignore")
ignored = set()
if ignore_file.exists():
for line in ignore_file.read_text().splitlines():
line = line.strip()
if line and not line.startswith("#"):
ignored.add(line)
errors = []
checked = 0
for project in pathlib.Path("projects").iterdir():
if not project.is_dir() or project.name in ignored:
continue
checked += 1
mp = project / "machine-profile.yaml"
if not mp.exists():
errors.append(f"{project}: missing machine-profile.yaml")
if errors:
print("Missing machine-profile.yaml:")
for e in errors:
print(f" {e}")
sys.exit(1)
print(f"All {checked} project(s) have machine-profile.yaml (skipped: {ignored or 'none'})")
EOF
- name: Verify no .anpkg files committed
run: |
count=$(find projects -name "*.anpkg" | wc -l)
if [ "$count" -gt 0 ]; then
echo "ERROR: .anpkg files must not be committed:"
find projects -name "*.anpkg"
exit 1
fi
echo "No .anpkg files found — OK"