Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 100 additions & 54 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,135 @@
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
name: PHP Syntax check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: PHP syntax checker 5.6
uses: prestashop/github-action-php-lint/5.6@master
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.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: Setup PHP
uses: shivammathur/setup-php@v2
- name: Run PHP-CS-Fixer
uses: PrestaShop/.github/.github/actions/php-ci/php-cs@master
with:
php-version: '7.4'

- name: Checkout
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v4
# Run PHPStan against the module (PHP 7.4 – 8.1)
phpstan-74:
name: PHPStan (PHP 7.4 - 8.1)
runs-on: ubuntu-latest
strategy:
matrix:
presta_version: ['8.1.7', '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: 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 and a PrestaShop release
phpstan:
name: PHPStan
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-80-84:
name: PHPStan (PHP 8.1 - 8.4 )
runs-on: ubuntu-latest
strategy:
matrix:
presta-versions: ['1.7.1.2', '1.7.2.5', '1.7.3.4', '1.7.4.4', '1.7.5.1', '1.7.6', '1.7.7', '1.7.8', 'latest']
presta_version: ['9.0.x']
php_version: ['8.1', '8.4']
fail-fast: false
env:
PHPRC: ${{ github.workspace }}/${{ github.event.repository.name }}/.phpstan-php-ini
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
- name: Checkout repository
uses: actions/checkout@v6
with:
php-version: '7.4'

- name: Checkout
uses: actions/checkout@v4

# Add vendor folder in cache to make next builds faster
- name: Cache vendor folder
uses: actions/cache@v4
path: ${{ github.event.repository.name }}

- name: Prepare PHP env for PrestaShop 9.0.x (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:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
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

# Add composer local folder in cache to make next builds faster
- name: Cache composer folder
uses: actions/cache@v4
# 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: ~/.composer/cache
key: php-composer-cache

- 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 }}
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Keep in touch with your customers the way you want, add a form to the homepage o

## Compatibility

PrestaShop: `1.7.1.0` or later
PrestaShop: `8.1.0` or later

## Multistore compatibility

Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
}
],
"require": {
"php": ">=5.4"
"php": ">=7.1"
},
"require-dev": {
"prestashop/php-dev-tools": "^3.4"
},
"config": {
"platform": {
"php": "7.1.0"
},
"preferred-install": "dist",
"prepend-autoloader": false
},
Expand Down
Loading