From 246bd2d88ef407a41f765f098f83ae9b3ed213c5 Mon Sep 17 00:00:00 2001 From: Mattia Basone Date: Thu, 10 Apr 2025 21:17:31 +0200 Subject: [PATCH 1/7] update workflow --- .github/workflows/php.yml | 40 +++++++++++++++++++++++++++++++-------- README.md | 2 +- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index e66ef2a..9f0b313 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 }} 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,24 @@ 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: "[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 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/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 From 3a8767ea656467997c87c8186b590201985a0b6d Mon Sep 17 00:00:00 2001 From: Mattia Basone Date: Thu, 10 Apr 2025 21:26:26 +0200 Subject: [PATCH 2/7] update workflow --- .github/workflows/php.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 9f0b313..11e9cf3 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -12,7 +12,7 @@ on: jobs: test: - name: Test PHP ${{ matrix.php-versions }} + name: Test PHP ${{ matrix.php.version }} ${{ matrix.php.composer }} runs-on: ubuntu-latest strategy: matrix: @@ -70,7 +70,15 @@ jobs: - name: "[Coveralls] Extract branch name" 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" From 0a0956dd9677723fc0d385c2ccbb0e704a5f903b Mon Sep 17 00:00:00 2001 From: Mattia Basone Date: Thu, 10 Apr 2025 21:31:41 +0200 Subject: [PATCH 3/7] update scrutinizer image --- .scrutinizer.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index b09d974..a5f44fd 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,4 +1,5 @@ build: + image: default-bionic nodes: analysis: project_setup: From deb6afc752e510704496650c6381f1ce3abe54b1 Mon Sep 17 00:00:00 2001 From: Mattia Basone Date: Thu, 10 Apr 2025 21:37:19 +0200 Subject: [PATCH 4/7] update scrutinizer image --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a4cd0b6..edba54b 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", - "phpunit/phpunit": "^9.0|^10.0|^11.0", + "phpunit/phpunit": "^10.0|^11.0", "phpstan/phpstan": "^1.11", "illuminate/config": "^9.0|^10.0|^11.0", "orchestra/testbench": "^7.0|^8.0|^9.0", From d0d379219028fdb298d84f48294945a8feca6e0a Mon Sep 17 00:00:00 2001 From: Mattia Basone Date: Thu, 10 Apr 2025 21:49:58 +0200 Subject: [PATCH 5/7] update phpunit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index edba54b..e64f9d0 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", - "phpunit/phpunit": "^10.0|^11.0", + "phpunit/phpunit": "^10.5|^11.0", "phpstan/phpstan": "^1.11", "illuminate/config": "^9.0|^10.0|^11.0", "orchestra/testbench": "^7.0|^8.0|^9.0", From 702022334fe30ab75bb0c8a9763e993a4098920b Mon Sep 17 00:00:00 2001 From: Mattia Basone Date: Thu, 10 Apr 2025 22:07:23 +0200 Subject: [PATCH 6/7] remove scrutinizer config file update php 8.4 workflow --- .github/workflows/php.yml | 4 ++-- .scrutinizer.yml | 24 ------------------------ 2 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 .scrutinizer.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 11e9cf3..4f99aa1 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -23,8 +23,8 @@ jobs: composer: --prefer-lowest - version: '8.3' composer: --prefer-lowest - - version: '8.4' - composer: --prefer-lowest + #- version: '8.4' + # composer: --prefer-lowest - version: '8.1' composer: --prefer-stable - version: '8.2' diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index a5f44fd..0000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,24 +0,0 @@ -build: - image: default-bionic - 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 From 12d70b476da81a5fc5bf108b712cd3bdf6b2ac19 Mon Sep 17 00:00:00 2001 From: Mattia Basone Date: Thu, 10 Apr 2025 22:15:28 +0200 Subject: [PATCH 7/7] add another workflow --- .github/workflows/php.yml | 4 ++++ composer.json | 2 +- phpstan.neon | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 phpstan.neon diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 4f99aa1..d311599 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -67,6 +67,10 @@ jobs: - 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.version == '8.3' && matrix.php.composer == '--prefer-stable' shell: bash diff --git a/composer.json b/composer.json index e64f9d0..70466eb 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", "phpunit/phpunit": "^10.5|^11.0", - "phpstan/phpstan": "^1.11", + "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