mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 21:43:23 -05:00
feat: validate emulator profiles in CI
This commit is contained in:
1 parent
5f60138dce
commit
a0ca5f208a
5 files changed
+155
-15
No files matched your search
@@ -5,6 +5,7 @@ on:
|
||||
paths:
|
||||
- "bios/**"
|
||||
- "platforms/**"
|
||||
- "emulators/**"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -94,6 +95,34 @@ jobs:
|
||||
sys.exit(1)
|
||||
"
|
||||
|
||||
- name: Validate emulator profiles
|
||||
run: |
|
||||
python -c "
|
||||
import json, yaml, sys
|
||||
from jsonschema import validate, ValidationError
|
||||
from pathlib import Path
|
||||
|
||||
with open('schemas/emulator.schema.json') as f:
|
||||
schema = json.load(f)
|
||||
|
||||
errors = []
|
||||
for yml_file in sorted(Path('emulators').glob('*.yml')):
|
||||
if yml_file.name.endswith('.old.yml'):
|
||||
continue
|
||||
with open(yml_file) as f:
|
||||
profile = yaml.safe_load(f)
|
||||
try:
|
||||
validate(profile, schema)
|
||||
except ValidationError as e:
|
||||
path = '/'.join(str(p) for p in e.absolute_path)
|
||||
errors.append(f'{yml_file.name}: {path}: {e.message}')
|
||||
print(f'FAIL {yml_file.name}: {path}: {e.message}')
|
||||
|
||||
print(f'{len(errors)} invalid profiles')
|
||||
if errors:
|
||||
sys.exit(1)
|
||||
"
|
||||
|
||||
run-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
Reference in new issue
Block a user