mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-07-27 08:17:36 +00:00
Compare commits
13 Commits
github-act
...
add-json-t
Author | SHA1 | Date | |
---|---|---|---|
4b6677618e | |||
f0c57bf448 | |||
a01a9111ca | |||
5af1aa3f81 | |||
4681abc99e | |||
955521e272 | |||
bdc96deec2 | |||
4b9c00707d | |||
0a3f28c8f8 | |||
878d107e30 | |||
362d3344f7 | |||
ff45bd69a7 | |||
9c0c4da881 |
81
.github/workflows/frontend-cicd.yml
generated
vendored
81
.github/workflows/frontend-cicd.yml
generated
vendored
@ -24,12 +24,87 @@ concurrency:
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository == 'community-scripts/ProxmoxVE'
|
||||
test-json-files:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend # Set default working directory for all run steps
|
||||
working-directory: frontend
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Test JSON files
|
||||
run: |
|
||||
python3 << 'EOF'
|
||||
import json
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
def test_json_files():
|
||||
# Change to the correct directory
|
||||
json_dir = "public/json"
|
||||
if not os.path.exists(json_dir):
|
||||
print(f"❌ Directory not found: {json_dir}")
|
||||
return False
|
||||
|
||||
# Find all JSON files
|
||||
pattern = os.path.join(json_dir, "*.json")
|
||||
json_files = glob.glob(pattern)
|
||||
|
||||
if not json_files:
|
||||
print(f"⚠️ No JSON files found in {json_dir}")
|
||||
return True
|
||||
|
||||
print(f"Testing {len(json_files)} JSON files for valid syntax...")
|
||||
|
||||
invalid_files = []
|
||||
|
||||
for file_path in json_files:
|
||||
try:
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
json.load(f)
|
||||
print(f"✅ Valid JSON: {file_path}")
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"❌ Invalid JSON syntax in: {file_path}")
|
||||
print(f" Error: {e}")
|
||||
invalid_files.append(file_path)
|
||||
except Exception as e:
|
||||
print(f"⚠️ Error reading: {file_path}")
|
||||
print(f" Error: {e}")
|
||||
invalid_files.append(file_path)
|
||||
|
||||
print("\n=== JSON Validation Summary ===")
|
||||
print(f"Total files tested: {len(json_files)}")
|
||||
print(f"Valid files: {len(json_files) - len(invalid_files)}")
|
||||
print(f"Invalid files: {len(invalid_files)}")
|
||||
|
||||
if invalid_files:
|
||||
print("\n❌ Found invalid JSON file(s):")
|
||||
for file_path in invalid_files:
|
||||
print(f" - {file_path}")
|
||||
return False
|
||||
else:
|
||||
print("\n✅ All JSON files have valid syntax!")
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
success = test_json_files()
|
||||
sys.exit(0 if success else 1)
|
||||
EOF
|
||||
|
||||
build:
|
||||
if: github.repository == 'community-scripts/ProxmoxVE'
|
||||
needs: test-json-files
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
Reference in New Issue
Block a user