Local verification should match Forgejo CI. Wire frontendE2E into check and point it at docker-compose.e2e.yml with the same test env vars. - Add frontendE2E to check after frontend unit tests - Run docker-compose.e2e.yml directly from Gradle with CI secrets - Update npm test:e2e:ci to use the e2e compose file
66 lines
2.2 KiB
Groovy
66 lines
2.2 KiB
Groovy
plugins {
|
|
id 'base'
|
|
}
|
|
|
|
tasks.register('frontendLint', Exec) {
|
|
description = 'Run ESLint in the frontend directory'
|
|
workingDir = file("${rootProject.projectDir}/frontend")
|
|
commandLine 'npm', 'run', 'lint'
|
|
}
|
|
|
|
tasks.register('frontendTest', Exec) {
|
|
description = 'Run Vitest in the frontend directory'
|
|
dependsOn frontendLint
|
|
workingDir = file("${rootProject.projectDir}/frontend")
|
|
commandLine 'npm', 'run', 'test'
|
|
}
|
|
|
|
tasks.register('frontendCoverage', Exec) {
|
|
description = 'Run Vitest with coverage in the frontend directory'
|
|
workingDir = file("${rootProject.projectDir}/frontend")
|
|
commandLine 'npm', 'run', 'test:coverage'
|
|
}
|
|
|
|
tasks.register('coverage') {
|
|
group = 'verification'
|
|
description = 'Run backend + frontend tests with coverage thresholds'
|
|
dependsOn(':backend:jacocoTestReport', 'frontendCoverage')
|
|
}
|
|
|
|
tasks.register('frontendE2E', Exec) {
|
|
group = 'verification'
|
|
description = 'Run Playwright E2E tests in Docker (same stack as Forgejo CI)'
|
|
dependsOn frontendTest
|
|
workingDir = rootProject.projectDir
|
|
environment 'POSTGRES_DB', 'bilhej'
|
|
environment 'POSTGRES_USER', 'bilhej'
|
|
environment 'POSTGRES_PASSWORD', 'test_pw_ci_123'
|
|
environment 'JWT_SECRET', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
|
environment 'STRIPE_SECRET_KEY', 'sk_test_fake'
|
|
environment 'STRIPE_WEBHOOK_SECRET', 'whsec_fake'
|
|
environment 'STRIPE_PRICE_ID', 'price_fake'
|
|
commandLine 'docker', 'compose', '-f', 'docker-compose.e2e.yml',
|
|
'up', '--build', '--abort-on-container-exit', '--exit-code-from', 'playwright'
|
|
}
|
|
|
|
tasks.named('check').configure {
|
|
dependsOn frontendLint, frontendTest, frontendE2E
|
|
}
|
|
|
|
tasks.register('up', Exec) {
|
|
description = 'Start all services via Docker Compose'
|
|
workingDir = rootProject.projectDir
|
|
commandLine 'docker', 'compose', 'up', '-d'
|
|
}
|
|
|
|
tasks.register('down', Exec) {
|
|
description = 'Stop all Docker Compose services'
|
|
workingDir = rootProject.projectDir
|
|
commandLine 'docker', 'compose', 'down'
|
|
}
|
|
|
|
tasks.register('reset', Exec) {
|
|
description = 'Wipe database and restart all services'
|
|
workingDir = rootProject.projectDir
|
|
commandLine 'bash', '-c', 'docker compose down -v && docker compose up -d'
|
|
}
|