Skip to content

Commit 9f05093

Browse files
authored
Merge pull request #185 from Nosto/release/6.0.0
Release/6.0.0
2 parents 973f09c + 470e76a commit 9f05093

15 files changed

Lines changed: 5619 additions & 4050 deletions

File tree

.github/workflows/action.yml

Lines changed: 104 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ jobs:
88
name: Code Sniffer
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v1
11+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
1212

1313
############################################################################
1414
- name: Set up PHP
1515
uses: shivammathur/setup-php@v2
1616
with:
17-
php-version: '7.4'
17+
php-version: '8.2'
1818
tools: composer:v2
1919
extensions: ast, bcmath, gd
2020
coverage: none
@@ -24,7 +24,7 @@ jobs:
2424
id: composer-cache
2525
run: |
2626
composer config cache-files-dir
27-
echo "::set-output name=dir::$(composer config cache-files-dir)"
27+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
2828
- uses: actions/cache@v4
2929
with:
3030
path: ${{ steps.composer-cache.outputs.dir }}
@@ -39,7 +39,7 @@ jobs:
3939
run: |
4040
composer config repositories.0 composer https://repo.magento.com
4141
composer config http-basic.repo.magento.com "$REPO_USR" "$REPO_PSW"
42-
composer install --prefer-dist --no-progress --no-suggest
42+
composer install --prefer-dist --no-progress
4343
############################################################################
4444

4545
- name: Run the sniffer
@@ -56,19 +56,19 @@ jobs:
5656

5757
- name: Report annotations
5858
id: report-annotations
59-
run: ./vendor/bin/cs2pr chkphpcs.xml
59+
run: ./vendor/bin/cs2pr --graceful-warnings chkphpcs.xml
6060

6161
phpmd:
6262
name: Mess Detect
6363
runs-on: ubuntu-latest
6464
steps:
65-
- uses: actions/checkout@v1
65+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
6666

6767
############################################################################
6868
- name: Set up PHP
6969
uses: shivammathur/setup-php@v2
7070
with:
71-
php-version: '7.4'
71+
php-version: '8.2'
7272
tools: composer:v2
7373
extensions: ast, bcmath, gd
7474
coverage: none
@@ -78,7 +78,7 @@ jobs:
7878
id: composer-cache
7979
run: |
8080
composer config cache-files-dir
81-
echo "::set-output name=dir::$(composer config cache-files-dir)"
81+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
8282
- uses: actions/cache@v4
8383
with:
8484
path: ${{ steps.composer-cache.outputs.dir }}
@@ -93,7 +93,7 @@ jobs:
9393
run: |
9494
composer config repositories.0 composer https://repo.magento.com
9595
composer config http-basic.repo.magento.com "$REPO_USR" "$REPO_PSW"
96-
composer install --prefer-dist --no-progress --no-suggest
96+
composer install --prefer-dist --no-progress
9797
############################################################################
9898

9999
- name: Run the mess detector
@@ -105,30 +105,50 @@ jobs:
105105
name: phpmd-xml-result
106106
path: pmdphpmd.xml
107107

108-
- name: Report annotations
109-
id: report-annotations
110-
run: ./vendor/bin/pmd2pr --graceful-warnings pmdphpmd.xml
108+
- name: Detect code standard violations
109+
if: always() && hashFiles('pmdphpmd.xml') != ''
110+
# pmd2pr came from mridang/pmd-annotations, which caps at php ^7.0 and so
111+
# cannot be installed on 8.2. Emit the GitHub annotations directly instead.
112+
run: |
113+
php -r "
114+
\$xml = @simplexml_load_file('pmdphpmd.xml');
115+
if (\$xml === false) { exit(0); }
116+
\$workspace = rtrim(getenv('GITHUB_WORKSPACE') ?: '', '/');
117+
foreach (\$xml->file as \$file) {
118+
\$filepath = (string)\$file['name'];
119+
if (\$workspace !== '' && strpos(\$filepath, \$workspace . '/') === 0) {
120+
\$filepath = substr(\$filepath, strlen(\$workspace) + 1);
121+
}
122+
\$filepath = str_replace(['%', \"\r\", \"\n\"], ['%25', '%0D', '%0A'], \$filepath);
123+
foreach (\$file->violation as \$violation) {
124+
\$line = (int)\$violation['beginline'];
125+
\$msg = trim((string)\$violation);
126+
\$msg = str_replace(['%', \"\r\", \"\n\"], ['%25', '%0D', '%0A'], \$msg);
127+
echo \"::notice file={\$filepath},line={\$line}::PHPMD: {\$msg}\n\";
128+
}
129+
}
130+
" || true
111131
112132
package:
113133
name: Package
114134
runs-on: ubuntu-latest
115135
steps:
116-
- uses: actions/checkout@v1
136+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
117137

118138
############################################################################
119139
- name: Set up PHP
120140
uses: shivammathur/setup-php@v2
121141
with:
122-
php-version: '7.4'
123-
tools: composer:v2.1.14, pecl
142+
php-version: '8.2'
143+
tools: composer:v2, pecl
124144
extensions: ast, bcmath, gd
125145
coverage: none
126146

127147
#https://github.com/actions/cache/blob/master/examples.md#php---composer
128148
- name: Cache composer packages
129149
id: composer-cache
130150
run: |
131-
echo "::set-output name=dir::$(composer config cache-files-dir)"
151+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
132152
- uses: actions/cache@v4
133153
with:
134154
path: ${{ steps.composer-cache.outputs.dir }}
@@ -143,17 +163,83 @@ jobs:
143163
run: |
144164
composer config repositories.0 composer https://repo.magento.com
145165
composer config http-basic.repo.magento.com "$REPO_USR" "$REPO_PSW"
166+
# The companion Nosto modules are declared with --no-update on purpose: the
167+
# constraints are written into the archived composer.json without being
168+
# resolved. Resolving is unnecessary here (`composer archive` only zips this
169+
# package's own files and needs no vendor/) and would fail the lock
170+
# consistency check, since these packages are deliberately not in composer.lock.
146171
composer require --no-update nosto/module-nostotagging:@stable
147172
composer require --no-update nosto/module-nosto-msi:@stable
148173
composer require --no-update nosto/module-nosto-itp:@stable
149-
composer install --prefer-dist --no-progress --no-suggest
150174
############################################################################
151175

152176
- name: Build archive using composer
153177
run: composer archive --format=zip --file=archive
154178

155-
- name: Archive built arhive
179+
- name: Archive built archive
156180
uses: actions/upload-artifact@v4
157181
with:
158182
name: composer-zip-archive
159183
path: archive.zip
184+
185+
# Magento 2.4.8 pins php to ~8.2.0||~8.3.0||~8.4.0, so a normal Magento install cannot
186+
# run on 8.5 yet. This lane runs on PHP 8.5 without installing Magento; it only lints the
187+
# repository and runs PHPCompatibility in an isolated directory to keep the module 8.5-clean
188+
# ahead of Magento allowing 8.5.
189+
php-compat:
190+
name: PHP 8.2-8.5 Compatibility
191+
runs-on: ubuntu-latest
192+
steps:
193+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
194+
195+
- name: Set up PHP
196+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
197+
with:
198+
php-version: '8.5'
199+
tools: composer:v2
200+
coverage: none
201+
202+
- name: Cache composer packages
203+
id: composer-cache
204+
run: |
205+
composer config cache-files-dir
206+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
207+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
208+
with:
209+
path: ${{ steps.composer-cache.outputs.dir }}
210+
key: ${{ runner.os }}-composer-phpcompat-${{ hashFiles('**/composer.json') }}
211+
restore-keys: |
212+
${{ runner.os }}-composer-phpcompat-
213+
214+
- name: Lint every source file under PHP 8.5
215+
run: |
216+
find . -path ./vendor -prune -o \( -name '*.php' -o -name '*.phtml' \) -print0 \
217+
| xargs -0 -n1 -P4 php -l > /dev/null
218+
219+
- name: Install PHPCompatibility (isolated)
220+
run: |
221+
# magento/magento-coding-standard pulls magento/php-compatibility-fork, which
222+
# `replace`s phpcompatibility/php-compatibility with a 9.x-era fork that does
223+
# NOT implement the PHP 8.4/8.5 sniffs - it detects only 1 of 4 known 8.2-8.5
224+
# deprecations. Install the real sniffs in an isolated directory so this gate
225+
# actually has teeth. This also avoids needing a Magento install here at all.
226+
mkdir -p "$RUNNER_TEMP/phpcompat"
227+
composer --working-dir="$RUNNER_TEMP/phpcompat" init --no-interaction --name=tmp/phpcompat
228+
composer --working-dir="$RUNNER_TEMP/phpcompat" config \
229+
allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
230+
composer --working-dir="$RUNNER_TEMP/phpcompat" require --no-interaction --quiet \
231+
squizlabs/php_codesniffer:^3.13 \
232+
phpcompatibility/php-compatibility:^10.0@alpha \
233+
staabm/annotate-pull-request-from-checkstyle:^1.1
234+
235+
- name: Run the compatibility sniffs
236+
run: |
237+
PHPCS="$RUNNER_TEMP/phpcompat/vendor/bin/phpcs"
238+
"$PHPCS" --standard=ruleset-phpcompat.xml \
239+
--report=checkstyle --report-file=chkphpcompat.xml || true
240+
"$PHPCS" --standard=ruleset-phpcompat.xml --report=full
241+
242+
- name: Report annotations
243+
if: always() && hashFiles('chkphpcompat.xml') != ''
244+
run: |
245+
"$RUNNER_TEMP/phpcompat/vendor/bin/cs2pr" chkphpcompat.xml

.github/workflows/ide.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v1
12+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
1313

1414
############################################################################
1515
- name: Set up PHP
1616
uses: shivammathur/setup-php@v2
1717
with:
18-
php-version: '7.4'
18+
php-version: '8.2'
1919
tools: composer:v2, pecl
2020
extensions: bcmath, gd, pdo_mysql, soap, zip, ast
2121
coverage: none
@@ -25,7 +25,7 @@ jobs:
2525
id: composer-cache
2626
run: |
2727
composer config cache-files-dir
28-
echo "::set-output name=dir::$(composer config cache-files-dir)"
28+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
2929
- uses: actions/cache@v4
3030
with:
3131
path: ${{ steps.composer-cache.outputs.dir }}
@@ -40,13 +40,13 @@ jobs:
4040
run: |
4141
composer config repositories.0 composer https://repo.magento.com
4242
composer config http-basic.repo.magento.com "$REPO_USR" "$REPO_PSW"
43-
composer install --prefer-dist --no-progress --no-suggest
43+
composer install --prefer-dist --no-progress
4444
############################################################################
4545

4646
- name: Install Magento
4747
id: install-magento
4848
run: |
49-
composer create-project magento/community-edition=2.4.5 magento --no-dev
49+
composer create-project magento/community-edition=2.4.8 magento --no-dev
5050
cd magento
5151
composer config minimum-stability dev
5252
composer config prefer-stable true

.github/workflows/phan.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v1
12+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
1313

1414
############################################################################
1515
- name: Set up PHP
1616
uses: shivammathur/setup-php@v2
1717
with:
18-
php-version: '7.4'
18+
php-version: '8.2'
1919
tools: composer:v2, pecl
2020
extensions: ast, bcmath, gd, pdo_mysql, soap, zip
2121
coverage: none
@@ -24,7 +24,7 @@ jobs:
2424
id: composer-cache
2525
run: |
2626
composer config cache-files-dir
27-
echo "::set-output name=dir::$(composer config cache-files-dir)"
27+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
2828
- uses: actions/cache@v4
2929
with:
3030
path: ${{ steps.composer-cache.outputs.dir }}
@@ -39,13 +39,13 @@ jobs:
3939
run: |
4040
composer config repositories.0 composer https://repo.magento.com
4141
composer config http-basic.repo.magento.com "$REPO_USR" "$REPO_PSW"
42-
composer install --prefer-dist --no-progress --no-suggest
42+
composer install --prefer-dist --no-progress
4343
############################################################################
4444

4545
- name: Install Magento
4646
id: install-magento
4747
run: |
48-
composer create-project magento/community-edition=2.4.5 magento --no-dev
48+
composer create-project magento/community-edition=2.4.8 magento --no-dev
4949
cd magento
5050
composer config minimum-stability dev
5151
composer config prefer-stable true
@@ -73,4 +73,4 @@ jobs:
7373

7474
- name: Report annotations
7575
id: report-annotations
76-
run: ./vendor/bin/cs2pr chkphan.xml
76+
run: ./vendor/bin/cs2pr --graceful-warnings chkphan.xml

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
22

3+
### 6.0.0
4+
* Add support for PHP 8.5 for compatibility with Nosto_Tagging module version 9, drop PHP 8.1 support and below
5+
36
### 5.4.0
47
* Add compatibility with OpenSearch implementation
58

Exception/CmpException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ abstract class CmpException extends Exception
4848
* @param int $code
4949
* @param Throwable|null $previous
5050
*/
51-
public function __construct(Store $store, $message, $code = 0, Throwable $previous = null)
51+
public function __construct(Store $store, $message, $code = 0, ?Throwable $previous = null)
5252
{
5353
parent::__construct($this->buildMessage($store, $message), $code, $previous);
5454
}

Exception/SessionCreationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class SessionCreationException extends CmpException
4747
* @param Store $store
4848
* @param Throwable|null $previous
4949
*/
50-
public function __construct(Store $store, Throwable $previous = null)
50+
public function __construct(Store $store, ?Throwable $previous = null)
5151
{
5252
parent::__construct($store, self::DEFAULT_MESSAGE, 0, $previous);
5353
}

Helper/Data.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function __construct(
9595
* @param Store|null $store the store model or null.
9696
* @return bool the configuration value
9797
*/
98-
public function isCategorySortingEnabled(Store $store = null)
98+
public function isCategorySortingEnabled(?Store $store = null)
9999
{
100100
return (bool)$this->getStoreConfig(self::XML_PATH_CATEGORY_SORTING, $store);
101101
}
@@ -106,7 +106,7 @@ public function isCategorySortingEnabled(Store $store = null)
106106
* @param Store|null $store the store model or null.
107107
* @return bool the configuration value
108108
*/
109-
public function isAllCategoriesMapEnabled(Store $store = null)
109+
public function isAllCategoriesMapEnabled(?Store $store = null)
110110
{
111111
return (bool)$this->getStoreConfig(self::XML_PATH_CATEGORY_MAPPING, $store);
112112
}
@@ -117,7 +117,7 @@ public function isAllCategoriesMapEnabled(Store $store = null)
117117
* @param Store|null $store the store model or null.
118118
* @return string
119119
*/
120-
public function getFallbackSorting(Store $store = null)
120+
public function getFallbackSorting(?Store $store = null)
121121
{
122122
return $this->getStoreConfig(self::XML_PATH_FALLBACK_SORTING, $store);
123123
}
@@ -128,7 +128,7 @@ public function getFallbackSorting(Store $store = null)
128128
* @param Store|null $store the store model or null.
129129
* @return integer
130130
*/
131-
public function getMaxProductLimit(Store $store = null)
131+
public function getMaxProductLimit(?Store $store = null)
132132
{
133133
return (int)$this->getStoreConfig(self::XML_PATH_CATEGORY_MAX_PRODUCT_LIMIT, $store);
134134
}
@@ -138,7 +138,7 @@ public function getMaxProductLimit(Store $store = null)
138138
* @param Store|null $store
139139
* @return mixed|null
140140
*/
141-
public function getStoreConfig(string $path, Store $store = null)
141+
public function getStoreConfig(string $path, ?Store $store = null)
142142
{
143143
if ($store === null) {
144144
$store = $this->nostoHelperScope->getStore(true);

0 commit comments

Comments
 (0)