-
Notifications
You must be signed in to change notification settings - Fork 14
CI: migrate PHPStan to PrestaShop/.github action #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jolelievre
merged 8 commits into
PrestaShop:dev
from
mattgoud:fix-ci-migrate-phpstan-to-action
Jun 11, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0fd5c77
CI: migrate PHPStan to PrestaShop/.github action
mattgoud 05535ba
CI: add ignoreErrors for pre-existing PHPStan issues on PS 8.x
mattgoud a9f4097
CI: fix php-cs-fixer and add ignoreErrors for PS 9.x PHPStan jobs
mattgoud 34e27c6
Align module on PrestaShop 8.2+ minimum (Epic #41648)
mattgoud b1fb9f8
Fix PHPStan errors instead of suppressing them (Epic #41648)
mattgoud 259968a
CI: address review - full PHP lint matrix, PHPStan floor 7.2, add PS …
mattgoud a4028b9
CI: exclude unsupported PHP 8.5 for PrestaShop 9.0.x in PHPStan matrix
mattgoud 89eac96
Bump module version to 3.0.0
mattgoud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,70 +1,123 @@ | ||
| name: PHP tests | ||
| on: [push, pull_request] | ||
| jobs: | ||
| # Check there is no syntax errors in the project | ||
| php-linter: | ||
| name: PHP Syntax check 5.6 => 8.1 | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: PHP syntax checker 5.6 | ||
| uses: prestashop/github-action-php-lint/5.6@master | ||
|
|
||
| - name: PHP syntax checker 7.2 | ||
| uses: prestashop/github-action-php-lint/7.2@master | ||
|
|
||
| - name: PHP syntax checker 7.3 | ||
| uses: prestashop/github-action-php-lint/7.3@master | ||
|
|
||
| - name: PHP syntax checker 7.4 | ||
| uses: prestashop/github-action-php-lint/7.4@master | ||
|
|
||
| - name: PHP syntax checker 8.0 | ||
| uses: prestashop/github-action-php-lint/8.0@master | ||
|
|
||
| - name: PHP syntax checker 8.1 | ||
| uses: prestashop/github-action-php-lint/8.1@master | ||
|
|
||
| # Check the PHP code follow the coding standards | ||
| php-cs-fixer: | ||
| name: PHP-CS-Fixer | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '7.4' | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Install dependencies | ||
| run: composer install | ||
|
|
||
| - name: Run PHP-CS-Fixer | ||
| run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --using-cache=no --diff-format udiff | ||
|
|
||
| # Run PHPStan against the module and a PrestaShop release | ||
| phpstan: | ||
| name: PHPStan | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| presta-versions: ['1.7.6', '1.7.7', '1.7.8', 'latest'] | ||
| steps: | ||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '7.4' | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - run: composer install | ||
|
|
||
| # Docker images prestashop/prestashop may be used, even if the shop remains uninstalled | ||
| - name: Execute PHPStan on PrestaShop (Tag ${{ matrix.presta-versions }}) | ||
| run: ./tests/phpstan.sh ${{ matrix.presta-versions }} | ||
| php-linter: | ||
| name: PHP Syntax check 7.2 => 8.5 | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: PHP syntax checker 7.2 | ||
| uses: prestashop/github-action-php-lint/7.2@master | ||
|
|
||
| - name: PHP syntax checker 7.3 | ||
| uses: prestashop/github-action-php-lint/7.3@master | ||
|
|
||
| - name: PHP syntax checker 7.4 | ||
| uses: prestashop/github-action-php-lint/7.4@master | ||
|
|
||
| - name: PHP syntax checker 8.0 | ||
| uses: prestashop/github-action-php-lint/8.0@master | ||
|
|
||
| - name: PHP syntax checker 8.1 | ||
| uses: prestashop/github-action-php-lint/8.1@master | ||
|
|
||
| - name: PHP syntax checker 8.2 | ||
| uses: prestashop/github-action-php-lint/8.2@master | ||
|
|
||
| - name: PHP syntax checker 8.3 | ||
| uses: prestashop/github-action-php-lint/8.3@master | ||
|
|
||
| - name: PHP syntax checker 8.4 | ||
| uses: prestashop/github-action-php-lint/8.4@master | ||
|
|
||
| - name: PHP syntax checker 8.5 | ||
| uses: prestashop/github-action-php-lint/8.5@master | ||
|
|
||
| # Check the PHP code follow the coding standards | ||
| php-cs-fixer: | ||
| name: PHP-CS-Fixer | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Run PHP-CS-Fixer | ||
| uses: PrestaShop/.github/.github/actions/php-ci/php-cs@master | ||
| with: | ||
| php-version: '7.4' | ||
|
|
||
| # Run PHPStan against the module (PHP 7.2 – 8.1) | ||
| phpstan-74: | ||
| name: PHPStan (PHP 7.2 - 8.1) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| presta_version: ['8.2.x'] | ||
| php_version: ['7.2', '8.1'] | ||
| fail-fast: false | ||
| env: | ||
| PHPRC: ${{ github.workspace }}/${{ github.event.repository.name }}/.phpstan-php-ini | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| path: ${{ github.event.repository.name }} | ||
|
|
||
| - name: Prepare PHP env for PrestaShop 8 (define constants before any bootstrap) | ||
| run: | | ||
| mkdir -p ${{ github.event.repository.name }}/.phpstan-php-ini | ||
| { | ||
| echo "auto_prepend_file=$GITHUB_WORKSPACE/${{ github.event.repository.name }}/tests/php/phpstan/prepend-constants.php" | ||
| echo "memory_limit=512M" | ||
| } > ${{ github.event.repository.name }}/.phpstan-php-ini/php.ini | ||
|
|
||
| - name: Run PHPStan | ||
| uses: PrestaShop/.github/.github/actions/php-ci/phpstan@master | ||
| with: | ||
| php-version: ${{ matrix.php_version }} | ||
| presta-version: ${{ matrix.presta_version }} | ||
| module-name: ${{ github.event.repository.name }} | ||
| phpstan-level: '5' | ||
| phpstan-config: tests/php/phpstan/phpstan-${{ matrix.presta_version }}.neon | ||
| phpstan-version: '^0.12' | ||
| composer-version: '2.2.18' | ||
|
|
||
| # Run PHPStan against the module (PHP 8.1 – 8.5) | ||
| phpstan: | ||
| name: PHPStan (PHP 8.1 - 8.5) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| # PrestaShop 9.0.x supports PHP 8.1 up to 8.4 (8.5 is not supported) | ||
| - { presta_version: '9.0.3', php_version: '8.1' } | ||
| - { presta_version: '9.0.3', php_version: '8.4' } | ||
| # PrestaShop 9.1.x and develop support PHP 8.1 up to 8.5 | ||
| - { presta_version: '9.1.x', php_version: '8.1' } | ||
| - { presta_version: '9.1.x', php_version: '8.5' } | ||
| - { presta_version: 'develop', php_version: '8.1' } | ||
| - { presta_version: 'develop', php_version: '8.5' } | ||
| fail-fast: false | ||
| env: | ||
| PHPRC: ${{ github.workspace }}/${{ github.event.repository.name }}/.phpstan-php-ini | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| path: ${{ github.event.repository.name }} | ||
|
|
||
| - name: Prepare PHP env for PrestaShop ${{ matrix.presta_version }} (define constants before any bootstrap) | ||
| run: | | ||
| mkdir -p ${{ github.event.repository.name }}/.phpstan-php-ini | ||
| { | ||
| echo "auto_prepend_file=$GITHUB_WORKSPACE/${{ github.event.repository.name }}/tests/php/phpstan/prepend-constants.php" | ||
| echo "memory_limit=512M" | ||
| } > ${{ github.event.repository.name }}/.phpstan-php-ini/php.ini | ||
|
|
||
| - name: Run PHPStan | ||
| uses: PrestaShop/.github/.github/actions/php-ci/phpstan@master | ||
| with: | ||
| php-version: ${{ matrix.php_version }} | ||
| presta-version: ${{ matrix.presta_version }} | ||
| module-name: ${{ github.event.repository.name }} | ||
| phpstan-level: '5' | ||
| phpstan-config: tests/php/phpstan/phpstan-${{ matrix.presta_version }}.neon | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?php | ||
|
|
||
| header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); | ||
| header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); | ||
| header('Cache-Control: no-store, no-cache, must-revalidate'); | ||
| header('Cache-Control: post-check=0, pre-check=0', false); | ||
| header('Pragma: no-cache'); | ||
| header('Location: ../'); | ||
| exit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| includes: | ||
| - %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| includes: | ||
| - %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| includes: | ||
| - %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| includes: | ||
| - %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Base PHPStan configuration for the module | ||
| # This file is included by version-specific configs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
| /** | ||
| * Defines constants required by PrestaShop config (e.g. defines_uri.inc.php) when running | ||
| * PHPStan outside a full request. Loaded via auto_prepend_file in CI for 9.x jobs. | ||
| */ | ||
| if (!defined('_THEME_NAME_')) { | ||
| define('_THEME_NAME_', 'classic'); | ||
| } | ||
| if (!defined('__PS_BASE_URI__')) { | ||
| define('__PS_BASE_URI__', '/'); | ||
| } |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.