Skip to content

Make sure to not update to patch versions if they are not in channel.xml file #5088

Make sure to not update to patch versions if they are not in channel.xml file

Make sure to not update to patch versions if they are not in channel.xml file #5088

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/checkout@v4
- 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/checkout@v4
- name: Cache dependencies
uses: actions/cache@v4
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/checkout@v4
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/checkout@v4
- 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/checkout@v4
- 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
header-stamp:
name: Check license headers
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP 8.3
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- run: composer install
working-directory: ./tests
- name: Run Header Stamp in Dry Run mode
run: |
php ./tests/vendor/bin/header-stamp --license=./tests/vendor/prestashop/header-stamp/assets/afl.txt --exclude=vendor,node_modules,storybook/var,tests/fixtures --dry-run || {
echo "::error::Some headers are missing or incorrect. Run 'php ./tests/vendor/bin/header-stamp --license=./tests/vendor/prestashop/header-stamp/assets/afl.txt --exclude=vendor,node_modules,storybook/var,tests/fixtures' to autofix them."
exit 1
}