upgrade to python3 libraries
[testsuite.git] / setup.sh
1 #!/bin/bash
2 #
3 # setup : script to setup required runtime environment. This script can be run again to update anything
4 # this should stay in your project directory
5
6
7 # save console output in setup_<timestamp>.log file in project directory
8 timestamp=$(date +"%m%d%Y_%H%M%S")
9 LOG_FILE=setup_$timestamp.log
10 exec > >(tee -a ${LOG_FILE} )
11 exec 2> >(tee -a ${LOG_FILE} >&2)
12
13
14 # get the path
15 path=$(pwd)
16 pip install \
17 --no-cache-dir \
18 --exists-action s \
19 --target="$path/robot/library" \
20 'robotframework-seleniumlibrary==3.3.1' \
21 'robotframework-databaselibrary==0.8.1' \
22 'robotframework-angularjs==0.0.9' \
23 'robotframework-requests==0.5.0' \
24 'robotframework-sshlibrary==3.3.0' \
25 'robotframework-ftplibrary==1.3' \
26 'robotframework-rammbock==0.4.0.1' \
27 'robotframework-httplibrary==0.4.2' \
28 'robotframework-archivelibrary==0.4' \
29 'robotframework-kafkalibrary==0.0.2'
30
31
32 # get the git for the eteutils you will need to add a private key to your ssh before this
33 if [ -d $path/testsuite/eteutils ]
34 then
35     # Support LF build location
36         cd $path/testsuite/eteutils
37 else
38         cd ~
39         git config --global http.sslVerify false
40         if [ -d ~/python-testing-utils ]
41         then
42                 cd python-testing-utils
43                 git pull origin master
44         else
45                 git clone https://gerrit.onap.org/r/testsuite/python-testing-utils.git
46                 cd python-testing-utils
47         fi
48 fi
49
50 pip install \
51 --no-cache-dir \
52 --upgrade \
53 --exists-action s \
54 --target="$path/robot/library" ./robotframework-onap
55
56
57 if [ -d $path/testsuite/heatbridge ]
58 then
59     # Support LF build location
60         cd $path/testsuite/heatbridge
61 else
62         cd ~
63         git config --global http.sslVerify false
64         if [ -d ~/heatbridge ]
65         then
66                 cd heatbridge
67                 git pull origin master
68         else
69                 git clone https://gerrit.onap.org/r/testsuite/heatbridge.git
70                 cd heatbridge
71         fi
72 fi
73
74 pip install \
75 --no-cache-dir \
76 --upgrade \
77 --exists-action s \
78 --target="$path/robot/library" \
79 ./heatbridge
80
81 # Go back to execution folder
82 cd $path
83
84 # if the script is running during the image build skip the rest of it
85 # as required software is installed already.
86 if $BUILDTIME
87 then
88         # we need to update PATH with chromium-chromedriver
89         echo "Adding in-container chromedriver to PATH"
90         ln -s /usr/lib/chromium-browser/chromedriver /usr/local/bin/chromedriver
91         
92         echo "Skipping desktop steps, building container image..."
93 else    
94         #
95         # Get the appropriate chromedriver. Default to linux64
96         #
97         CHROMEDRIVER_URL=http://chromedriver.storage.googleapis.com/2.43
98         CHROMEDRIVER_ZIP=chromedriver_linux64.zip
99         CHROMEDRIVER_TARGET=chromedriver.zip
100
101         # Handle mac and windows
102         OS=`uname -s`
103         case $OS in
104           MINGW*_NT*)
105                 CHROMEDRIVER_ZIP=chromedriver_win32.zip
106                 ;;
107           Darwin*)
108                 CHROMEDRIVER_ZIP=chromedriver_mac64.zip
109                 ;;
110           *) echo "Defaulting to Linux 64" ;;
111         esac
112
113         if [ $CHROMEDRIVER_ZIP == 'chromedriver_linux64.zip' ]
114         then
115             curl $CHROMEDRIVER_URL/$CHROMEDRIVER_ZIP -o $CHROMEDRIVER_TARGET
116                 unzip chromedriver.zip -d /usr/local/bin
117         else
118             curl $CHROMEDRIVER_URL/$CHROMEDRIVER_ZIP -o $CHROMEDRIVER_TARGET
119                 unzip $CHROMEDRIVER_TARGET
120         fi
121         rm -rf $CHROMEDRIVER_TARGET
122 fi
123
124 #
125 # Install kafkacat : https://github.com/edenhill/kafkacat
126 #
127 OS=`uname -s`
128 case $OS in
129         Darwin)
130                 brew install kafkacat ;;
131         Linux)
132                 apt-get -y install kafkacat
133 esac
134 #
135 # Install protobuf
136 #
137 OS=`uname -s`
138 case $OS in
139         Darwin)
140                 brew install protobuf ;;
141         Linux)
142                 apt-get -y install protobuf-compiler
143 esac