From c04f14628a5ba0f27b73fb5877c13079ea98f4c4 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 22 Aug 2019 23:48:20 +0200 Subject: [PATCH] Update template --- .gitignore | 11 ++++++--- .php_cs | 15 ------------ .php_cs.dist | 13 ++++++++++ .travis.yml | 35 ++++++++++++++++++-------- appveyor.yml | 38 ++++++++++++++++++++++++++++ composer.json | 64 +++++++++++++++++++++++++++++++----------------- phpunit.xml | 14 ----------- phpunit.xml.dist | 28 +++++++++++++++++++++ 8 files changed, 153 insertions(+), 65 deletions(-) delete mode 100644 .php_cs create mode 100644 .php_cs.dist create mode 100644 appveyor.yml delete mode 100644 phpunit.xml create mode 100644 phpunit.xml.dist diff --git a/.gitignore b/.gitignore index f31187e..bef310b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ -/coverage/ -/composer.lock -/vendor/ -/.idea/ +.vscode +build +composer.lock +phpunit.xml +vendor +.php_cs.cache +coverage diff --git a/.php_cs b/.php_cs deleted file mode 100644 index ab38568..0000000 --- a/.php_cs +++ /dev/null @@ -1,15 +0,0 @@ -level(Symfony\CS\FixerInterface::NONE_LEVEL) - ->fixers([ - "psr2", - "-braces", - "-psr0", - ]) - ->finder( - Symfony\CS\Finder\DefaultFinder::create() - ->in(__DIR__ . "/lib") - ->in(__DIR__ . "/test") - ) -; diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 0000000..8d02bce --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,13 @@ +getFinder() + ->in(__DIR__ . '/examples') + ->in(__DIR__ . '/lib') + ->in(__DIR__ . '/test'); + +$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__; + +$config->setCacheFile($cacheDir . '/.php_cs.cache'); + +return $config; diff --git a/.travis.yml b/.travis.yml index b208d84..71b9734 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,22 +3,37 @@ sudo: false language: php php: - - 5.5 - - 5.6 - - 7 + - 7.0 + - 7.1 + - 7.2 + - 7.3 + - nightly -before_script: - - composer self-update - - composer require satooshi/php-coveralls:dev-master - - composer install +matrix: + allow_failures: + - php: nightly + fast_finish: true + +env: + - AMP_DEBUG=true + +before_install: + - phpenv config-rm xdebug.ini || echo "No xdebug config." + +install: + - composer update -n --prefer-dist + - wget https://github.com/php-coveralls/php-coveralls/releases/download/v1.0.2/coveralls.phar + - chmod +x coveralls.phar script: - - $(php -r 'if (PHP_MAJOR_VERSION >= 7) echo "phpdbg -qrr"; else echo "php";') vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml - - php vendor/bin/php-cs-fixer --diff --dry-run -v fix + - vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml + - PHP_CS_FIXER_IGNORE_ENV=1 php vendor/bin/php-cs-fixer --diff --dry-run -v fix after_script: - - php vendor/bin/coveralls -v + - ./coveralls.phar -v cache: directories: - $HOME/.composer/cache + - $HOME/.php-cs-fixer + - $HOME/.local diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..6fdeefd --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,38 @@ +build: false +shallow_clone: false + +platform: + - x86 + - x64 + +clone_folder: c:\projects\amphp + +cache: + - c:\tools\php73 -> appveyor.yml + +init: + - SET PATH=C:\Program Files\OpenSSL;c:\tools\php73;%PATH% + - SET COMPOSER_NO_INTERACTION=1 + - SET PHP=1 + - SET ANSICON=121x90 (121x90) + +install: + - IF EXIST c:\tools\php73 (SET PHP=0) + - IF %PHP%==1 sc config wuauserv start= auto + - IF %PHP%==1 net start wuauserv + - IF %PHP%==1 cinst -y OpenSSL.Light + - IF %PHP%==1 cinst -y php + - cd c:\tools\php73 + - IF %PHP%==1 copy php.ini-production php.ini /Y + - IF %PHP%==1 echo date.timezone="UTC" >> php.ini + - IF %PHP%==1 echo extension_dir=ext >> php.ini + - IF %PHP%==1 echo extension=php_openssl.dll >> php.ini + - IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini + - IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini + - cd c:\projects\amphp + - appveyor DownloadFile https://getcomposer.org/composer.phar + - php composer.phar install --prefer-dist --no-progress + +test_script: + - cd c:\projects\amphp + - vendor/bin/phpunit --colors=always diff --git a/composer.json b/composer.json index 3a5b277..0173df6 100644 --- a/composer.json +++ b/composer.json @@ -1,25 +1,45 @@ { - "name": "amphp/template", - "license": "MIT", - "authors": [ - { - "name": "...", - "email": "..." + "name": "amphp/template", + "license": "MIT", + "description": "Template for AMPHP libraries", + "authors": [{ + "name": "...", + "email": "..." + }], + "support": { + "issues": "https://github.com/amphp/template/issues" + }, + "require": { + "php": ">=7.0", + "amphp/amp": "^2" + }, + "require-dev": { + "amphp/phpunit-util": "^1", + "phpunit/phpunit": "^6", + "amphp/php-cs-fixer-config": "dev-master" + }, + "autoload": { + "psr-4": { + "Amp\\Template\\": "lib/" + } + }, + "autoload-dev": { + "psr-4": { + "Amp\\Template\\Test\\": "test" + } + }, + "config": { + "platform": { + "php": "7.0.0" + } + }, + "scripts": { + "check": [ + "@cs", + "@test" + ], + "cs": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix -v --diff --dry-run", + "cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix -v --diff", + "test": "@php -dzend.assertions=1 -dassert.exception=1 ./vendor/bin/phpunit --coverage-text" } - ], - "support": { - "issues": "https://github.com/amphp/template/issues" - }, - "require": { - "amphp/amp": "^1" - }, - "require-dev": { - "phpunit/phpunit": "~4.4.0", - "friendsofphp/php-cs-fixer": "~1.9" - }, - "autoload": { - "psr-4": { - "Amp\\Template\\": "lib/" - } - } } diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 15defc4..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - ./test - - - - - ./lib - - - diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..ce62c46 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,28 @@ + + + + + test + + + + + lib + + + + + +