diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6b2e376 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,89 @@ +language: php + +dist: xenial + +services: + - mysql + - postgresql + +cache: + directories: + - vendor + - $HOME/.composer/cache + - bin/.phpunit + +php: + - 7.2 + - 7.3 + - 7.4 + +env: + global: + PLUGIN_CODE=Api + matrix: + - DATABASE_URL=mysql://root:@localhost/cube4_dev DATABASE_SERVER_VERSION=5 + - DATABASE_URL=postgres://postgres:password@localhost/cube4_dev DATABASE_SERVER_VERSION=9 + +before_install: &php_setup | + echo "opcache.enable_cli=1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + echo "apc.enabled=1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + echo "apc.enable_cli=1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + echo "date.timezone=Asia/Tokyo" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + phpenv config-rm xdebug.ini || true + +install_eccube: &install_eccube | + tar cvzf ${HOME}/${PLUGIN_CODE}.tar.gz ./* + git clone https://github.com/EC-CUBE/ec-cube.git + cd ec-cube + git fetch origin pull/4614/head:experimental/plugin_bundle + git checkout experimental/plugin_bundle + composer selfupdate + composer require trikoder/oauth2-bundle:"^2.1" nyholm/psr7:"^1.2" webonyx/graphql-php:"^14.0" -n + composer install --dev --no-interaction -o --apcu-autoloader + +eccube_setup: &eccube_setup | + echo "APP_ENV=test" > .env + bin/console doctrine:database:create + bin/console doctrine:schema:create + bin/console eccube:fixtures:load + bin/console eccube:plugin:install --path=${HOME}/${PLUGIN_CODE}.tar.gz + bin/console eccube:plugin:enable --code=${PLUGIN_CODE} + +install: + - *install_eccube + - *eccube_setup + +script: + - ./vendor/bin/phpunit app/Plugin/${PLUGIN_CODE}/Tests; + +#after_script: +# # disable plugin +# - bin/console eccube:plugin:disable --code=${PLUGIN_CODE} +# # uninstall plugin +# - bin/console eccube:plugin:uninstall --code=${PLUGIN_CODE} +# # re install plugin +# - bin/console eccube:plugin:install --code=${PLUGIN_CODE} +# # re enable plugin +# - bin/console eccube:plugin:enable --code=${PLUGIN_CODE} +# +#jobs: +# fast_finish: true +# include: +# - &coverage +# stage: Code Coverage +# php: 7.3 +# env: DATABASE_URL=sqlite:///var/eccube.db DATABASE_SERVER_VERSION=3 COVERAGE=1 +# before_install: +# - docker pull nanasess/phpdbg +# - docker pull schickling/mailcatcher +# - docker run -d -p 1080:1080 -p 1025:1025 --name mailcatcher schickling/mailcatcher +# install: +# - *install_eccube +# - *php_setup +# - *eccube_setup +# script: +# - docker run -e DATABASE_URL=sqlite:///var/eccube.db -v "$PWD":/usr/src/myapp:cached -w /usr/src/myapp --rm nanasess/phpdbg phpdbg -qrr -dmemory_limit=-1 ./bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist --coverage-clover=app/Plugin/${PLUGIN_CODE}/coverage.clover app/Plugin/${PLUGIN_CODE}/Tests +# after_success: +# - sed -i.bak -e 's|/usr/src/myapp/||g' app/Plugin/${PLUGIN_CODE}/coverage.clover +# - php vendor/bin/php-coveralls -v -x app/Plugin/${PLUGIN_CODE}/coverage.clover