Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
6 changes: 6 additions & 0 deletions .github/actions/phpstorm-inspect/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM supercid/jbstorm:latest
RUN apt-get update -y
RUN apt-get install -y xsltproc
COPY *.xslt /
COPY ../entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
34 changes: 34 additions & 0 deletions .github/actions/phpstorm-inspect/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'PHPStorm Inspector'
description: 'Runs PHPStorm inspections on your codebase'
author: 'Mridang Agarwalla'
Comment thread
artiommatvejev marked this conversation as resolved.
Outdated
inputs:
target:
required: true
description: 'The directory to be inspected.'
profile:
required: true
description: 'The absolute path to the profile file.'
output:
required: true
description: 'The absolute path to spew outputs to.'
verbosity:
required: false
description: 'The verbose level. v0 - silent, v1 - verbose, v2 - most verbose.'
default: 'v2'
scope:
required: false
description: 'The inspection scope to be used. If none, all files are inspected.'
default: 'default'
noinspect :
required: false
description: 'A command delimited list of inspection output files to be skipped.'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.target }}
- ${{ inputs.profile }}
- ${{ inputs.output }}
- ${{ inputs.verbosity }}
- ${{ inputs.scope }}
- ${{ inputs.noinspect }}
37 changes: 37 additions & 0 deletions .github/actions/phpstorm-inspect/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh -l

echo "$GITHUB_WORKSPACE/.idea"

# Create output directory
mkdir -p "$3"

# Only try to copy idea.properties if it exists
if [ -f "$GITHUB_WORKSPACE/idea.properties" ]; then
cp "$GITHUB_WORKSPACE/idea.properties" /opt/ide/bin/
fi

# Setup inspection scope
if [ "$5" != "default" ]; then
for file in phpstorm.vmoptions phpstorm64.vmoptions; do
vmopts="/opt/ide/bin/$file"

# Create file if missing
if [ ! -f "$vmopts" ]; then
echo "# Auto-generated $file" > "$vmopts"
fi

echo "-Didea.analyze.scope=$5" >> "$vmopts"
done

export STUDIO_VM_OPTIONS=/opt/ide/bin/phpstorm64.vmoptions
export PHPSTORM_VM_OPTIONS=/opt/ide/bin/phpstorm64.vmoptions
fi

echo "Running inspections"
/opt/ide/bin/inspect.sh "$1" "$2" "$3" -d "$1" "-$4"

# Optional: check for output files
if [ ! -f "$3/.descriptions.xml" ]; then
echo "No XML files generated in output dir. Possibly empty inspection run or broken profile."
exit 1
fi
15 changes: 15 additions & 0 deletions .github/actions/phpstorm-inspect/files.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="iso-8859-1"/>
<!-- https://stackoverflow.com/a/5738296/304151 -->
<xsl:template match="*/text()[string-length(normalize-space()) > 0]">
<xsl:value-of select="normalize-space()"/>
</xsl:template>
<xsl:template match="*/text()[not(string-length(normalize-space()) > 0)]" />
<xsl:template match="problem">
<xsl:value-of select="file"/>
<!-- https://stackoverflow.com/a/25690036/304151 -->
<xsl:if test="position () &lt; last()">
<xsl:text>&#xA;</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
22 changes: 22 additions & 0 deletions .github/actions/phpstorm-inspect/problems.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="iso-8859-1"/>
<!-- https://stackoverflow.com/a/5738296/304151 -->
<xsl:template match="*/text()[string-length(normalize-space()) > 0]">
<xsl:value-of select="normalize-space()"/>
</xsl:template>
<xsl:template match="*/text()[not(string-length(normalize-space()) > 0)]" />
<xsl:template match="problem">
<xsl:text>::</xsl:text>
<xsl:text>warning </xsl:text>
<xsl:text>file=</xsl:text>
<xsl:value-of select="file"/>
<xsl:text>,line=</xsl:text>
<xsl:value-of select="line"/>
<xsl:text>::</xsl:text>
<xsl:value-of select="description" disable-output-escaping="yes"/>
<!-- https://stackoverflow.com/a/25690036/304151 -->
<xsl:if test="position () &lt; last()">
<xsl:text>&#xA;</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
12 changes: 6 additions & 6 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: |
composer config cache-files-dir
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -49,7 +49,7 @@ jobs:
./vendor/bin/phpcs --standard=ruleset.xml --report=checkstyle --report-file=chkphpcs.xml

- name: Archive code sniffing results
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: phpcs-xml-result
path: chkphpcs.xml
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
run: |
composer config cache-files-dir
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -100,7 +100,7 @@ jobs:
run: ./vendor/bin/phpmd . xml codesize,naming,unusedcode,controversial,design --exclude vendor,var,build,tests --reportfile pmdphpmd.xml --ignore-violations-on-exit

- name: Archive mess detection results
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: phpmd-xml-result
path: pmdphpmd.xml
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -153,7 +153,7 @@ jobs:
run: composer archive --format=zip --file=archive

- name: Archive built arhive
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: composer-zip-archive
path: archive.zip
8 changes: 4 additions & 4 deletions .github/workflows/ide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
composer config cache-files-dir
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down Expand Up @@ -63,8 +63,8 @@ jobs:
REPO_USR: ${{ secrets.REPO_USR }}
REPO_PSW: ${{ secrets.REPO_PSW }}

- name: Run PHPStorm
uses: supercid/action-phpstorm@master
- name: Run PHPStorm Inspection
uses: ./.github/actions/phpstorm-inspect
with:
target: .
profile: ./.idea/inspectionProfiles/CI.xml
Expand All @@ -74,7 +74,7 @@ jobs:

- name: Archive inspection results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: inspection-results
path: output
4 changes: 2 additions & 2 deletions .github/workflows/phan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: |
composer config cache-files-dir
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
continue-on-error: true

- name: Archive static analysis results
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: phan-analysis-results
path: chkphan.xml
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

### 5.3.2
* Update nosto/module-nostotagging package to ^8.0.0

### 5.3.1
* Add nullcheck to avoid logging errors when the current category is not a regular Magento Category

Expand Down
2 changes: 1 addition & 1 deletion Model/Service/Category/CategoryMappingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function getMagentoCategories(Store $store)
$categoriesArray = [];

$categories = $this->collectionFactory->create()
->addAttributeToSelect('*')
->addAttributeToSelect('entity_id')
->addIsActiveFilter()
->setStore($store);

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nosto/module-nostocmp",
"description": "Nosto Category Merchandising extension for Magento 2",
"type": "magento2-module",
"version": "5.3.1",
"version": "5.3.2",
"require-dev": {
"magento-ecg/coding-standard": "3.*",
"magento/module-store": "101.1.2",
Expand All @@ -25,7 +25,7 @@
],
"minimum-stability": "dev",
"require": {
"nosto/module-nostotagging": "^7.0",
"nosto/module-nostotagging": "^8.0",
"nosto/php-sdk": ">=5.5.0",
"php": ">=7.4",
"ext-json": "*"
Expand Down
42 changes: 21 additions & 21 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<!--suppress XmlUnboundNsPrefix -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Nosto_Cmp" setup_version="5.3.1">
<module name="Nosto_Cmp" setup_version="5.3.2">
<sequence>
<module name="Nosto_Tagging"/>
</sequence>
Expand Down
Loading