Skip to content

Commit 0a4cd03

Browse files
committed
Fix sonarqube scanner
1 parent 90fc5b4 commit 0a4cd03

File tree

6 files changed

+47
-38
lines changed

6 files changed

+47
-38
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- master
77
push:
88
branches:
9+
- develop
910
- master
1011

1112
jobs:
@@ -19,68 +20,61 @@ jobs:
1920
- 6379:6379
2021
strategy:
2122
matrix:
22-
version: ['7.3', '8.0', '8.1']
23+
version:
24+
- '7.3'
25+
- '8.0'
26+
- '8.1'
27+
- '8.2'
2328
steps:
2429
- name: Checkout code
25-
uses: actions/checkout@v2
30+
uses: actions/checkout@v3
31+
with:
32+
fetch-depth: 0
2633

2734
- name: Setup PHP
2835
uses: shivammathur/setup-php@v2
2936
with:
3037
php-version: ${{ matrix.version }}
3138
extensions: mbstring, intl
3239
ini-values: post_max_size=256M, max_execution_time=180
33-
coverage: xdebug
40+
coverage: pcov
3441

3542
- name: Install dependencies
3643
run: |
3744
composer install --prefer-dist
3845
composer update
39-
composer dumpautoload
4046
4147
- name: Build
4248
run: |
4349
vendor/bin/phpcs --ignore=functions.php --standard=PSR2 src/
44-
vendor/bin/phpunit -c phpunit.xml.dist -v --testsuite integration
50+
vendor/bin/phpunit -c phpunit.xml.dist -v --testsuite integration --coverage-clover coverage.xml
4551
46-
sonarqube:
47-
name: Sonarqube
48-
runs-on: ubuntu-latest
49-
steps:
50-
- name: Checkout code
51-
uses: actions/checkout@v2
52-
with:
53-
fetch-depth: 0
52+
- name: Set VERSION env
53+
run: echo "VERSION=$(cat src/SplitIO/Version.php | grep 'const CURRENT' | cut -d "'" -f 2 | sed "s/'//g")" >> $GITHUB_ENV
5454

5555
- name: SonarQube Scan (Push)
56-
if: github.event_name == 'push'
57-
uses: SonarSource/sonarcloud-github-action@v1.5
56+
if: matrix.version == '8.2' && github.event_name
57+
uses: SonarSource/sonarcloud-github-action@v1.9
5858
env:
5959
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6061
with:
6162
projectBaseDir: .
6263
args: >
6364
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
64-
-Dsonar.projectName=${{ github.event.repository.name }}
65-
-Dsonar.projectKey=splitsoftware_split-sdk-php
66-
-Dsonar.exclusions="**/tests/**/*.*"
67-
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
68-
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
65+
-Dsonar.projectVersion=${{ env.VERSION }}
6966
7067
- name: SonarQube Scan (Pull Request)
71-
if: github.event_name == 'pull_request'
72-
uses: SonarSource/sonarcloud-github-action@v1.5
68+
if: matrix.version == '8.2' && github.event_name == 'pull_request'
69+
uses: SonarSource/sonarcloud-github-action@v1.9
7370
env:
7471
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7573
with:
7674
projectBaseDir: .
7775
args: >
7876
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
79-
-Dsonar.projectName=${{ github.event.repository.name }}
80-
-Dsonar.projectKey=splitsoftware_split-sdk-php
81-
-Dsonar.exclusions="**/tests/**/*.*"
82-
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
83-
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
77+
-Dsonar.projectVersion=${{ env.VERSION }}
8478
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
8579
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
8680
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}

.github/workflows/update-license-year.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
uses: actions/checkout@v2
1717
with:
1818
fetch-depth: 0
19-
19+
2020
- name: Set Current year
2121
run: "echo CURRENT=$(date +%Y) >> $GITHUB_ENV"
22-
22+
2323
- name: Set Previous Year
2424
run: "echo PREVIOUS=$(($CURRENT-1)) >> $GITHUB_ENV"
2525

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ test.php
2626

2727
# Sonarqube
2828
.scannerwork
29+
30+
# Tests
31+
.phpunit.result.cache
32+
coverage.xml

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to s
3939
Licensed under the Apache License, Version 2.0. See: [Apache License](http://www.apache.org/licenses/).
4040

4141
## About Split
42-
42+
4343
Split is the leading Feature Delivery Platform for engineering teams that want to confidently deploy features as fast as they can develop them. Split’s fine-grained management, real-time monitoring, and data-driven experimentation ensure that new features will improve the customer experience without breaking or degrading performance. Companies like Twilio, Salesforce, GoDaddy and WePay trust Split to power their feature delivery.
44-
44+
4545
To learn more about Split, contact hello@split.io, or get started with feature flags for free at https://www.split.io/signup.
46-
46+
4747
Split has built and maintains SDKs for:
48-
48+
4949
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
5050
* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
5151
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
@@ -56,9 +56,9 @@ Split has built and maintains SDKs for:
5656
* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
5757
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
5858
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
59-
59+
6060
For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20).
61-
61+
6262
**Learn more about Split:**
63-
63+
6464
Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information.

phpunit.xml.dist

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
<const name="TEST_PREFIX" value="SPLITIO_TEST:."/>
99
</php>
1010

11+
<filter>
12+
<whitelist>
13+
<directory suffix=".php">src</directory>
14+
</whitelist>
15+
</filter>
16+
1117
<testsuites>
1218
<testsuite name="splitio">
1319
<directory suffix="Test.php">tests/</directory>
@@ -46,8 +52,6 @@
4652
<directory suffix="Test.php">tests/Suite/Sdk/</directory>
4753
</testsuite>
4854

49-
50-
5155
<testsuite name="integration">
5256
<directory suffix="Test.php">tests/Suite/Adapter/</directory>
5357
<directory suffix="Test.php">tests/Suite/Attributes/</directory>

sonar-project.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sonar.projectName=php-client
2+
sonar.projectKey=splitsoftware_split-sdk-php
3+
sonar.sources=src
4+
sonar.tests=tests
5+
sonar.php.coverage.reportPaths=coverage.xml
6+
sonar.links.ci=https://github.com/splitio/php-client
7+
sonar.links.scm=https://github.com/splitio/php-client/actions

0 commit comments

Comments
 (0)