Skip to content

Merge pull request #1089 from PrestaShop/translation-extraction #4540

Merge pull request #1089 from PrestaShop/translation-extraction

Merge pull request #1089 from PrestaShop/translation-extraction #4540

Workflow file for this run

name: PHP tests
on: [push, pull_request]
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Check there is no syntax errors in the project
php-linter:
name: PHP Syntax check 7.1 => 8.1
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: PHP syntax checker 7.1
uses: prestashop/github-action-php-lint/7.1@master
with:
folder-to-exclude: "! -path \"./.github/*\""
- name: PHP syntax checker 7.2
uses: prestashop/github-action-php-lint/7.2@master
with:
folder-to-exclude: "! -path \"./.github/*\""
- name: PHP syntax checker 7.3
uses: prestashop/github-action-php-lint/7.3@master
with:
folder-to-exclude: "! -path \"./.github/*\""
- name: PHP syntax checker 7.4
uses: prestashop/github-action-php-lint/7.4@master
with:
folder-to-exclude: "! -path \"./.github/*\""
- name: PHP syntax checker 8.0
uses: prestashop/github-action-php-lint/8.0@master
with:
folder-to-exclude: "! -path \"./.github/*\""
- name: PHP syntax checker 8.1
uses: prestashop/github-action-php-lint/8.1@master
with:
folder-to-exclude: "! -path \"./.github/*\""
# 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.1'
- name: Checkout
uses: actions/[email protected]
- name: Cache dependencies
uses: actions/[email protected]
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
- name: Composer Install
run: composer install --prefer-dist
- name: Run PHP-CS-Fixer
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --using-cache=no
php-unit:
strategy:
matrix:
php-versions: ['7.1', '7.2','7.4','8.1']
runs-on: ubuntu-latest
name: PHP Unit
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv, ext-zip
- uses: actions/[email protected]
with:
fetch-depth: 0
- run: composer install --prefer-dist
- run: ./vendor/phpunit/phpunit/phpunit tests
# Run PHPStan against the module and a PrestaShop release
phpstan:
name: PHPStan
runs-on: ubuntu-latest
strategy:
matrix:
presta-versions: ['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', '8.0.0', 'latest']
steps:
- name: Checkout
uses: actions/[email protected]
- run: composer install
- run: composer install
working-directory: ./tests
- name: Execute PHPStan on PrestaShop (Tag ${{ matrix.presta-versions }})
run: bash tests/phpstan/phpstan.sh ${{ matrix.presta-versions }} --error-format=github
# Some scripts must be compatible with PHP 5.6 to display that the PHP version is incompatible
check-php5-scripts:
runs-on: ubuntu-latest
name: PHP 5.6 Syntax Check
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 5.6
- name: Check files syntax
run: |
for file in autoupgrade.php controllers/admin/AdminSelfUpgradeController.php classes/VersionUtils.php classes/UpgradeTools/Translator.php; do
php -l $file;
done