name: Sonarcloud on: pull_request: push: branches: - main - develop jobs: sonarcloud: name: SonarCloud runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Setup PHP with Xdebug uses: shivammathur/setup-php@v2 with: php-version: '8.2' coverage: xdebug - name: Install Composer dependencies run: composer install --prefer-dist --no-interaction --no-progress --no-scripts - name: Copy environment file run: cp .env.example .env - name: Generate app key run: php artisan key:generate - name: "Run tests with coverage" run: composer coverage - name: Fix code coverage paths run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}