Skip to content

Commit 94bb88b

Browse files
authored
feat: add Sonars (#17)
1 parent 47fcae1 commit 94bb88b

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/sonars.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Sonars
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
- feature/*
7+
- feat/*
8+
- release/*
9+
pull_request:
10+
types: [ opened, synchronize, reopened ]
11+
concurrency: sonars
12+
jobs:
13+
sonarcloud:
14+
name: Sonars
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
pull-requests: write
19+
statuses: write
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup PHP with Xdebug
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: 7.4
30+
coverage: xdebug
31+
32+
- name: Install dependencies with composer
33+
run: composer update --no-ansi --no-interaction --no-progress
34+
35+
- name: Generate coverage report with phpunit
36+
run: vendor/bin/phpunit --coverage-clover coverage.xml --log-junit report.xml
37+
38+
- name: Monitor coverage
39+
uses: slavcodev/coverage-monitor-action@v1
40+
with:
41+
github_token: ${{ secrets.GITHUB_TOKEN }}
42+
coverage_path: coverage.xml
43+
threshold_alert: 95
44+
threshold_warning: 90
45+
46+
- name: Fix phpunit files paths
47+
run: sed -i 's@'$GITHUB_WORKSPACE/'@''@g' coverage.xml report.xml
48+
49+
- name: SonarCloud Scan
50+
uses: SonarSource/sonarqube-scan-action@v7
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

sonar-project.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sonar.projectKey=WsdlToPhp_PhpGenerator
2+
sonar.organization=wsdltophp
3+
sonar.php.coverage.reportPaths=coverage.xml
4+
sonar.php.tests.reportPath=report.xml
5+
6+
sonar.sources=src/
7+
sonar.tests=tests/

0 commit comments

Comments
 (0)