-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (91 loc) · 3.87 KB
/
Copy pathphp.yml
File metadata and controls
110 lines (91 loc) · 3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: PHP
on:
push:
pull_request:
permissions:
contents: read
jobs:
# Pipeline backend (§31.1) : composer validate → install → formatage →
# PHPStan → tests unitaires → tests d'intégration → audit → migrations de test.
# Matrice PHP : 8.4 (plancher annoncé, composer require.php) + 8.5 (image
# FrankenPHP prod & environnement de dev, no drift). On teste le contrat ET la prod.
backend:
name: Backend quality (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ["8.4", "8.5"]
# PostgreSQL pour les tests d'intégration ET la mécanique de migration.
services:
database:
image: postgres:17-alpine
env:
POSTGRES_DB: app
POSTGRES_USER: app
POSTGRES_PASSWORD: app
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U app -d app"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: "postgresql://app:app@127.0.0.1:5432/app?serverVersion=17&charset=utf8"
# Le runner CI n'installe pas l'ext PECL `opentelemetry` (cf. setup-php) :
# neutralise le E_USER_WARNING des paquets d'auto-instrumentation, émis à
# l'autoload Composer. Les images Docker, elles, embarquent l'ext (I2).
OTEL_PHP_DISABLED_INSTRUMENTATIONS: all
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: pdo_pgsql, intl, opcache, apcu, ctype, iconv
coverage: none
tools: composer
- name: Validate composer.json / composer.lock
run: composer validate --strict
# .env est ignoré par git (référence committée : .env.example). Symfony en
# a besoin (bootEnv + auto-scripts cache:clear). Les vraies variables CI
# (DATABASE_URL ci-dessus) priment sur ce fichier.
- name: Provide .env from .env.example
run: cp .env.example .env
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: PHP-CS-Fixer (formatage, dry-run)
env:
PHP_CS_FIXER_IGNORE_ENV: "1"
run: vendor/bin/php-cs-fixer fix --dry-run --diff
- name: PHPStan (niveau 9)
run: vendor/bin/phpstan analyse --no-progress
- name: Rector (dry-run)
run: vendor/bin/rector process --dry-run --no-progress-bar
- name: Audit des dépendances
run: composer audit
- name: Tests unitaires
run: vendor/bin/phpunit --testsuite=Unit
# La base `app_test` sert les tests d'intégration ET le test de
# neutralisation prod (§7.4) : ce dernier démarre un noyau PROD mais est
# redirigé vers `app_test` (base dédiée et jetable), pour ne plus dépendre
# de la base `app` partagée — déterminisme local comme en CI (I1).
- name: Migrations de test (base app_test)
env:
APP_ENV: test
run: |
php bin/console doctrine:database:create --if-not-exists --no-interaction
php bin/console doctrine:migrations:sync-metadata-storage --no-interaction
php bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing --allow-no-migration
- name: Tests d'intégration et fonctionnels
run: vendor/bin/phpunit --testsuite=Integration,Functional
# TODO(Phase 8, §31.3) : job end-to-end Playwright
# - docker compose up (horloge simulée via APP_FAKE_NOW)
# - npx playwright test + captures
# - docker compose down (nettoyage)
#
# TODO(Phase 9, §31.5) : job déploiement + smoke test
# - build de l'image prod (target frankenphp_prod, ARG APP_VERSION)
# - déploiement, smoke test /health, version annotée dans Grafana, rollback