mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Send code coverage to SonarCloud
This commit is contained in:
parent
7f0db0de04
commit
551c1f4cda
28
.github/workflows/sonarcloud.yml
vendored
28
.github/workflows/sonarcloud.yml
vendored
@ -1,5 +1,6 @@
|
|||||||
name: Sonarcloud
|
name: Sonarcloud
|
||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
@ -12,6 +13,33 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup PHP with Xdebug
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '8.2'
|
||||||
|
coverage: xdebug
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts
|
||||||
|
|
||||||
|
- name: Copy environment file
|
||||||
|
run: cp .env.example .env
|
||||||
|
|
||||||
|
- name: Generate app key
|
||||||
|
run: php artisan key:generate
|
||||||
|
|
||||||
|
- name: "Run tests with coverage"
|
||||||
|
run: composer coverage
|
||||||
|
|
||||||
|
- name: Fix code coverage paths
|
||||||
|
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
|
||||||
|
|
||||||
- name: SonarCloud Scan
|
- name: SonarCloud Scan
|
||||||
uses: SonarSource/sonarcloud-github-action@master
|
uses: SonarSource/sonarcloud-github-action@master
|
||||||
env:
|
env:
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,4 +7,4 @@ npm-debug.log
|
|||||||
yarn-error.log
|
yarn-error.log
|
||||||
.env
|
.env
|
||||||
/.ci/php-cs-fixer/vendor
|
/.ci/php-cs-fixer/vendor
|
||||||
/.ci/coverage
|
coverage.xml
|
||||||
|
@ -170,10 +170,13 @@
|
|||||||
"@php artisan firefly-iii:verify-security-alerts"
|
"@php artisan firefly-iii:verify-security-alerts"
|
||||||
],
|
],
|
||||||
"unit-test": [
|
"unit-test": [
|
||||||
"@php vendor/bin/phpunit -c phpunit.xml --testsuite unit"
|
"@php vendor/bin/phpunit -c phpunit.xml --testsuite unit --no-coverage"
|
||||||
],
|
],
|
||||||
"integration-test": [
|
"integration-test": [
|
||||||
"@php vendor/bin/phpunit -c phpunit.xml --testsuite integration"
|
"@php vendor/bin/phpunit -c phpunit.xml --testsuite integration --no-coverage"
|
||||||
|
],
|
||||||
|
"coverage": [
|
||||||
|
"@php vendor/bin/phpunit -c phpunit.xml --testsuite unit"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
|
63
phpunit.xml
63
phpunit.xml
@ -18,25 +18,46 @@
|
|||||||
~ You should have received a copy of the GNU Affero General Public License
|
~ You should have received a copy of the GNU Affero General Public License
|
||||||
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" stopOnFailure="true" processIsolation="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<coverage/>
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
|
||||||
<testsuites>
|
backupGlobals="false"
|
||||||
<testsuite name="unit">
|
backupStaticProperties="false"
|
||||||
<directory suffix="Test.php">./tests/unit</directory>
|
beStrictAboutOutputDuringTests="true"
|
||||||
</testsuite>
|
bootstrap="vendor/autoload.php"
|
||||||
<testsuite name="integration">
|
cacheDirectory=".phpunit.cache"
|
||||||
<directory suffix="Test.php">./tests/integration</directory>
|
colors="true"
|
||||||
</testsuite>
|
executionOrder="depends,defects"
|
||||||
</testsuites>
|
failOnRisky="true"
|
||||||
<php>
|
failOnWarning="true"
|
||||||
<env name="APP_ENV" value="testing"/>
|
processIsolation="false"
|
||||||
<env name="CACHE_DRIVER" value="array"/>
|
stopOnFailure="true">
|
||||||
<env name="SESSION_DRIVER" value="array"/>
|
<php>
|
||||||
<env name="QUEUE_DRIVER" value="sync"/>
|
<env name="APP_ENV" value="testing"/>
|
||||||
</php>
|
<env name="CACHE_DRIVER" value="array"/>
|
||||||
<source>
|
<env name="SESSION_DRIVER" value="array"/>
|
||||||
<include>
|
<env name="QUEUE_DRIVER" value="sync"/>
|
||||||
<directory suffix=".php">./app</directory>
|
<ini name="xdebug.mode" value="coverage"/>
|
||||||
</include>
|
</php>
|
||||||
</source>
|
<testsuites>
|
||||||
|
<testsuite name="all">
|
||||||
|
<directory suffix="Test.php">./tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="unit">
|
||||||
|
<directory suffix="Test.php">./tests/unit</directory>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="integration">
|
||||||
|
<directory suffix="Test.php">./tests/integration</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<source>
|
||||||
|
<include>
|
||||||
|
<directory suffix=".php">app</directory>
|
||||||
|
</include>
|
||||||
|
</source>
|
||||||
|
<coverage ignoreDeprecatedCodeUnits="true"
|
||||||
|
pathCoverage="true">
|
||||||
|
<report>
|
||||||
|
<clover outputFile="coverage.xml"/>
|
||||||
|
</report>
|
||||||
|
</coverage>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
@ -15,3 +15,4 @@ sonar.organization=firefly-iii
|
|||||||
sonar.projectVersion=6.0.11
|
sonar.projectVersion=6.0.11
|
||||||
sonar.sources=app,bootstrap,database,resources/assets,resources/views,routes,tests
|
sonar.sources=app,bootstrap,database,resources/assets,resources/views,routes,tests
|
||||||
sonar.sourceEncoding=UTF-8
|
sonar.sourceEncoding=UTF-8
|
||||||
|
sonar.php.coverage.reportPaths=coverage.xml
|
||||||
|
@ -38,7 +38,7 @@ trait CreatesApplication
|
|||||||
*/
|
*/
|
||||||
public function createApplication()
|
public function createApplication()
|
||||||
{
|
{
|
||||||
$app = require __DIR__ . '/../bootstrap/app.php';
|
$app = require_once __DIR__ . '/../../bootstrap/app.php';
|
||||||
|
|
||||||
$app->make(Kernel::class)->bootstrap();
|
$app->make(Kernel::class)->bootstrap();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user