run-tests.sh 1.01 KB
Newer Older
Loïc Dachary's avatar
tmp  
Loïc Dachary committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/bin/bash

set -ex

function run_selenium() {
    if ! docker inspect --type=container enough_selenium > /dev/null 2>&1 ; then
        docker run --rm --name enough_selenium -d selenium/standalone-firefox:2.53.1-beryllium
    fi
}

function kill_selenium() {
    docker rm -f enough_selenium || true
}

trap "kill_selenium" EXIT

function run_tests() {
    run_selenium
    docker build -t enough_ci:latest ./
20 21 22 23 24 25 26 27 28
    if ! test "$GITLAB_CI" ; then
        DOCKER_ARGS="-v $(pwd):/opt/core/apps/enough"
        PHPUNIT_ARGS="--coverage-html=html"
    fi
    docker run --rm -e TRAVIS=true $DOCKER_ARGS enough_ci:latest /opt/vendor/bin/phpunit $PHPUNIT_ARGS --bootstrap /opt/core/tests/bootstrap.php --fail-on-warning --configuration phpunit.xml
    if ! test "$GITLAB_CI" ; then
        firefox html/index.html
    fi
    docker run --link enough_selenium:selenium --rm $DOCKER_ARGS enough_ci:latest /opt/vendor/bin/phpunit --bootstrap /opt/core/tests/bootstrap.php --fail-on-warning --configuration phpunit.integration.xml
Loïc Dachary's avatar
tmp  
Loïc Dachary committed
29 30 31
}

run_tests