Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DE-55463 Sonar Qube integration #18

Merged
merged 16 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 13 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, sockets
extensions: mbstring, sockets${{ matrix.php-version == '8.1' && matrix.composer-arg == 'install' && ', xdebug' || '' }}

- name: Get composer cache directory
id: composercache
Expand All @@ -115,3 +115,15 @@ jobs:

- name: Run tests
run: composer test
if: matrix.php-version != '8.1' && matrix.composer-arg != 'install'

- name: Run tests with coverage
run: composer test-with-coverage
if: matrix.php-version == '8.1' && matrix.composer-arg == 'install'

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@master
if: matrix.php-version == '8.1' && matrix.composer-arg == 'install'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: "https://sonar.nice.com"
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
vendor/
temp/
composer.lock
.phpunit.result.cache

.phpunit.cache
coverage.xml
test-report.xml
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"fix-cs": "vendor/bin/ecs check --fix --ansi",
"phpstan": "php -dxdebug.mode=off vendor/bin/phpstan analyse --memory-limit=-1",
"phpstan-generate-baseline": "php -dxdebug.mode=off vendor/bin/phpstan analyse --memory-limit=-1 --generate-baseline",
"test": "./vendor/bin/phpunit src"
"test": "./vendor/bin/phpunit",
"test-with-coverage": "php -dxdebug.mode=coverage ./vendor/bin/phpunit --coverage-clover=coverage.xml --log-junit=test-report.xml"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
27 changes: 27 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
forceCoversAnnotation="false"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory>src</directory>
</testsuite>
</testsuites>

<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>
9 changes: 9 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sonar.projectKey=com.nicedfo.unit-of-work
sonar.projectName=unit-of-work
sonar.language=PHP
sonar.sources=src
sonar.tests=src
sonar.exclusions=**/*Test.php
sonar.test.inclusions=**/*Test.php
sonar.php.coverage.reportPaths=coverage.xml
sonar.php.tests.reportPath=test-report.xml
Loading