diff --git a/.gitattributes b/.gitattributes index 0a6cc4f..dce4be7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,6 @@ -/build export-ignore +/.github export-ignore /tests export-ignore -/vendor export-ignore .gitattributes export-ignore .gitignore export-ignore -.travis.yml export-ignore phpunit.xml.dist export-ignore cs-fixer.php.dist export-ignore diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..581eab0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,110 @@ +name: build +on: [push, pull_request] + +jobs: + full-build: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: [ubuntu-latest] + php-versions: ["7.4"] + env: + extensions: pcov, dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter + key: cache-v2 + steps: + - name: "Checkout" + uses: actions/checkout@v2 + - name: "Setup PHP extensions cache environment" + id: cache-env + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ matrix.php-versions }} + extensions: ${{ env.extensions }} + key: ${{ env.key }} + - name: "Cache PHP extensions" + uses: actions/cache@v2 + with: + path: ${{ steps.cache-env.outputs.dir }} + key: ${{ steps.cache-env.outputs.key }} + restore-keys: ${{ steps.cache-env.outputs.key }} + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: pcov + extensions: ${{ env.extensions }} + ini-values: assert.exception=1, zend.assertions=1 + - name: "Validate composer.json" + run: composer validate + - name: "Set composer cache directory" + id: composer-cache-full-build + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: "Setup composer cache" + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache-full-build.outputs.dir }} + key: ${{ runner.os }}-composer-full-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer-full- + - name: "Install highest dependencies" + run: composer update --no-interaction --no-ansi --no-progress --no-suggest --prefer-stable + - name: "Coding standard Php-CS-Fixer checks" + run: vendor/bin/php-cs-fixer --dry-run -v --config=cs-fixer.php.dist --path-mode=intersection fix src tests + - name: "Coding standard CodeSniffer checks" + run: | + vendor/bin/phpcs --extensions=php --standard=vendor/polymorphine/dev/phpcs.xml src + vendor/bin/phpcs --extensions=php --standard=vendor/polymorphine/dev/phpcs.xml tests + - name: "Run PhpUnit tests with coverage" + run: | + mkdir -p build/logs + vendor/bin/phpunit --coverage-clover build/logs/clover.xml + - name: "Send coverage report to coveralls.io" + run: vendor/bin/php-coveralls -v + env: + COVERALLS_RUN_LOCALLY: 1 + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + + lowest-build: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: [ubuntu-latest] + php-versions: ["7.4"] + env: + extensions: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter + key: cache-v2 + steps: + - name: "Checkout" + uses: actions/checkout@v2 + - name: "Setup PHP extensions cache environment" + id: cache-env + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ matrix.php-versions }} + extensions: ${{ env.extensions }} + key: ${{ env.key }} + - name: "Cache PHP extensions" + uses: actions/cache@v2 + with: + path: ${{ steps.cache-env.outputs.dir }} + key: ${{ steps.cache-env.outputs.key }} + restore-keys: ${{ steps.cache-env.outputs.key }} + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: none + extensions: ${{ env.extensions }} + ini-values: assert.exception=1, zend.assertions=1 + - name: "Set composer cache directory" + id: composer-cache-lowest-build + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: "Setup composer cache" + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache-lowest-build.outputs.dir }} + key: ${{ runner.os }}-composer-low-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer-low- + - name: "Install lowest dependencies" + run: composer update --no-interaction --no-ansi --no-progress --no-suggest --prefer-stable --prefer-lowest + - name: "Run PhpUnit tests (no coverage)" + run: vendor/bin/phpunit --no-coverage diff --git a/.gitignore b/.gitignore index 868e62a..3ef0b19 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea/ vendor/ build/ +temp/ /composer.lock diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9e8f605..0000000 --- a/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -language: php - -php: - - 7.1 - -env: - - TEST_TYPE="cover" STABILITY="--prefer-lowest --prefer-stable" - - TEST_TYPE="style" STABILITY="" - -before_install: - - if [ "$TEST_TYPE" = "style" ]; then phpenv config-rm xdebug.ini; fi; - - composer self-update - -before_script: - - | - run_tests() { - if [ "$TEST_TYPE" = "style" ]; then - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - COMMIT_RANGE=$TRAVIS_COMMIT_RANGE; - else - COMMIT_RANGE="HEAD~..HEAD"; - fi; - CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB $COMMIT_RANGE); - - composer style-check src $CHANGED_FILES; - composer style-check tests $CHANGED_FILES; - phpunit --no-coverage; - else - mkdir -p build/logs; - phpunit; - fi; - } - - composer update $STABILITY -script: - - run_tests - -after_success: - - if [ "$TEST_TYPE" = "cover" ]; then php vendor/bin/php-coveralls; fi; diff --git a/README.md b/README.md index 6d07b68..bbd4b23 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # Polymorphine/Headers -[![Build Status](https://travis-ci.org/shudd3r/polymorphine-headers.svg?branch=develop)](https://travis-ci.org/shudd3r/polymorphine-headers) -[![Coverage Status](https://coveralls.io/repos/github/shudd3r/polymorphine-headers/badge.svg?branch=develop)](https://coveralls.io/github/shudd3r/polymorphine-headers?branch=develop) -[![PHP from Packagist](https://img.shields.io/packagist/php-v/polymorphine/headers/dev-develop.svg)](https://packagist.org/packages/polymorphine/headers) -[![Packagist](https://img.shields.io/packagist/l/polymorphine/headers.svg)](https://packagist.org/packages/polymorphine/headers) +[![Latest Stable Version](https://poser.pugx.org/polymorphine/headers/version)](https://packagist.org/packages/polymorphine/headers) +[![Build status](https://github.com/polymorphine/headers/workflows/build/badge.svg)](https://github.com/polymorphine/headers/actions) +[![Coverage status](https://coveralls.io/repos/github/polymorphine/headers/badge.svg?branch=develop)](https://coveralls.io/github/polymorphine/headers?branch=develop) +[![PHP version](https://img.shields.io/packagist/php-v/polymorphine/headers.svg)](https://packagist.org/packages/polymorphine/headers) +[![LICENSE](https://img.shields.io/github/license/polymorphine/headers.svg?color=blue)](LICENSE) ### HTTP Response headers middleware ### Installation with [Composer](https://getcomposer.org/) diff --git a/composer.json b/composer.json index 023f0b8..0d36f72 100644 --- a/composer.json +++ b/composer.json @@ -4,15 +4,13 @@ "type": "library", "minimum-stability": "stable", "require": { - "php": "^7.1", + "php": "^7.4", "psr/http-message": "^1.0", "psr/http-server-handler": "^1.0", "psr/http-server-middleware": "^1.0" }, "require-dev": { - "polymorphine/cs": "@dev", - "phpunit/phpunit": "^7.0", - "php-coveralls/php-coveralls": "^2.0" + "polymorphine/dev": "0.1.*" }, "license": "MIT", "authors": [ @@ -30,9 +28,5 @@ "psr-4": { "Polymorphine\\Headers\\Tests\\": "tests/" } - }, - "scripts": { - "run-tests": "phpunit --configuration phpunit.xml.dist", - "style-check": "polymorphine-cs" } } diff --git a/cs-fixer.php.dist b/cs-fixer.php.dist index f3164f7..e959b16 100644 --- a/cs-fixer.php.dist +++ b/cs-fixer.php.dist @@ -1,5 +1,14 @@ + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +use Polymorphine\Dev\FixerFactory; return FixerFactory::createFor('Polymorphine/Headers', __DIR__); diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 41db742..8795ecd 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,27 +1,22 @@ - - - + ./tests/ - - + + ./src/ - - - - - - + +