diff --git a/.gitattributes b/.gitattributes index c47225a..533d355 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,11 +5,8 @@ /.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 /phpspec.yml.dist export-ignore -/phpunit.xml.dist export-ignore /spec/ export-ignore -/tests/ export-ignore diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..e4d0050 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,91 @@ +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 "phpdocumentor/reflection-docblock:^5.2@dev" --no-interaction --no-update + composer update --prefer-dist --prefer-stable --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 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 015fc22..0000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -language: php - -sudo: false - -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.1 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci" - - php: 7.1 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" - -before_install: - - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi - -install: - # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355 - - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi - - 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/composer.json b/composer.json index 46d4f18..ff4587a 100644 --- a/composer.json +++ b/composer.json @@ -11,15 +11,14 @@ } ], "require": { - "php": "^7.1", + "php": "^7.1 || ^8.0", "psr/cache": "^1.0", "php-http/client-common": "^1.9 || ^2.0", "php-http/message-factory": "^1.0", "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0 || ^5.0" }, "require-dev": { - "phpspec/phpspec": "^2.5", - "henrikbjorn/phpspec-code-coverage" : "^1.0" + "phpspec/phpspec": "^5.1 || ^6.0" }, "autoload": { "psr-4": { @@ -39,7 +38,5 @@ "branch-alias": { "dev-master": "1.6-dev" } - }, - "prefer-stable": true, - "minimum-stability": "dev" + } } diff --git a/phpspec.ci.yml b/phpspec.ci.yml index 4407704..bd039ca 100644 --- a/phpspec.ci.yml +++ b/phpspec.ci.yml @@ -4,7 +4,7 @@ suites: psr4_prefix: Http\Client\Common\Plugin formatter.name: pretty extensions: - - PhpSpec\Extension\CodeCoverageExtension + FriendsOfPhpSpec\PhpSpec\CodeCoverage\CodeCoverageExtension: ~ code_coverage: format: clover output: build/coverage.xml