woocommerce/tests/bin/travis.sh

39 lines
1.0 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2017-10-05 16:09:39 +00:00
# usage: travis.sh before|after
if [ $1 == 'before' ]; then
2017-11-23 11:13:09 +00:00
# Remove Xdebug from PHP runtime for all PHP version except 7.1 to speed up builds.
# We need Xdebug enabled in the PHP 7.1 build job as it is used to generate code coverage.
if [[ ${RUN_CODE_COVERAGE} != 1 ]]; then
phpenv config-rm xdebug.ini
fi
2018-02-27 17:20:13 +00:00
composer global require "phpunit/phpunit=6.*"
if [[ ${RUN_PHPCS} == 1 ]]; then
composer install
fi
fi
2017-09-26 12:24:11 +00:00
2017-09-26 13:09:27 +00:00
if [ $1 == 'after' ]; then
if [[ ${RUN_CODE_COVERAGE} == 1 ]]; then
2017-09-26 13:09:27 +00:00
bash <(curl -s https://codecov.io/bash)
2017-09-26 14:21:05 +00:00
wget https://scrutinizer-ci.com/ocular.phar
2017-10-05 16:09:39 +00:00
chmod +x ocular.phar
2017-09-26 14:21:05 +00:00
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
2017-09-26 12:24:11 +00:00
fi
if [[ ${RUN_E2E} == 1 && $(ls -A $TRAVIS_BUILD_DIR/screenshots) ]]; then
if [[ -z "${ARTIFACTS_KEY}" ]]; then
echo "Screenshots were not uploaded. Please run the e2e tests locally to see failures."
else
curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash
artifacts upload
fi
fi
2017-09-26 12:24:11 +00:00
fi