on master help sign in
Merge pull request #995 from dalf/selenium

[fix] fix travis build

commitd4aa1dccee46f9c81210285db86cef8b913b7643 authorAdam Tauber <asciimoo@gmail.com> dateWed 16 Aug 2017, 19:05 (9 years ago) parent1012d631a81436
5 files changed+63−34
.travis.yml+4−5 manage.sh+53−28 requirements-dev.txt+1−1 searx/static/themes/oscar/gruntfile.js+4 searx/static/themes/simple/gruntfile.js+1
.travis.yml+4−5
@@ -14,12 +14,11 @@ before_install:
1414 - "export DISPLAY=:99.0"
1515 - "sh -e /etc/init.d/xvfb start"
1616 - npm install less less-plugin-clean-css grunt-cli
17− - ( cd searx/static/themes/oscar;npm install; cd - )
18− - ( cd searx/static/themes/simple;npm install; cd - )
19− - mkdir -p ~/drivers; export PATH=~/drivers:$PATH;
20− - GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/v0.14.0/geckodriver-v0.14.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;
17+ - export PATH=`pwd`/node_modules/.bin:$PATH
18+ - ./manage.sh install_geckodriver ~/drivers
19+ - export PATH=~/drivers:$PATH
2220install:
21+ - ./manage.sh npm_packages
2322 - ./manage.sh update_dev_packages
2423 - pip install coveralls
2524script:
manage.sh+53−28
@@ -5,6 +5,8 @@ PYTHONPATH=$BASE_DIR
55SEARX_DIR="$BASE_DIR/searx"
66ACTION=$1
77
8+cd "$BASE_DIR"
9+
810update_packages() {
911 pip install -r "$BASE_DIR/requirements.txt"
1012}
@@ -14,16 +16,17 @@ update_dev_packages() {
1416 pip install -r "$BASE_DIR/requirements-dev.txt"
1517}
1618
17−check_geckodriver() {
19+install_geckodriver() {
1820 echo '[!] Checking geckodriver'
21+ # TODO : check the current geckodriver version
1922 set -e
2023 geckodriver -V 2>1 > /dev/null || NOTFOUND=1
2124 set +e
2225 if [ -z $NOTFOUND ]; then
2326 return
2427 fi
25− GECKODRIVER_VERSION="v0.14.0"
26− PLATFORM=`python -c "import platform; print platform.system().lower(), platform.architecture()[0]"`
28+ GECKODRIVER_VERSION="v0.18.0"
29+ PLATFORM=`python -c "import six; import platform; six.print_(platform.system().lower(), platform.architecture()[0])"`
2730 case $PLATFORM in
2831 "linux 32bit" | "linux2 32bit") ARCH="linux32";;
2932 "linux 64bit" | "linux2 64bit") ARCH="linux64";;
@@ -32,16 +35,25 @@ check_geckodriver() {
3235 "mac 64bit") ARCH="macos";;
3336 esac
3437 GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
35− if [ -z "$VIRTUAL_ENV" ]; then
36− echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n $GECKODRIVER_URL"
37− exit
38+
39+ if [ -z "$1" ]; then
40+ if [ -z "$VIRTUAL_ENV" ]; then
41+ echo "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n $GECKODRIVER_URL"
42+ exit
43+ else
44+ GECKODRIVER_DIR="$VIRTUAL_ENV/bin"
45+ fi
3846 else
39− echo "Installing $VIRTUAL_ENV from\n $GECKODRIVER_URL"
40− FILE=`mktemp`
41− wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C $VIRTUAL_ENV/bin/ -f $FILE geckodriver
42− rm $FILE
43− chmod 777 $VIRTUAL_ENV/bin/geckodriver
47+ GECKODRIVER_DIR="$1"
48+ mkdir -p "$GECKODRIVER_DIR"
4449 fi
50+
51+ echo "Installing $GECKODRIVER_DIR/geckodriver from\n $GECKODRIVER_URL"
52+
53+ FILE=`mktemp`
54+ wget "$GECKODRIVER_URL" -qO $FILE && tar xz -C "$GECKODRIVER_DIR" -f $FILE geckodriver
55+ rm $FILE
56+ chmod 777 "$GECKODRIVER_DIR/geckodriver"
4557}
4658
4759pep8_check() {
@@ -73,37 +85,49 @@ tests() {
7385 set -e
7486 pep8_check
7587 unit_tests
76− check_geckodriver
88+ install_geckodriver
7789 robot_tests
7890 set +e
7991}
8092
8193build_style() {
82− # lessc -x "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
8394 lessc --clean-css="--s1 --advanced --compatibility=ie9" "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
8495}
8596
8697styles() {
8798 echo '[!] Building styles'
88− build_style themes/legacy/less/style.less themes/legacy/css/style.css
89− build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css
90− build_style themes/courgette/less/style.less themes/courgette/css/style.css
91− build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
92− build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
93− build_style themes/oscar/less/pointhi/oscar.less themes/oscar/css/pointhi.min.css
94− build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
95− build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
96− build_style themes/simple/less/style.less themes/simple/css/searx.min.css
97− build_style themes/simple/less/style-rtl.less themes/simple/css/searx-rtl.min.css
99+ build_style themes/legacy/less/style.less themes/legacy/css/style.css
100+ build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css
101+ build_style themes/courgette/less/style.less themes/courgette/css/style.css
102+ build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
103+ build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
104+ build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
105+ # built using grunt
106+ #build_style themes/oscar/less/pointhi/oscar.less themes/oscar/css/pointhi.min.css
107+ #build_style themes/oscar/less/logicodev/oscar.less themes/oscar/css/logicodev.min.css
108+ #build_style themes/simple/less/style.less themes/simple/css/searx.min.css
109+ #build_style themes/simple/less/style-rtl.less themes/simple/css/searx-rtl.min.css
110+}
111+
112+npm_packages() {
113+ echo '[!] install NPM packages for oscar theme'
114+ cd $BASE_DIR/searx/static/themes/oscar
115+ npm install
116+
117+ echo '[!] install NPM packages for simple theme'
118+ cd $BASE_DIR/searx/static/themes/simple
119+ npm install
98120}
99121
100122grunt_build() {
101− grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
102− grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
123+ echo '[!] Grunt build : oscar theme'
124+ grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
125+ echo '[!] Grunt build : simple theme'
126+ grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
103127}
104128
105129locales() {
106− pybabel compile -d "$SEARX_DIR/translations"
130+ pybabel compile -d "$SEARX_DIR/translations"
107131}
108132
109133help() {
@@ -112,6 +136,7 @@ help() {
112136
113137Commands
114138========
139+ npm_packages - Download & install dependencies
115140 grunt_build - Build js files
116141 help - This text
117142 locales - Compile locales
@@ -123,10 +148,10 @@ Commands
123148 unit_tests - Run unit tests
124149 update_dev_packages - Check & update development and production dependency changes
125150 update_packages - Check & update dependency changes
126− check_geckodriver - Check & download geckodriver (required for robot_tests)
151+ install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests)
127152"
128153}
129154
130155[ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
131156 && help "action not found" \
132− || $ACTION
157+ || $ACTION "$2"
requirements-dev.txt+1−1
@@ -7,4 +7,4 @@ splinter==0.7.5
77transifex-client==0.12.2
88unittest2==1.1.0
99zope.testrunner==4.5.1
10−selenium==3.0.1
10+selenium==3.5.0
searx/static/themes/oscar/gruntfile.js+4
@@ -24,6 +24,7 @@ module.exports = function(grunt) {
2424 jshint: {
2525 files: ['gruntfile.js', 'js/searx_src/*.js'],
2626 options: {
27+ reporterOutput: "",
2728 // options here to override JSHint defaults
2829 globals: {
2930 jQuery: true,
@@ -51,6 +52,8 @@ module.exports = function(grunt) {
5152 files: {"css/pointhi.min.css": "less/pointhi/oscar.less",
5253 "css/logicodev.min.css": "less/logicodev/oscar.less"}
5354 },
55+ /*
56+ // built with ./manage.sh styles
5457 bootstrap: {
5558 options: {
5659 paths: ["less/bootstrap"],
@@ -58,6 +61,7 @@ module.exports = function(grunt) {
5861 },
5962 files: {"css/bootstrap.min.css": "less/bootstrap/bootstrap.less"}
6063 },
64+ */
6165 },
6266 watch: {
6367 scripts: {
searx/static/themes/simple/gruntfile.js+1
@@ -34,6 +34,7 @@ module.exports = function(grunt) {
3434 jshint: {
3535 files: ['js/searx_src/*.js'],
3636 options: {
37+ reporterOutput: "",
3738 proto: true,
3839 // options here to override JSHint defaults
3940 globals: {