-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·61 lines (46 loc) · 1.35 KB
/
bootstrap.sh
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
#!/bin/bash
###############################################
# Script for setting up project locally #
###############################################
###############################################
# Setup Python Environment #
###############################################
python3 -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt
# pip install --editable .
deactivate
###############################################
# Setup Python Sandbox Environment #
###############################################
cd sandbox
python3 -m venv sandbox-venv
source ./sandbox-venv/bin/activate
pip install -r requirements.txt
cd ..
pip install --editable .
cd sandbox
echo "Running sandbox..."
python main.py
deactivate
###############################################
# Setup the pre-commit hook script #
###############################################
# Create hooks directory if it doesn't exist
mkdir -p .git/hooks
# Create pre-commit hook file
cat > .git/hooks/pre-commit << 'EOL'
#!/bin/bash
# Add your pre-commit checks here
echo "Running pre-commit checks..."
# Run tests
python -m pytest
# Check exit code
if [ $? -ne 0 ]; then
echo "Tests failed. Commit aborted."
exit 1
fi
EOL
# Make the pre-commit hook executable
chmod +x .git/hooks/pre-commit
echo "Pre-commit hook script created successfully."