diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d48d71e57..981b55737 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,7 @@ name: Tests on: pull_request: + branches: [master] push: branches: [master] jobs: @@ -51,3 +52,10 @@ jobs: ../vendor/bin/phpunit --coverage-text . - name: Check code style run: vendor/bin/phpcs --standard=PEAR src/ + + - name: SonarQube Scan + if: ${{ matrix.php == '8.1' && github.actor != 'dependabot[bot]' }} + uses: SonarSource/sonarqube-scan-action@v5.2.0 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.rst b/README.rst index a8e15501a..c9e565ee4 100644 --- a/README.rst +++ b/README.rst @@ -8,6 +8,10 @@ JsonMapper - map nested JSON structures onto PHP classes :target: https://packagist.org/packages/apimatic/jsonmapper .. image:: https://github.com/apimatic/jsonmapper/workflows/Tests/badge.svg :target: https://github.com/apimatic/jsonmapper/actions?query=workflow%3ATests +.. image:: https://sonarcloud.io/api/project_badges/measure?project=apimatic_jsonmapper&metric=sqale_rating + :target: https://sonarcloud.io/summary/new_code?id=apimatic_jsonmapper +.. image:: https://sonarcloud.io/api/project_badges/measure?project=apimatic_jsonmapper&metric=vulnerabilities + :target: https://sonarcloud.io/summary/new_code?id=apimatic_jsonmapper .. image:: https://img.shields.io/packagist/l/apimatic/jsonmapper.svg?style=flat :target: https://packagist.org/packages/apimatic/jsonmapper diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..57844fccb --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,8 @@ +sonar.projectKey=apimatic_jsonmapper +sonar.projectName=PHP JsonMapper +sonar.organization=apimatic +sonar.host.url=https://sonarcloud.io +sonar.sourceEncoding=UTF-8 + +sonar.sources=src +sonar.tests=tests \ No newline at end of file