From 2895bd89d2e84395ae9411fb79af75dc53d6713c Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 13 Jul 2020 10:16:32 +0100 Subject: [PATCH] PHP 8.0 support --- .gitattributes | 1 - .github/workflows/tests.yml | 121 ++++++++++++++++++++++++++++++++++++ .travis.yml | 45 -------------- composer.json | 7 +-- 4 files changed, 124 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.gitattributes b/.gitattributes index c47225a..e6f2cb1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,7 +5,6 @@ /.php_cs export-ignore /.scrutinizer.yml export-ignore /.styleci.yml export-ignore -/.travis.yml export-ignore /behat.yml.dist export-ignore /features/ export-ignore /phpspec.ci.yml export-ignore diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..abfeb57 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,121 @@ +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 + + symfony: + name: Symfony ${{ matrix.symfony }} LTS + runs-on: ubuntu-latest + strategy: + matrix: + symfony: ['2', '3', '4'] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.1 + tools: composer:v2 + coverage: none + + - name: Pin old packages + run: composer require "phpspec/phpspec:^2.5.8" --no-interaction --no-update + if: "matrix.symfony == '2'" + + - name: Install dependencies + run: | + composer require dunglas/symfony-lock:v${{ matrix.symfony }} --no-interaction --no-update + composer update --prefer-dist --no-interaction --prefer-stable --prefer-lowest --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 require "friends-of-phpspec/phpspec-code-coverage:^4.3.2" --no-interaction --no-update + 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 436011a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: php -sudo: false - -cache: - directories: - - $HOME/.composer/cache/files - -jobs: - fast_finish: true - include: - - php: 7.1 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" - - php: 7.2 - env: COVERAGE=true DEPENDENCIES="friends-of-phpspec/phpspec-code-coverage:^4.3 phpspec/phpspec:^5.1" - script: - - composer test-ci - after_success: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml --revision=$TRAVIS_COMMIT - # Test LTS versions - - php: 7.2 - env: DEPENDENCIES="dunglas/symfony-lock:^3" - - php: 7.2 - env: DEPENDENCIES="dunglas/symfony-lock:^4" - - php: 7.2 - env: TEST_COMMAND="./vendor/bin/phpunit" DEPENDENCIES="phpunit/phpunit:^7.5 nyholm/psr7:^1.0" - - # Latest dev release - - php: 7.4 - env: STABILITY="dev" - -before_install: -- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi -- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi; -- if ! [ -z "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi; - -install: -- cat composer.json -# To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355 -- if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi -- composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction - -script: -- composer validate --strict --no-check-lock -- composer test diff --git a/composer.json b/composer.json index 5f8e4bb..164c2b6 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "php": "^7.1", + "php": "^7.1 || ^8.0", "php-http/httplug": "^2.0", "php-http/message-factory": "^1.0", "php-http/message": "^1.6", @@ -26,9 +26,8 @@ "guzzlehttp/psr7": "^1.4", "nyholm/psr7": "^1.2", "phpspec/phpspec": "^5.1 || ^6.0", - "phpspec/prophecy": "^1.8", - "phpunit/phpunit": "^7.5", - "sebastian/comparator": "^3.0" + "phpspec/prophecy": "^1.10.2", + "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3" }, "suggest": { "ext-json": "To detect JSON responses with the ContentTypePlugin",