mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-21 12:06:49 +02:00
CI: Accept JSON with comments, but not JSON5 in its entirety
This commit is contained in:
parent
1fa3447ee7
commit
95b35a1063
2
.github/workflows/github.yml
vendored
2
.github/workflows/github.yml
vendored
@ -124,7 +124,7 @@ jobs:
|
|||||||
# also, running it on multiple presets is redundant and slightly increases already long CI built times
|
# also, running it on multiple presets is redundant and slightly increases already long CI built times
|
||||||
if: ${{ startsWith(matrix.preset, 'linux-clang-test') }}
|
if: ${{ startsWith(matrix.preset, 'linux-clang-test') }}
|
||||||
run: |
|
run: |
|
||||||
pip3 install json5
|
pip3 install jstyleson
|
||||||
python3 CI/linux-qt6/validate_json.py
|
python3 CI/linux-qt6/validate_json.py
|
||||||
|
|
||||||
- name: Dependencies
|
- name: Dependencies
|
||||||
|
@ -5,7 +5,8 @@ import sys
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
import json5
|
# VCMI supports JSON with comments, but not JSON5
|
||||||
|
import jstyleson
|
||||||
|
|
||||||
validation_failed = False
|
validation_failed = False
|
||||||
|
|
||||||
@ -17,10 +18,10 @@ for path in sorted(Path(".").glob("**/*.json"), key=lambda path: str(path).lower
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
with open(path_str, "r") as file:
|
with open(path_str, "r") as file:
|
||||||
json5.load(file)
|
jstyleson.load(file)
|
||||||
print(f"✅ {path_str}")
|
print(f"✅ {path_str}")
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
print(f"❌ {str(exc).replace('<string>', path_str)}")
|
print(f"❌ {path_str}: {exc}")
|
||||||
validation_failed = True
|
validation_failed = True
|
||||||
|
|
||||||
if validation_failed:
|
if validation_failed:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user