Browse Source

[mod] travis build : travis uses ./manage.sh to install the geckodriver

Alexandre Flament 7 years ago
parent
commit
d87eb4da61
2 changed files with 32 additions and 22 deletions
  1. 3
    4
      .travis.yml
  2. 29
    18
      manage.sh

+ 3
- 4
.travis.yml View File

15
   - "sh -e /etc/init.d/xvfb start"
15
   - "sh -e /etc/init.d/xvfb start"
16
   - npm install less less-plugin-clean-css grunt-cli
16
   - npm install less less-plugin-clean-css grunt-cli
17
   - export PATH=`pwd`/node_modules/.bin:$PATH
17
   - export PATH=`pwd`/node_modules/.bin:$PATH
18
-  - ./manage.sh grunt_packages
19
-  - mkdir -p ~/drivers; export PATH=~/drivers:$PATH;
20
-  - GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz";
21
-  - FILE=`mktemp`; wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C ~/drivers -f $FILE geckodriver; rm $FILE; chmod 777 ~/drivers/geckodriver;
18
+  - ./manage.sh install_geckodriver ~/drivers
19
+  - export PATH=~/drivers:$PATH
22
 install:
20
 install:
21
+  - ./manage.sh npm_packages
23
   - ./manage.sh update_dev_packages
22
   - ./manage.sh update_dev_packages
24
   - pip install coveralls
23
   - pip install coveralls
25
 script:
24
 script:

+ 29
- 18
manage.sh View File

25
 	return
25
 	return
26
     fi
26
     fi
27
     GECKODRIVER_VERSION="v0.18.0"
27
     GECKODRIVER_VERSION="v0.18.0"
28
-    PLATFORM=`python -c "import platform; print platform.system().lower(), platform.architecture()[0]"`
28
+    PLATFORM=`python -c "import six; import platform; six.print_(platform.system().lower(), platform.architecture()[0])"`
29
     case $PLATFORM in
29
     case $PLATFORM in
30
 	"linux 32bit" | "linux2 32bit") ARCH="linux32";;
30
 	"linux 32bit" | "linux2 32bit") ARCH="linux32";;
31
 	"linux 64bit" | "linux2 64bit") ARCH="linux64";;
31
 	"linux 64bit" | "linux2 64bit") ARCH="linux64";;
34
 	"mac 64bit") ARCH="macos";;
34
 	"mac 64bit") ARCH="macos";;
35
     esac
35
     esac
36
     GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
36
     GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
37
-    if [ -z "$VIRTUAL_ENV" ]; then
38
-	echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n  $GECKODRIVER_URL"
39
-	exit
37
+
38
+    if [ -z $1 ]; then
39
+	if [ -z "$VIRTUAL_ENV" ]; then
40
+	    echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n  $GECKODRIVER_URL"
41
+	    exit    
42
+	else
43
+	    GECKODRIVER_DIR=$VIRTUAL_ENV/bin
44
+	fi
40
     else
45
     else
41
-	echo "Installing $VIRTUAL_ENV from\n  $GECKODRIVER_URL"
42
-	FILE=`mktemp`
43
-	wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C $VIRTUAL_ENV/bin/ -f $FILE geckodriver
44
-	rm $FILE
45
-	chmod 777 $VIRTUAL_ENV/bin/geckodriver
46
+	GECKODRIVER_DIR=$1
47
+	mkdir -p $GECKODRIVER_DIR
46
     fi
48
     fi
49
+
50
+    echo "Installing $GECKODRIVER_DIR from\n  $GECKODRIVER_URL"
51
+    
52
+    FILE=`mktemp`
53
+    wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C $GECKODRIVER_DIR -f $FILE geckodriver
54
+    rm $FILE
55
+    chmod 777 $GECKODRIVER_DIR/geckodriver
47
 }
56
 }
48
 
57
 
49
 pep8_check() {
58
 pep8_check() {
91
     build_style themes/courgette/less/style.less themes/courgette/css/style.css
100
     build_style themes/courgette/less/style.less themes/courgette/css/style.css
92
     build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
101
     build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
93
     build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
102
     build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
94
-    build_style themes/oscar/less/pointhi/oscar.less themes/oscar/css/pointhi.min.css
95
-    build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
96
     build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
103
     build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
97
-    build_style themes/simple/less/style.less themes/simple/css/searx.min.css
98
-    build_style themes/simple/less/style-rtl.less themes/simple/css/searx-rtl.min.css
104
+    # built using grunt
105
+    #build_style themes/oscar/less/pointhi/oscar.less themes/oscar/css/pointhi.min.css
106
+    #build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
107
+    #build_style themes/simple/less/style.less themes/simple/css/searx.min.css
108
+    #build_style themes/simple/less/style-rtl.less themes/simple/css/searx-rtl.min.css
99
 }
109
 }
100
 
110
 
101
-grunt_packages() {
102
-    echo '[!] Grunt packages: install dependencies'
111
+npm_packages() {
112
+    echo '[!] install NPM packages for oscar theme'
103
     cd $BASE_DIR/searx/static/themes/oscar
113
     cd $BASE_DIR/searx/static/themes/oscar
104
     npm install
114
     npm install
105
-    
115
+
116
+    echo '[!] install NPM packages for simple theme'    
106
     cd $BASE_DIR/searx/static/themes/simple
117
     cd $BASE_DIR/searx/static/themes/simple
107
     npm install
118
     npm install
108
 }
119
 }
124
 
135
 
125
 Commands
136
 Commands
126
 ========
137
 ========
127
-    grunt_packages       - Download & install dependencies
138
+    npm_packages         - Download & install dependencies
128
     grunt_build          - Build js files
139
     grunt_build          - Build js files
129
     help                 - This text
140
     help                 - This text
130
     locales              - Compile locales
141
     locales              - Compile locales
142
 
153
 
143
 [ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
154
 [ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
144
     && help "action not found" \
155
     && help "action not found" \
145
-    || $ACTION
156
+    || $ACTION $2