Files
Heimdall/scripts/ci/build-plan.py
T
arnaud.dartois da89cdff2d
Heimdall Gitea / Detect CI scope (pull_request) Successful in 5s
Heimdall Gitea / Build and tests (pull_request) Successful in 19m48s
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Skipped
Heimdall Gitea / Build and scan server image (pull_request) Successful in 8m34s
Heimdall Gitea / Publish versioned installer release (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 2s
ci: build only affected project graphs
Keep the locked solution restore for dependency auditing, then build only affected test projects and uncovered changed source projects. Retain full solution builds for broad changes and non-PR validation.

Refs #314
2026-11-09 16:16:41 +01:00

35 lines
1.0 KiB
Python

#!/usr/bin/env python3
"""Build only the projects selected by test-plan.py after solution restore."""
import json
from pathlib import Path
import subprocess
ROOT = Path(__file__).resolve().parents[2]
PLAN = ROOT / "artifacts" / "tests" / "plan.json"
def main() -> None:
plan = json.loads(PLAN.read_text())
targets = plan.get("build_projects")
if not isinstance(targets, list) or any(not isinstance(target, str) for target in targets):
raise SystemExit("Test plan has an invalid build_projects list")
if not targets:
print("No .NET build targets selected")
return
for target in targets:
path = ROOT / target
if not path.is_file():
raise SystemExit(f"Build target does not exist: {target}")
print(f"Building affected target: {target}", flush=True)
subprocess.run(
["dotnet", "build", target, "-c", "Release", "--no-restore", "-m:2"],
cwd=ROOT,
check=True,
)
if __name__ == "__main__":
main()