diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..dd16d72 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,58 @@ +name: CI + +on: [push, pull_request] + +jobs: + run-tests: + name: Tests with PHP ${{ matrix.php-version }} (Composer ${{ matrix.dependencies }}) + runs-on: ubuntu-latest + strategy: + matrix: + include: + - php-version: 7.4 + dependencies: "--prefer-stable" + test_coverage: "yes" + - php-version: 7.4 + dependencies: "--prefer-lowest --prefer-stable" + test_coverage: "no" +# - php-version: 8.0 +# dependencies: "--prefer-stable" +# test_coverage: false +# - php-version: 8.0 +# dependencies: "--prefer-lowest --prefer-stable" +# test_coverage: false +# - php-version: 8.1 +# dependencies: "--prefer-stable" +# test_coverage: false +# - php-version: 8.1 +# dependencies: "--prefer-lowest --prefer-stable" +# test_coverage: false + + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: xdebug + tools: composer:2.4.4 + + - name: Checkout + uses: actions/checkout@v3 + + - name: Install composer dependencies + run: composer update --prefer-source ${{ matrix.dependencies }} + + - name: Run php-cs-fixer + run: vendor/bin/php-cs-fixer fix -v --diff --dry-run + + - name: Run tests (without coverage) + if: ${{ matrix.test_coverage == 'no' }} + run: vendor/bin/phpunit + + - name: Run tests (with coverage) + if: ${{ matrix.test_coverage == 'yes' }} + run: php -dzend_extension=xdebug.so ./vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml + + - name: Run coveralls + if: ${{ matrix.test_coverage == 'yes' }} + run: vendor/bin/coveralls diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 84a7020..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - - $HOME/.php-cs-fixer - -matrix: - include: - - php: 7.2 - env: - - DEPENDENCIES="--prefer-stable" - - php: 7.2 - env: - - DEPENDENCIES="--prefer-lowest --prefer-stable" - - - php: 7.3 - env: - - DEPENDENCIES="--prefer-stable" - - php: 7.3 - env: - - DEPENDENCIES="--prefer-lowest --prefer-stable" - - - php: 7.4 - env: - - DEPENDENCIES="--prefer-stable" - - TEST_COVERAGE=true - - php: 7.4 - env: - - DEPENDENCIES="--prefer-lowest --prefer-stable" - -before_script: - - phpenv config-rm xdebug.ini - - composer self-update - - composer update --prefer-source $DEPENDENCIES - -script: - - vendor/bin/php-cs-fixer fix -v --diff --dry-run - - if [[ $TEST_COVERAGE == 'true' ]]; then php -dzend_extension=xdebug.so ./vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml; else ./vendor/bin/phpunit; fi - -after_success: - - if [[ $TEST_COVERAGE == 'true' ]]; then php vendor/bin/coveralls -v; fi diff --git a/composer.json b/composer.json index a059ca1..2a696c5 100644 --- a/composer.json +++ b/composer.json @@ -30,12 +30,13 @@ "laminas/laminas-view": "^2.9.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.16.1", - "phpunit/phpunit": "^8.5.1", - "satooshi/php-coveralls": "^1.1.0", + "friendsofphp/php-cs-fixer": "^2.19.3", "laminas/laminas-console": "^2.6", "laminas/laminas-mvc": "^3.1", - "laminas/laminas-mvc-console": "^1.1.9" + "laminas/laminas-mvc-console": "^1.1.9", + "phpspec/prophecy": "^1.15", + "phpunit/phpunit": "^8.5.1", + "satooshi/php-coveralls": "^1.1.0" }, "suggest": { "laminas/laminas-mvc": "For using the router in the UriPath strategy"