diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000000..65dca26d9907 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,49 @@ +name: Build +on: + push: + branches: + - 12.x + pull_request: + types: [opened, synchronize, reopened] +jobs: + sonarqube: + name: SonarQube + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + coverage: xdebug + tools: composer + + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: vendor + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: | + composer install --no-interaction --prefer-dist + + - name: Run PHPUnit with coverage + env: + XDEBUG_MODE: coverage + run: | + mkdir -p build/logs + php -d memory_limit=1G ./vendor/bin/phpunit \ + --configuration phpunit.xml.dist \ + --coverage-clover build/logs/clover.xml \ + --coverage-filter src \ + --do-not-fail-on-warning + + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v6 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000000..69c177ec3920 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,8 @@ +sonar.projectKey=AntoineCvlz_laravel-framework +sonar.organization=antoinecvlz + +sonar.sources=src +sonar.tests=tests +sonar.php.coverage.reportPaths=build/logs/clover.xml + +sonar.exclusions=vendor/**,**/node_modules/**,storage/**,build/**,.github/** \ No newline at end of file