Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tools to Sonars #4

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading