From 71e30e09d10a2c5072852d2690f7d54a449aa4c9 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 13 Jul 2020 10:16:55 +0100 Subject: [PATCH] PHP 8.0 support --- .gitattributes | 2 +- .github/workflows/tests.yml | 89 +++++++++++++++++++++++++++++++++++++ .travis.yml | 36 --------------- appveyor.yml | 39 ---------------- composer.json | 4 +- 5 files changed, 92 insertions(+), 78 deletions(-) create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.gitattributes b/.gitattributes index e53f3a0..1fb4d22 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,12 +1,12 @@ spec/ export-ignore tests/ export-ignore +.github/ export-ignore .editorconfig export-ignore .gitattributes export-ignore .gitignore export-ignore .php_cs export-ignore .scrutinizer.yml export-ignore .styleci.yml export-ignore -.travis.yml export-ignore CONDUCT.md export-ignore CONTRIBUTING.md export-ignore phpspec.yml.ci export-ignore diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..5c3f5b3 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,89 @@ +name: tests + +on: + push: + pull_request: + +jobs: + latest: + name: PHP ${{ matrix.php }} Latest + runs-on: ubuntu-latest + strategy: + matrix: + php: ['7.1', '7.2', '7.3', '7.4', '8.0'] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + coverage: none + + - name: Install PHP 7 dependencies + run: composer update --prefer-dist --no-interaction --no-progress + if: "matrix.php != '8.0'" + + - name: Install PHP 8 dependencies + run: | + composer require "phpunit/phpunit:^9.3@dev" "phpunit/php-code-coverage:^9.0@dev" "sebastian/global-state:^5.0@dev" "phpdocumentor/reflection-docblock:^5.2@dev" --no-interaction --no-update + composer update --prefer-dist --no-interaction --no-progress --ignore-platform-req=php + if: "matrix.php == '8.0'" + + - name: Execute tests + run: composer test + + lowest: + name: PHP ${{ matrix.php }} Lowest + runs-on: ubuntu-latest + strategy: + matrix: + php: ['7.1', '7.2', '7.3', '7.4'] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + coverage: none + + - name: Install dependencies + run: | + composer require "sebastian/comparator:^3.0.2" --no-interaction --no-update + composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress + + - name: Execute tests + run: composer test + + coverage: + name: Code Coverage + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + tools: composer:v2 + coverage: xdebug + + - name: Install dependencies + run: composer update --prefer-dist --no-interaction --no-progress + + - name: Execute tests + run: composer test-ci + + - name: Upload coverage + run: | + wget https://scrutinizer-ci.com/ocular.phar + php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 26d954b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache/files - -php: - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -env: - global: - - TEST_COMMAND="composer test" - -branches: - except: - - /^analysis-.*$/ - -matrix: - fast_finish: true - include: - - php: 7.3 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci" - - -install: - - composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction - -script: - - $TEST_COMMAND - -after_success: - - if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi - - if [[ "$COVERAGE" = true ]]; then php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml; fi diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 8d7af73..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,39 +0,0 @@ -build: false -platform: - - x86 - - x64 - -clone_folder: c:\projects\php-http\multipart-stream-builder - -cache: - - c:\tools\php -> appveyor.yml - -init: - - SET PATH=c:\php;%PATH% - - SET COMPOSER_NO_INTERACTION=1 - - SET PHP=1 - - -install: - - IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php) - - cd c:\php - - IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-7.0.0-nts-Win32-VC14-x86.zip - - IF %PHP%==1 7z x php-7.0.0-nts-Win32-VC14-x86.zip -y >nul - - IF %PHP%==1 del /Q *.zip - - IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat - - IF %PHP%==1 copy /Y php.ini-development php.ini - - IF %PHP%==1 echo max_execution_time=1200 >> php.ini - - 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 - - appveyor DownloadFile https://getcomposer.org/composer.phar - - cd c:\projects\php-http\multipart-stream-builder - - mkdir %APPDATA%\Composer - - composer update --prefer-dist --no-progress --ansi - -test_script: - - cd c:\projects\php-http\multipart-stream-builder - - vendor\bin\phpunit.bat --verbose - diff --git a/composer.json b/composer.json index 329e906..4bb275e 100644 --- a/composer.json +++ b/composer.json @@ -11,14 +11,14 @@ } ], "require": { - "php": "^7.1", + "php": "^7.1 || ^8.0", "psr/http-message": "^1.0", "psr/http-factory": "^1.0", "php-http/message-factory": "^1.0.2", "php-http/discovery": "^1.7" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.3", + "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3", "php-http/message": "^1.5", "nyholm/psr7": "^1.0" },