File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : SonarCloud
2+
3+ on :
4+ push :
5+ branches : [ 'main' ]
6+ pull_request :
7+ types : [ 'opened', 'synchronize', 'reopened' ]
8+
9+ jobs :
10+ sonarcloud :
11+ name : SonarCloud Analysis
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout source code
16+ uses : actions/checkout@v3
17+ with :
18+ fetch-depth : 0
19+
20+ - name : Set up PHP
21+ uses : shivammathur/setup-php@v2
22+ with :
23+ php-version : ' 8.3'
24+ coverage : xdebug
25+ tools : composer:v2
26+
27+ - name : Install dependencies
28+ run : composer install --prefer-dist --no-progress
29+
30+ - name : Run PHPUnit with coverage
31+ run : ./vendor/bin/phpunit --coverage-clover=coverage.xml --log-junit=test.xml
32+
33+ - name : Fix paths in coverage reports for Sonar
34+ run : |
35+ sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
36+ sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' test.xml
37+
38+ - name : Run SonarCloud Scan
39+ uses : SonarSource/sonarcloud-github-action@v2
40+ with :
41+ projectBaseDir : .
42+ env :
43+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
44+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
Original file line number Diff line number Diff line change 4646
4747 - name : Execute Unit, Integration and Acceptance Tests
4848 run : composer test
49-
50- - name : Fix coverage.xml for Sonar
51- run : |
52- sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
53- sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' test.xml
54-
55- - name : SonarCloud Scan
56- uses : SonarSource/sonarcloud-github-action@master
57- env :
58- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
59- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
You can’t perform that action at this time.
0 commit comments