Add validation make targets #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Control Plane Validation | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| validate-control-plane: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Show Python version | |
| run: python3 --version | |
| - name: Validate JSON syntax | |
| run: | | |
| python3 - <<'PY' | |
| import json | |
| import pathlib | |
| import sys | |
| failed = False | |
| for root in (pathlib.Path('schemas'), pathlib.Path('examples')): | |
| if not root.exists(): | |
| continue | |
| for path in sorted(root.rglob('*.json')): | |
| try: | |
| json.loads(path.read_text()) | |
| except Exception as exc: | |
| print(f'{path}: invalid JSON: {exc}', file=sys.stderr) | |
| failed = True | |
| if failed: | |
| raise SystemExit(1) | |
| print('JSON syntax validated.') | |
| PY | |
| - name: Validate control-plane examples | |
| run: python3 tools/validate_control_plane_examples.py |