Files
e-ticket/.gitea/workflows/ci.yml
Serreau Jovann 89f74de702 Add missing templates, add PostgreSQL and Redis services to CI
- Create 13 missing Twig templates (account, security, legal, unsubscribe, pages)
- CI: add PostgreSQL and Redis service containers for php and sonarqube jobs
- CI: create database schema before running tests
- Use null mailer in test environment

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 22:57:38 +01:00

155 lines
4.0 KiB
YAML

name: CI
on:
push:
branches:
- master
- main
pull_request:
jobs:
php:
runs_on: ubuntu-latest
services:
database:
image: postgres:16-alpine
env:
POSTGRES_USER: app
POSTGRES_PASSWORD: secret
POSTGRES_DB: e_ticket_test
options: >-
--health-cmd "pg_isready -U app -d e_ticket_test"
--health-interval 5s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: "postgresql://app:secret@database:5432/e_ticket_test?serverVersion=16&charset=utf8"
MESSENGER_TRANSPORT_DSN: "redis://redis:6379/messages"
MAILER_DSN: "null://null"
APP_ENV: test
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
coverage: xdebug
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- 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: Create database schema
run: php bin/console doctrine:schema:create --env=test
- name: PHPUnit with coverage
run: vendor/bin/phpunit --testdox --coverage-clover coverage.xml --coverage-text
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 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:
needs: [php, frontend]
runs_on: ubuntu-latest
services:
database:
image: postgres:16-alpine
env:
POSTGRES_USER: app
POSTGRES_PASSWORD: secret
POSTGRES_DB: e_ticket_test
options: >-
--health-cmd "pg_isready -U app -d e_ticket_test"
--health-interval 5s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: "postgresql://app:secret@database:5432/e_ticket_test?serverVersion=16&charset=utf8"
MESSENGER_TRANSPORT_DSN: "redis://redis:6379/messages"
MAILER_DSN: "null://null"
APP_ENV: test
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: Create database schema
run: php bin/console doctrine:schema:create --env=test
- 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