Consolidate CI: merge jobs, add coverage to SonarQube

- Merge lint, quality-php, security, test into single php job
- Merge quality-frontend and build into single frontend job
- SonarQube: generate coverage.xml before scan

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-18 22:53:47 +01:00
parent dc3d464b17
commit dc21c6a738

View File

@@ -8,92 +8,7 @@ on:
pull_request:
jobs:
lint:
runs_on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: intl, pdo_pgsql, zip, gd, redis, imagick
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Lint Twig
run: php bin/console lint:twig templates/
- name: Lint YAML
run: php bin/console lint:yaml config/
- name: Lint Container
run: php bin/console lint:container
quality-php:
runs_on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: intl, pdo_pgsql, zip, gd, redis, imagick
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: PHPStan
run: vendor/bin/phpstan analyse src/ --level=6 --no-progress
- name: PHP CS Fixer
run: vendor/bin/php-cs-fixer fix --dry-run --diff
quality-frontend:
runs_on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '22'
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install JS dependencies
run: bun install
- name: ESLint
run: bunx eslint assets/ --ext .js,.ts
- name: Stylelint
run: bunx stylelint "assets/**/*.scss"
security:
runs_on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Security audit
run: composer audit
test:
php:
runs_on: ubuntu-latest
steps:
- name: Checkout
@@ -109,24 +24,28 @@ jobs:
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Run PHPUnit with coverage
- name: Security audit
run: composer audit
- name: Lint Twig
run: php bin/console lint:twig templates/
- name: Lint YAML
run: php bin/console lint:yaml config/
- name: Lint Container
run: php bin/console lint:container
- name: PHPStan
run: vendor/bin/phpstan analyse src/ --level=6 --no-progress
- name: PHP CS Fixer
run: vendor/bin/php-cs-fixer fix --dry-run --diff
- name: PHPUnit with coverage
run: vendor/bin/phpunit --testdox --coverage-clover coverage.xml --coverage-text
sonarqube:
runs_on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sn.esy-web.dev
build:
frontend:
runs_on: ubuntu-latest
steps:
- name: Checkout
@@ -140,8 +59,41 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install JS dependencies
- name: Install dependencies
run: bun install
- name: ESLint
run: bunx eslint assets/ --ext .js,.ts
- name: Stylelint
run: bunx stylelint "assets/**/*.scss"
- name: Build assets
run: bun run build
sonarqube:
runs_on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: intl, pdo_pgsql, zip, gd, redis, imagick
coverage: xdebug
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Generate coverage
run: vendor/bin/phpunit --coverage-clover coverage.xml
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sn.esy-web.dev