From 9e2a45d08e1e58af16cd19e0b7ca4d19b9d6d9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20DELSOL?= Date: Wed, 21 Dec 2022 00:08:11 +0100 Subject: [PATCH] Initialize SonarCloud --- .github/workflows/sonars.yml | 57 ++++++++++++++++++++++++++++++++++++ docker-compose.yml | 2 -- 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/sonars.yml diff --git a/.github/workflows/sonars.yml b/.github/workflows/sonars.yml new file mode 100644 index 0000000..c6332d2 --- /dev/null +++ b/.github/workflows/sonars.yml @@ -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.ACTIONS_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.ACTIONS_GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/docker-compose.yml b/docker-compose.yml index 7d972cf..97bd5df 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.4' - services: php: build: