ci: pipeline Gitea Actions build & push Docker sur push main
CI — Tests & Docker Build / Tests (push) Failing after 2m55s
CI — Tests & Docker Build / Build & push image Docker (push) Has been skipped

- Dockerfile multi-stage (build eclipse-temurin:25-jdk → runtime)
- CI : tests via actions/setup-java puis build & push vers registry Gitea
- Trigger Watchtower après push sur main
- CLAUDE.md + rules projet (.claude/rules/)
- Version build.gradle : 0.0.1-SNAPSHOT → 0.0.1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 08:05:53 +02:00
parent b4e5bd69f6
commit c34cc41496
10 changed files with 377 additions and 1 deletions
+63
View File
@@ -0,0 +1,63 @@
# Tests — Olhar-API
## Couverture minimale : 90%
La couverture (lignes, branches, méthodes) doit être **≥ 90%** en permanence, vérifiée via JaCoCo.
Le seuil global est défini dans les règles workspace (`tests.md`).
## Types de tests
| Type | Outil | Suffixe de classe |
|------|-------|-------------------|
| Unitaire | JUnit 5 | `*Test` |
| Intégration | JUnit 5 + Testcontainers + PostgreSQL | `*IT` |
Les tests d'intégration étendent `AbstractIntegrationTest` qui démarre un conteneur PostgreSQL via Testcontainers.
## Structure attendue
Pour chaque classe de production, une classe de test correspondante :
- `JwtService``JwtServiceTest` (unitaire, pas de Spring context)
- `AuthController``AuthControllerIT` (intégration, `@SpringBootTest`)
- `UserRepositoryAdapter` → test d'intégration avec BDD réelle
## Exécution via Podman (obligatoire)
Voir `java-env.md` (règles workspace) pour les contraintes. Commande standard :
```bash
podman run --rm -v $(pwd):/workspace:Z -w /workspace eclipse-temurin:25-jdk ./gradlew test --no-daemon
```
Testcontainers nécessite le socket Docker/Podman :
```bash
podman run --rm \
-v $(pwd):/workspace:Z \
-v /run/user/$(id -u)/podman/podman.sock:/var/run/docker.sock \
-w /workspace \
eclipse-temurin:25-jdk \
./gradlew test --no-daemon
```
## JaCoCo dans build.gradle
```groovy
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
jacocoTestReport {
reports { xml.required = true }
dependsOn test
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit { minimum = 0.90 }
}
}
}
```