-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci_check.py
More file actions
78 lines (63 loc) · 2.62 KB
/
ci_check.py
File metadata and controls
78 lines (63 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
"""
CI Check Script - Simulates typical GitHub Actions workflow
"""
import subprocess
import sys
import os
def run_command(cmd, description):
"""Run a command and report results."""
print(f"\n{'='*60}")
print(f"🔍 {description}")
print(f"{'='*60}")
print(f"Running: {cmd}")
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if result.returncode == 0:
print(f"✅ {description} - PASSED")
if result.stdout.strip():
print("Output:")
print(result.stdout)
else:
print(f"❌ {description} - FAILED")
if result.stderr.strip():
print("Errors:")
print(result.stderr)
if result.stdout.strip():
print("Output:")
print(result.stdout)
return result.returncode == 0
def main():
"""Run comprehensive CI checks."""
print("🚀 NFL Plotpy CI Check Suite")
print("Simulating typical GitHub Actions workflow")
# Ensure we're in a virtual environment
if not os.environ.get('VIRTUAL_ENV'):
print("⚠️ Warning: Not in a virtual environment")
checks = [
("source .venv/bin/activate && ruff check nflplotpy/", "Ruff Linting"),
("source .venv/bin/activate && ruff format --check nflplotpy/", "Ruff Formatting"),
("source .venv/bin/activate && python -c 'import nflplotpy; print(f\"Package imports successfully. Version info available.\")'", "Package Import"),
("source .venv/bin/activate && python -m pytest tests/ --tb=short -q --disable-warnings", "Test Suite"),
("source .venv/bin/activate && python -c 'import nflplotpy as nfl; print(f\"Exported functions: {len(nfl.__all__)}\")'", "Function Exports"),
]
results = []
for cmd, description in checks:
success = run_command(cmd, description)
results.append((description, success))
print(f"\n{'='*60}")
print("📊 CI CHECK SUMMARY")
print(f"{'='*60}")
passed = sum(1 for _, success in results if success)
total = len(results)
for description, success in results:
status = "✅ PASS" if success else "❌ FAIL"
print(f"{status:<10} {description}")
print(f"\nOverall: {passed}/{total} checks passed")
if passed == total:
print("🎉 ALL CI CHECKS PASSED - Ready for deployment!")
return 0
else:
print("💥 SOME CI CHECKS FAILED - Fix required before deployment")
return 1
if __name__ == "__main__":
sys.exit(main())