Skip to content

Commit a5b5da7

Browse files
committed
Add tools to SonarCloud => Sonars
1 parent 9538c92 commit a5b5da7

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/sonars.yml

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

0 commit comments

Comments
 (0)