forked from forkanization/Proxmox-arm64
Update frontend-cicd.yml
This commit is contained in:
76
.github/workflows/frontend-cicd.yml
generated
vendored
76
.github/workflows/frontend-cicd.yml
generated
vendored
@@ -25,82 +25,6 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
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
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
|
|||||||
Reference in New Issue
Block a user