From 3c3d232f4582861b9a57ddcfd45ab87e982ad006 Mon Sep 17 00:00:00 2001 From: Anton Fedurtsya Date: Fri, 10 Nov 2023 12:53:58 +0200 Subject: [PATCH] Configure new phpstan version and fix phpcs config Signed-off-by: Anton Fedurtsya --- .editorconfig | 2 +- .github/workflows/development.yml | 31 ++++++++++++++++++++++------- composer.json | 4 ++-- tests/PhpStan/phpstan-bootstrap.php | 8 ++++++++ tests/PhpStan/phpstan.neon | 8 ++++++++ tests/phpcs.xml | 4 ---- 6 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 tests/PhpStan/phpstan-bootstrap.php create mode 100644 tests/PhpStan/phpstan.neon diff --git a/.editorconfig b/.editorconfig index 4a1992d..e6e4945 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,7 +13,7 @@ indent_size = 4 trim_trailing_whitespace = true # Unix-style newlines with a newline ending every file -[*.yaml] +[{*.yml,*.yaml}] indent_size = 2 # Tab indentation (no size specified) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 52b6b82..91003e6 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -203,6 +203,11 @@ jobs: make down sleep 2 + - name: Cleanup style reports + run: | + perl -pi -e 's#/var/www/test-module/#./#g;' source/test-module/tests/reports/phpstan.report.json + perl -pi -e 's#/var/www/test-module/#./#g;' source/test-module/tests/reports/phpmd.report.json + - name: Upload log artifact if: always() uses: actions/upload-artifact@v3 @@ -264,7 +269,6 @@ jobs: codeception_twig: needs: [ install_shop_with_module ] - if: ${{ inputs.template_engine == 'both' || inputs.template_engine == 'twig' }} runs-on: ubuntu-latest steps: - name: Load current installation from cache @@ -320,7 +324,7 @@ jobs: sleep 2 sonarcloud: - needs: [ unit_integration_tests ] + needs: [ styles, unit_integration_tests ] if: ${{ always() && inputs.report_sonarcloud }} runs-on: ubuntu-latest steps: @@ -332,16 +336,29 @@ jobs: uses: actions/download-artifact@v3 with: name: ModuleIntegrationTestsLog-${{ inputs.php }}-${{ inputs.mysql }}-${{ inputs.template_engine }} - path: ./tests/ + path: ./testsResults/ - - name: Debug + - name: Download StylesLog artifacts + continue-on-error: true + uses: actions/download-artifact@v3 + with: + name: StylesLog-${{ inputs.php }} + path: ./stylesResults/ + + - name: Debug tests run: | ls -alh - cd tests + cd testsResults ls -alh cd source ls -alh + - name: Debug styles + run: | + ls -alh + cd stylesResults + ls -alh + - name: SonarCloud Scan uses: sonarsource/sonarcloud-github-action@master env: @@ -354,6 +371,6 @@ jobs: -Dsonar.sources=src -Dsonar.tests=tests -Dsonar.sourceEncoding=UTF-8 - -Dsonar.php.coverage.reportPaths=tests/coverage.xml + -Dsonar.php.coverage.reportPaths=testsResults/source/coverage.xml -Dsonar.cpd.php.minimumTokens=25 - -Dsonar.cpd.php.minimumLines=5 \ No newline at end of file + -Dsonar.cpd.php.minimumLines=5 diff --git a/composer.json b/composer.json index 10c461c..2eae0e0 100644 --- a/composer.json +++ b/composer.json @@ -18,14 +18,14 @@ }, "require-dev": { "phpunit/phpunit": "^9.5", - "phpstan/phpstan": "^0.12.26", "squizlabs/php_codesniffer": "3.*", "phpmd/phpmd": "^2.11", "oxid-esales/oxideshop-ce": "dev-b-7.0.x", "qossmic/deptrac-shim": "^0.24.0", "codeception/module-rest": "*", "codeception/module-phpbrowser": "*", - "codeception/module-db": "*" + "codeception/module-db": "*", + "phpstan/phpstan": "^1.10" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/tests/PhpStan/phpstan-bootstrap.php b/tests/PhpStan/phpstan-bootstrap.php new file mode 100644 index 0000000..154b635 --- /dev/null +++ b/tests/PhpStan/phpstan-bootstrap.php @@ -0,0 +1,8 @@ + ../src/ ./ - - ../migration ./tests/Codeception/Config