Skip to content

Commit 5676aa3

Browse files
authored
Feature/Remove codecov and add sonarcloud. (#9)
1 parent 960aab0 commit 5676aa3

File tree

6 files changed

+38
-21
lines changed

6 files changed

+38
-21
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Test
22

33
on:
4+
push:
5+
branches:
6+
- master
47
pull_request:
58
types: [ opened, synchronize, reopened ]
69

@@ -43,11 +46,12 @@ jobs:
4346
- name: Execute Unit, Integration and Acceptance Tests
4447
run: composer test
4548

46-
- name: Upload Coverage Report
47-
uses: codecov/codecov-action@v2
48-
with:
49-
token: ${{ secrets.CODECOV_TOKEN }}
50-
files: ./coverage.xml
51-
flags: unittests
52-
fail_ci_if_error: true
49+
- name: Fix coverage.xml for Sonar
50+
run: |
51+
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
5352
53+
- name: SonarCloud Scan
54+
uses: SonarSource/sonarcloud-github-action@master
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
composer.phar
22
/vendor/
33
.idea/
4-
/infrastructure
4+
/infrastructure/
5+
/coverage/
56
*[N|n]o[G|g]it*
6-
*coverage*
7+
coverage.xml
8+
test.xml
79
.phpunit.result.cache
810
composer.lock

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Criteria (a.k.a Filter)
22

33
[![Test](https://github.com/ComplexHeart/php-criteria/actions/workflows/test.yml/badge.svg)](https://github.com/ComplexHeart/php-criteria/actions/workflows/test.yml)
4-
[![codecov](https://codecov.io/gh/ComplexHeart/php-criteria/branch/main/graph/badge.svg?token=T86pvAqfl6)](https://codecov.io/gh/ComplexHeart/php-criteria)
4+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ComplexHeart_php-criteria&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=ComplexHeart_php-criteria)
5+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=ComplexHeart_php-criteria&metric=coverage)](https://sonarcloud.io/summary/new_code?id=ComplexHeart_php-criteria)
56

67
Small implementation of a filter criteria pattern in PHP for Complex Heart SDK. Compose several filters using fluent
78
interface.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131
},
3232
"scripts": {
33-
"test": "vendor/bin/pest --configuration=phpunit.xml --coverage-clover=coverage.xml",
33+
"test": "vendor/bin/pest --configuration=phpunit.xml --coverage-clover=coverage.xml --log-junit=test.xml",
3434
"analyse": "vendor/bin/phpstan analyse src --no-progress --level=5"
3535
},
3636
"config": {

phpunit.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
bootstrap="vendor/autoload.php"
55
colors="true"
66
>
7-
<testsuites>
8-
<testsuite name="Test Suite">
9-
<directory>./tests</directory>
10-
</testsuite>
11-
</testsuites>
12-
<coverage processUncoveredFiles="true">
13-
<include>
14-
<directory suffix=".php">./src</directory>
15-
</include>
16-
</coverage>
7+
<testsuites>
8+
<testsuite name="Test Suite">
9+
<directory>./tests</directory>
10+
</testsuite>
11+
</testsuites>
12+
<coverage processUncoveredFiles="true">
13+
<include>
14+
<directory suffix=".php">./src</directory>
15+
</include>
16+
</coverage>
1717
</phpunit>

sonar-project.properties

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sonar.projectName=Complex Heart Criteria
2+
sonar.projectKey=ComplexHeart_php-criteria
3+
sonar.organization=complexheart
4+
sonar.language=php
5+
sonar.sources=./src
6+
sonar.tests=./tests
7+
sonar.inclusions=./src/**
8+
sonar.exclusions=./tests/**
9+
sonar.php.coverage.reportPaths=coverage.xml
10+
sonar.php.tests.reportPaths=phpunit.xml

0 commit comments

Comments
 (0)