Skip to content

Commit

Permalink
Initialize SonarCloud
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelcom committed Dec 9, 2024
1 parent 4ed9655 commit 1a62938
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 12 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/sonars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Sonars
on:
push:
branches:
- develop
- feature/*
- feat/*
- release/*
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
sonarcloud:
name: Sonars
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
statuses: write
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: xdebug

- name: Install dependencies with composer
run: composer update --no-ansi --no-interaction --no-progress

- name: Generate coverage report with phpunit
run: vendor/bin/phpunit --coverage-clover coverage.xml --log-junit report.xml

- name: Monitor coverage
uses: slavcodev/coverage-monitor-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
coverage_path: coverage.xml
threshold_alert: 90
threshold_warning: 95

- name: Codecov analyze
uses: codecov/codecov-action@v3
with:
files: coverage.xml

- name: Fix phpunit files paths
run: sed -i 's@'$GITHUB_WORKSPACE/'@''@g' coverage.xml report.xml

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.4'

services:
php:
build:
Expand Down
11 changes: 2 additions & 9 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,5 @@ sonar.organization=wsdltophp
sonar.php.coverage.reportPaths=coverage.xml
sonar.php.tests.reportPath=report.xml

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=WsdlHandler
#sonar.projectVersion=1.0

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
sonar.sources=src/
sonar.tests=tests/
2 changes: 1 addition & 1 deletion src/Wsdl.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function useParentMethodAndExternals(string $method, array $parameters
return $result;
}

protected function useExternalSchemas(string $method, array $parameters, $parentResult, bool $returnOne = false)
protected function useExternalSchemas(string $method, array $parameters, array $parentResult, bool $returnOne = false)
{
$result = $parentResult;

Expand Down

0 comments on commit 1a62938

Please sign in to comment.