-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
start-local-server
executable file
·52 lines (45 loc) · 1.54 KB
/
start-local-server
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
#!/bin/sh
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
set -e
set -x
if [ "$CI_MODE" != "selenium" ] ; then
echo "Not in CI_MODE=selenium"
exit 0
fi
# Start php-fpm + nginx in temporary dir
DIR=`mktemp -d`
CURRENT=`pwd`
PHP_VERSION=$(phpenv version-name)
# Create configuration with correct paths
cp test/nginx.conf test/php-fpm.conf test/php.ini $DIR/
sed -i -e "s,%DIR%,$DIR," -e "s,%ROOT%,$CURRENT," $DIR/*
mkdir $DIR/sessions
# Start servers
$HOME/.phpenv/versions/$PHP_VERSION/sbin/php-fpm --fpm-config $DIR/php-fpm.conf -c $DIR/php.ini
nginx -c $DIR/nginx.conf
if [ ! -z "$TESTSUITE_BROWSERSTACK_KEY" ] ; then
echo "Using: BrowserStack"
# Install if necessary
if [ ! -f ~/browserstack/BrowserStackLocal ] ; then
mkdir -p ~/browserstack
cd ~/browserstack
wget https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip
unzip BrowserStackLocal-linux-x64.zip
fi
# Start BrowserStack Local forwarder
~/browserstack/BrowserStackLocal --force-local --localIdentifier "travis-$TRAVIS_JOB_NUMBER" --onlyAutomate --key "$TESTSUITE_BROWSERSTACK_KEY" --daemon start
elif [ -z "$SKIP_STANDALONE" ] ; then
echo "Using: selenium-standalone"
if [ ! -f selenium-standalone ]; then
yarn global add selenium-standalone
selenium-standalone install
fi
selenium-standalone start -- -debug > ~/selenium-standalone.logs~ 2>&1 &
echo $! > ~/selenium-standalone.pid~
else
echo "Using: nothing."
fi