-
Notifications
You must be signed in to change notification settings - Fork 122
147 lines (123 loc) · 4.53 KB
/
php.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
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
}