-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpre-push
More file actions
executable file
·34 lines (28 loc) · 931 Bytes
/
pre-push
File metadata and controls
executable file
·34 lines (28 loc) · 931 Bytes
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
#!/usr/bin/env sh
echo "🚀 Running pre-push checks..."
# Activate virtual environment if it exists
if [ -d "venv" ]; then
echo "🔧 Activating virtual environment..."
source venv/bin/activate
fi
# Run tests to ensure code quality
echo "🧪 Running tests..."
if ! pytest --html=tests/report/test-report.html; then
echo "❌ Tests failed. Please fix before pushing."
exit 1
fi
# Run coverage check
echo "📊 Checking test coverage..."
if ! pytest --cov=contentstack --cov-report=term-missing; then
echo "❌ Coverage check failed. Please improve test coverage."
exit 1
fi
# Run security scan on dependencies (optional)
if [ -n "$SNYK_TOKEN" ]; then
echo "🔍 Running comprehensive Snyk scan..."
if ! snyk test --severity-threshold=high; then
echo "❌ High severity vulnerabilities found. Please fix before pushing."
exit 1
fi
fi
echo "✅ All pre-push checks passed!"