diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88e3d0a..3f0f499 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,12 @@ name: Continuous Integration + on: + workflow_dispatch: push: - branches: [ main ] + branches: [ main ] + tags: [ v* ] pull_request: - branches: [ main ] jobs: run-tests: @@ -59,10 +61,12 @@ jobs: run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Execute tests (Unit and Feature) - run: vendor/bin/phpunit + run: vendor/bin/phpunit --log-junit=reports/report-phpunit.xml --coverage-clover=reports/coverage-phpunit.xml - name: Static analysis with PHPStan - run: vendor/bin/phpstan analyse + run: | + vendor/bin/phpstan analyse --error-format=github + vendor/bin/phpstan analyse --error-format=json > reports/phpstan.json - name: Static analysis with Psalm if: "${{ matrix.experimental == false }}" @@ -70,3 +74,16 @@ jobs: - name: Coding style PSR12 Check run: vendor/bin/phpcs + + - name: 'Run SonarQube cloud scanner' + if: ${{contains(github.ref, '/pull/')}} + uses: SonarSource/sonarqube-scan-action@v5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: 'Run SonarQube cloud scanner' + if: ${{!contains(github.ref, '/pull/')}} + uses: SonarSource/sonarqube-scan-action@v5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + args: -Dsonar.branch.name=${{ github.ref_name }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..ecbaa6e --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,20 @@ +# Project info +sonar.organization=vws +sonar.projectKey=nl-rdo-openid-connect-php-laravel + +# Info links shown in SonarCloud +sonar.links.homepage=https://github.com/minvws/nl-rdo-openid-connect-php-laravel + +# Encoding and language specific properties +sonar.sourceEncoding=UTF-8 + +# Analysis scoping +sonar.sources=src,config,routes +sonar.tests=tests + +# Code coverage +sonar.php.tests.reportPath=reports/report-phpunit.xml +sonar.php.coverage.reportPaths=reports/coverage-phpunit.xml + +# Additional reports +sonar.php.phpstan.reportPaths=reports/phpstan.json \ No newline at end of file