bilhej/build.gradle
Joakim Mörling a6a3084acd Parallelize check across Gradle subprojects for faster pre-commit.
Run :backend:check, frontend coverage, and :e2e:check as sibling tasks with
org.gradle.parallel=true. Move E2E Docker compose into an e2e subproject so
Playwright can start while unit tests run. Copy e2e/ in the E2E backend image
so settings.gradle resolves inside Docker.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 12:42:27 +02:00

66 lines
2.1 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 thresholds (70% lines, 60% branches, 70% functions)'
dependsOn frontendLint
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')
}
// E2E lives in :e2e subproject so Gradle can run it parallel to root + :backend.
tasks.register('frontendE2E', Task) {
group = 'verification'
description = 'Alias for :e2e:check (Playwright in Docker)'
dependsOn ':e2e:check'
}
tasks.register('unitAndCoverage', Task) {
group = 'verification'
description = 'Backend + frontend unit tests with coverage thresholds (no E2E)'
dependsOn ':backend:check', 'frontendCoverage'
}
tasks.named('check').configure {
description = 'Full verification: :backend, frontend coverage, and :e2e in parallel'
dependsOn ':backend:check', 'frontendCoverage', ':e2e:check'
}
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'
}