From 9fb7abb4f1f6ca25c1b52a6fefb4071403ae22e6 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 26 Jun 2026 08:54:03 +0200 Subject: [PATCH] Support PHP 7.2 => 8.5 --- .github/workflows/php.yml | 306 +++++++++++++++++++------------------- 1 file changed, 149 insertions(+), 157 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 555a927..4f06b61 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -1,160 +1,152 @@ +--- 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.2 - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2.0.0 - - - 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 - - - name: PHP syntax checker 8.2 - uses: prestashop/github-action-php-lint/8.2@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@v2.0.0 - - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: vendor - key: php-${{ hashFiles('composer.lock') }} - - - 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 (PHP 7.4 – PS 8.2) - phpstan-74-81: - name: PHPStan (PHP 7.4 - 8.1) - runs-on: ubuntu-latest - strategy: - matrix: - presta_version: ['8.2.x'] - php_version: ['7.4', '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.4) - phpstan-81-84: - name: PHPStan (PHP 8.1 - 8.4) - runs-on: ubuntu-latest - strategy: - matrix: - presta_version: ['9.0.3'] - php_version: ['8.1', '8.4'] - 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 9.1.x and later (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 - - # Run PHPStan against the module (PHP 8.1 – 8.5) - phpstan: - name: PHPStan (PHP 8.1 - 8.5) - runs-on: ubuntu-latest - strategy: - matrix: - presta_version: ['9.1.x', 'develop'] - php_version: ['8.1', '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 9.1.x and later (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 \ No newline at end of file + # Check there is no syntax errors in the project + php-linter: + name: PHP Syntax check 7.2 => 8.5 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3.1.0 + + - 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.4 – PS 8.2) + phpstan-74-81: + name: PHPStan (PHP 7.4 - 8.1) + runs-on: ubuntu-latest + strategy: + matrix: + presta_version: ['8.2.x'] + php_version: ['7.4', '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.4) + phpstan-81-84: + name: PHPStan (PHP 8.1 - 8.4) + runs-on: ubuntu-latest + strategy: + matrix: + presta_version: ['9.0.3'] + php_version: ['8.1', '8.4'] + 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 9.1.x and later (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 + + # Run PHPStan against the module (PHP 8.1 – 8.5) + phpstan: + name: PHPStan (PHP 8.1 - 8.5) + runs-on: ubuntu-latest + strategy: + matrix: + presta_version: ['9.1.x', 'develop'] + php_version: ['8.1', '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 9.1.x and later (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 \ No newline at end of file