11name : ci
22on :
3- push :
3+ pull_request :
44 branches :
5+ - develop
56 - master
6- pull_request :
7+ push :
78 branches :
9+ - develop
810 - master
911
1012jobs :
@@ -18,15 +20,15 @@ jobs:
1820 - 6379:6379
1921 strategy :
2022 matrix :
21- php-versions : ['7.3', '8.0']
23+ version : ['7.3', '8.0']
2224 steps :
2325 - name : Checkout code
2426 uses : actions/checkout@v2
2527
2628 - name : Setup PHP
2729 uses : shivammathur/setup-php@v2
2830 with :
29- php-version : ${{ matrix.php-versions }}
31+ php-version : ${{ matrix.version }}
3032 extensions : mbstring, intl
3133 ini-values : post_max_size=256M, max_execution_time=180
3234 coverage : xdebug
3739 composer update
3840 composer dumpautoload
3941
40- - name : script
42+ - name : Build
4143 run : |
4244 vendor/bin/phpcs --ignore=functions.php --standard=PSR2 src/
4345 vendor/bin/phpunit -c phpunit.xml.dist -v --testsuite integration
46+
47+ sonarqube :
48+ name : Sonarqube
49+ runs-on : ubuntu-latest
50+ steps :
51+ - name : Checkout code
52+ uses : actions/checkout@v2
53+ with :
54+ fetch-depth : 0
55+
56+ - name : SonarQube Scan (Push)
57+ if : github.event_name == 'push'
58+ uses : SonarSource/sonarcloud-github-action@v1.5
59+ env :
60+ SONAR_TOKEN : ${{ secrets.SONARQUBE_TOKEN }}
61+ with :
62+ projectBaseDir : .
63+ args : >
64+ -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
65+ -Dsonar.projectName=${{ github.event.repository.name }}
66+ -Dsonar.projectKey=splitsoftware_split-sdk-php
67+ -Dsonar.exclusions="**/tests/**/*.*"
68+ -Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
69+ -Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
70+
71+ - name : SonarQube Scan (Pull Request)
72+ if : github.event_name == 'pull_request'
73+ uses : SonarSource/sonarcloud-github-action@v1.5
74+ env :
75+ SONAR_TOKEN : ${{ secrets.SONARQUBE_TOKEN }}
76+ with :
77+ projectBaseDir : .
78+ args : >
79+ -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
80+ -Dsonar.projectName=${{ github.event.repository.name }}
81+ -Dsonar.projectKey=splitsoftware_split-sdk-php
82+ -Dsonar.exclusions="**/tests/**/*.*"
83+ -Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
84+ -Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
85+ -Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
86+ -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
87+ -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
0 commit comments