diff --git a/.gitattributes b/.gitattributes index 5dd7941..7bd32d3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,13 +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 CONTRIBUTING export-ignore phpspec.yml.ci export-ignore phpspec.yml.dist export-ignore -phpunit.xml.dist export-ignore diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..3df5270 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,63 @@ +name: tests + +on: + push: + pull_request: + +jobs: + tests: + name: PHP ${{ matrix.php }} + 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 }} + extensions: curl + 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 update --prefer-dist --no-interaction --no-progress --ignore-platform-reqs + if: "matrix.php == '8.0'" + + - 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 + extensions: curl + 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 92ddb38..0000000 --- a/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -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" - -before_install: - - travis_retry composer self-update - -install: - - travis_retry composer update ${COMPOSER_FLAGS} --prefer-source --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 96a7b12..812167b 100644 --- a/composer.json +++ b/composer.json @@ -15,11 +15,11 @@ } ], "require": { - "php" : "^7.1" + "php" : "^7.1 || ^8.0" }, "require-dev": { - "phpspec/phpspec": "^2.4", - "henrikbjorn/phpspec-code-coverage" : "^1.0" + "friends-of-phpspec/phpspec-code-coverage" : "^4.3.2", + "phpspec/phpspec": "^5.1.2 || ^6.2" }, "autoload": { "psr-4": { diff --git a/phpspec.yml.ci b/phpspec.yml.ci index 7a823c9..ff72926 100644 --- a/phpspec.yml.ci +++ b/phpspec.yml.ci @@ -4,7 +4,7 @@ suites: psr4_prefix: Http\Promise formatter.name: pretty extensions: - - PhpSpec\Extension\CodeCoverageExtension + FriendsOfPhpSpec\PhpSpec\CodeCoverage\CodeCoverageExtension: ~ code_coverage: format: clover output: build/coverage.xml