Skip to content
Closed
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
63 changes: 27 additions & 36 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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 5.6|7.2|7.3|7.4|8.0|8.1
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v5

- name: PHP syntax checker 5.6
uses: prestashop/github-action-php-lint/5.6@master
Expand All @@ -27,60 +27,51 @@ jobs:
- 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
- uses: PrestaShop/.github/.github/actions/php-ci/php-cs@master
with:
php-version: '7.4'

- name: Checkout
uses: actions/checkout@v3.1.0

- name: Cache dependencies
uses: actions/cache@v3
phpstan:
name: PHPStan
runs-on: ubuntu-latest
strategy:
matrix:
presta-version: ['1.7.7.x', '1.7.8.x']
steps:
- name: Checkout repository
uses: actions/checkout@v5
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
path: ${{ github.event.repository.name }}

- uses: Quetzacoalt91/.github/.github/actions/php-ci/phpstan@cache
with:
php-version: '7.4'
presta-version: ${{ matrix.presta-version }}
module-name: ${{ github.event.repository.name }}
phpstan-level: '5'
phpstan-config: 'tests/phpstan/phpstan-${{ matrix.presta-version }}.neon'
phpstan-version: '^0.12'
composer-version: '2'

# Run PHPStan against the module and a PrestaShop release
phpstan:
phpstan-legacy:
name: PHPStan
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-versions: ['1.7.1.2', '1.7.2.5', '1.7.3.4', '1.7.4.4', '1.7.5.1', '1.7.6']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- name: Checkout
uses: actions/checkout@v3.1.0

# Add vendor folder in cache to make next builds faster
- name: Cache vendor folder
uses: actions/cache@v3
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}

# Add composer local folder in cache to make next builds faster
- name: Cache composer folder
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: php-composer-cache
uses: actions/checkout@v5

- run: composer install

Expand Down
5 changes: 0 additions & 5 deletions tests/phpstan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ docker volume rm -f ps-volume || true

docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:$PS_VERSION

# Clear previous instance of the module in the PrestaShop volume
echo "Clear previous module"

docker exec -t temp-ps rm -rf /var/www/html/modules/ps_mainmenu

# Run a container for PHPStan, having access to the module content and PrestaShop sources.
# This tool is outside the composer.json because of the compatibility with PHP 5.6
echo "Run PHPStan using phpstan-${PS_VERSION}.neon file"
Expand Down
9 changes: 0 additions & 9 deletions tests/phpstan/phpstan-1.7.7.neon

This file was deleted.

10 changes: 0 additions & 10 deletions tests/phpstan/phpstan-1.7.8.neon

This file was deleted.

2 changes: 0 additions & 2 deletions tests/phpstan/phpstan-latest.neon

This file was deleted.

Loading