-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-script-automation.bash
More file actions
executable file
·54 lines (46 loc) · 1.87 KB
/
setup-script-automation.bash
File metadata and controls
executable file
·54 lines (46 loc) · 1.87 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
#!/usr/bin/env bash
#
# Check and install dependencies for test automation.
# This script does not configure Jenkins and does not run tests.
#
# Set Python virtual environment if not already set
VIRTUALENV_NAME="${VIRTUALENV_NAME:-"venv"}"
# Submodule path relative to base of repository
# This is hardcoded given since submodule checkout committed to this directory
LF_SCRIPTS=./lanforge-scripts
printf "> Configuring LANforge scripts test automation\n\n"
if [[ -d $LF_SCRIPTS ]]; then
# If things aren't actually setup and this is printed, then
# manually run 'git submodule init && git submodule update'
printf "> LANforge scripts git submodule already configured\n\n"
else
printf "> Cloning LANforge scripts git submodule\n\n"
git submodule init && git submodule update
if [[ $? -ne 0 ]]; then
printf "! Failed to clone LANforge scripts git submodule\n\n"
exit 1
fi
fi
if [[ -d $VIRTUALENV_NAME ]]; then
printf "> Python virtual environment '$VIRTUALENV_NAME' already present\n\n"
else
printf "> Creating script Python virtual environment '$VIRTUALENV_NAME'\n\n"
python3 -m virtualenv venv
if [[ $? -ne 0 ]]; then
printf "! Failed to create Python virtual environment '$VIRTUALENV_NAME'\n\n"
exit 1
fi
echo # Newline after virtual environment creation logs
fi
printf "> Activating and installing dependencies in Python virtual environment '$VIRTUALENV_NAME'\n\n"
source $VIRTUALENV_NAME/bin/activate
if [[ $? -ne 0 ]]; then
printf "! Failed to source Python virtual environment '$VIRTUALENV_NAME'\n\n"
exit 1
fi
python3 lanforge-scripts/py-scripts/update_dependencies.py
if [[ $? -ne 0 ]]; then
printf "! Failed to install dependencies in virtual environment '$VIRTUALENV_NAME'\n\n"
exit 1
fi
printf "> Setup complete. Activate virtuel environment by running 'source $VIRTUALENV_NAME/bin/activate'\n\n"