diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index e66ef2a..d311599 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -1,14 +1,38 @@ name: Test -on: [push] +on: + pull_request: + branches: ["master"] + paths-ignore: + - "README.md" + - ".gitignore" + - "LICENSE.md" + push: + branches: ["master"] + jobs: test: - - name: Test PHP ${{ matrix.php-versions }} + name: Test PHP ${{ matrix.php.version }} ${{ matrix.php.composer }} runs-on: ubuntu-latest strategy: matrix: - php-versions: ['8.0', '8.1', '8.2', '8.3'] + php: + - version: '8.1' + composer: --prefer-lowest + - version: '8.2' + composer: --prefer-lowest + - version: '8.3' + composer: --prefer-lowest + #- version: '8.4' + # composer: --prefer-lowest + - version: '8.1' + composer: --prefer-stable + - version: '8.2' + composer: --prefer-stable + - version: '8.3' + composer: --prefer-stable + - version: '8.4' + composer: --prefer-stable steps: - uses: actions/checkout@v4 @@ -21,7 +45,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-versions }} + php-version: ${{ matrix.php.version }} extensions: curl, mbstring, intl, libxml, simplexml coverage: xdebug @@ -38,24 +62,36 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: (test -d vendor && echo vendor directory exists) || composer install --prefer-dist --no-progress --no-suggest + run: (test -d vendor && echo vendor directory exists) || composer update --no-interaction --no-scripts --no-ansi ${{ matrix.php.composer }} - name: Run PHPUnit run: vendor/bin/phpunit --coverage-text --coverage-clover clover.xml + - name: Static Analysis + if: matrix.php.version == '8.3' && matrix.php.composer == '--prefer-stable' + run: composer analyse + - name: "[Coveralls] Extract branch name" - if: matrix.php-versions == '8.3' + if: matrix.php.version == '8.3' && matrix.php.composer == '--prefer-stable' shell: bash - run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT + run: | + if [ -n "${GITHUB_HEAD_REF}" ]; then + echo "Branch from PR: ${GITHUB_HEAD_REF}" + echo "branch=${GITHUB_HEAD_REF}" >> $GITHUB_OUTPUT + else + branch_name="${GITHUB_REF#refs/heads/}" + echo "Branch from push: ${branch_name}" + echo "branch=${branch_name}" >> $GITHUB_OUTPUT + fi id: extract_branch - name: "[Coveralls] Checkout branch" - if: matrix.php-versions == '8.3' + if: matrix.php.version == '8.3' && matrix.php.composer == '--prefer-stable' shell: bash run: git fetch && git checkout ${{ steps.extract_branch.outputs.branch }} - name: "[Coveralls] Send report" - if: matrix.php-versions == '8.3' + if: matrix.php.version == '8.3' && matrix.php.composer == '--prefer-stable' run: ./vendor/bin/php-coveralls -v -x clover.xml -o coveralls-upload.json env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index b09d974..0000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,23 +0,0 @@ -build: - nodes: - analysis: - project_setup: - override: - - 'true' - tests: - override: - - php-scrutinizer-run - - - command: phpcs-run - use_website_config: true - tests: true -filter: - excluded_paths: - - 'tests/*' -checks: - php: true -coding_style: - php: { } -tools: - external_code_coverage: - timeout: 600 \ No newline at end of file diff --git a/README.md b/README.md index e66b5e4..ad1d1ae 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ With this package I'm trying to improve the crappy IGFS CG PHP Library provided [![Latest Stable Version](https://poser.pugx.org/mattiabasone/pagonline/v/stable)](https://packagist.org/packages/mattiabasone/pagonline) [![Total Downloads](https://poser.pugx.org/mattiabasone/pagonline/downloads)](https://packagist.org/packages/mattiabasone/pagonline) [![Build Status](https://img.shields.io/github/actions/workflow/status/mattiabasone/PagOnline/.github/workflows/php.yml?branch=master)](https://github.com/mattiabasone/PagOnline/actions?query=workflow%3ATest) -[![Coverage Status](https://scrutinizer-ci.com/g/mattiabasone/PagOnline/badges/coverage.png?b=master)](https://coveralls.io/github/mattiabasone/PagOnline) +[![Coverage Status](https://coveralls.io/repos/github/mattiabasone/PagOnline/badge.svg?branch=master)](https://coveralls.io/github/mattiabasone/PagOnline?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mattiabasone/PagOnline/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mattiabasone/PagOnline/?branch=master) ### Basic Usage diff --git a/composer.json b/composer.json index a4cd0b6..70466eb 100644 --- a/composer.json +++ b/composer.json @@ -29,8 +29,8 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", - "phpunit/phpunit": "^9.0|^10.0|^11.0", - "phpstan/phpstan": "^1.11", + "phpunit/phpunit": "^10.5|^11.0", + "phpstan/phpstan": "^1.11|^2.0", "illuminate/config": "^9.0|^10.0|^11.0", "orchestra/testbench": "^7.0|^8.0|^9.0", "php-coveralls/php-coveralls": "^2.7" diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..73817d2 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,5 @@ +parameters: + level: 5 + paths: + - src + - tests \ No newline at end of file