Les enseignants ont besoin de moyennes à jour immédiatement après la publication ou modification des notes, sans attendre un batch nocturne. Le système recalcule via Domain Events synchrones : statistiques d'évaluation (min/max/moyenne/médiane), moyennes matières pondérées (normalisation /20), et moyenne générale par élève. Les résultats sont stockés dans des tables dénormalisées avec cache Redis (TTL 5 min). Trois endpoints API exposent les données avec contrôle d'accès par rôle. Une commande console permet le backfill des données historiques au déploiement.
159 lines
4.6 KiB
YAML
159 lines
4.6 KiB
YAML
# GitLab CI/CD Pipeline for Test Execution
|
|
# Generated by BMad TEA Agent - Test Architect Module
|
|
# Optimized for: Parallel Sharding, Burn-In Loop
|
|
# Stack: {test_stack_type} | Framework: {test_framework}
|
|
#
|
|
# Variables to customize per project:
|
|
# INSTALL_CMD - dependency install command (e.g., npm ci, pnpm install --frozen-lockfile)
|
|
# TEST_CMD - main test command (e.g., npm run test:e2e, npm test, npx vitest)
|
|
# LINT_CMD - lint command (e.g., npm run lint)
|
|
# BROWSER_INSTALL - browser install command (frontend/fullstack only; omit for backend)
|
|
# BROWSER_CACHE_PATH - browser cache path (frontend/fullstack only; omit for backend)
|
|
|
|
stages:
|
|
- lint
|
|
- test
|
|
- burn-in
|
|
- report
|
|
|
|
variables:
|
|
# Disable git depth for accurate change detection
|
|
GIT_DEPTH: 0
|
|
# Use npm ci for faster, deterministic installs
|
|
npm_config_cache: "$CI_PROJECT_DIR/.npm"
|
|
# Playwright browser cache
|
|
PLAYWRIGHT_BROWSERS_PATH: "$CI_PROJECT_DIR/.cache/ms-playwright"
|
|
# Default Node version when .nvmrc is missing
|
|
DEFAULT_NODE_VERSION: "24"
|
|
|
|
# Caching configuration
|
|
cache:
|
|
key:
|
|
files:
|
|
- package-lock.json
|
|
paths:
|
|
- .npm/
|
|
- .cache/ms-playwright/
|
|
- node_modules/
|
|
|
|
# Lint stage - Code quality checks
|
|
lint:
|
|
stage: lint
|
|
image: node:$DEFAULT_NODE_VERSION
|
|
before_script:
|
|
- |
|
|
NODE_VERSION=$(cat .nvmrc 2>/dev/null || echo "$DEFAULT_NODE_VERSION")
|
|
echo "Using Node $NODE_VERSION"
|
|
npm install -g n
|
|
n "$NODE_VERSION"
|
|
node -v
|
|
- npm ci # Replace with INSTALL_CMD
|
|
script:
|
|
- npm run lint # Replace with LINT_CMD
|
|
timeout: 5 minutes
|
|
|
|
# Test stage - Parallel execution with sharding
|
|
.test-template: &test-template
|
|
stage: test
|
|
image: node:$DEFAULT_NODE_VERSION
|
|
needs:
|
|
- lint
|
|
before_script:
|
|
- |
|
|
NODE_VERSION=$(cat .nvmrc 2>/dev/null || echo "$DEFAULT_NODE_VERSION")
|
|
echo "Using Node $NODE_VERSION"
|
|
npm install -g n
|
|
n "$NODE_VERSION"
|
|
node -v
|
|
- npm ci # Replace with INSTALL_CMD
|
|
- npx playwright install --with-deps chromium # Replace with BROWSER_INSTALL; remove for backend-only
|
|
artifacts:
|
|
when: on_failure
|
|
paths:
|
|
- test-results/
|
|
- playwright-report/
|
|
expire_in: 30 days
|
|
timeout: 30 minutes
|
|
|
|
test:shard-1:
|
|
<<: *test-template
|
|
script:
|
|
- npm run test:e2e -- --shard=1/4 # Replace with TEST_CMD + shard args
|
|
|
|
test:shard-2:
|
|
<<: *test-template
|
|
script:
|
|
- npm run test:e2e -- --shard=2/4 # Replace with TEST_CMD + shard args
|
|
|
|
test:shard-3:
|
|
<<: *test-template
|
|
script:
|
|
- npm run test:e2e -- --shard=3/4 # Replace with TEST_CMD + shard args
|
|
|
|
test:shard-4:
|
|
<<: *test-template
|
|
script:
|
|
- npm run test:e2e -- --shard=4/4 # Replace with TEST_CMD + shard args
|
|
|
|
# Burn-in stage - Flaky test detection
|
|
burn-in:
|
|
stage: burn-in
|
|
image: node:$DEFAULT_NODE_VERSION
|
|
needs:
|
|
- test:shard-1
|
|
- test:shard-2
|
|
- test:shard-3
|
|
- test:shard-4
|
|
# Only run burn-in on merge requests to main/develop or on schedule
|
|
rules:
|
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
|
before_script:
|
|
- |
|
|
NODE_VERSION=$(cat .nvmrc 2>/dev/null || echo "$DEFAULT_NODE_VERSION")
|
|
echo "Using Node $NODE_VERSION"
|
|
npm install -g n
|
|
n "$NODE_VERSION"
|
|
node -v
|
|
- npm ci # Replace with INSTALL_CMD
|
|
- npx playwright install --with-deps chromium # Replace with BROWSER_INSTALL; remove for backend-only
|
|
# Note: Burn-in targets UI flakiness. For backend-only stacks, remove this job entirely.
|
|
script:
|
|
- |
|
|
echo "🔥 Starting burn-in loop - detecting flaky tests"
|
|
for i in {1..10}; do
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "🔥 Burn-in iteration $i/10"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
npm run test:e2e || exit 1 # Replace with TEST_CMD
|
|
done
|
|
echo "✅ Burn-in complete - no flaky tests detected"
|
|
artifacts:
|
|
when: on_failure
|
|
paths:
|
|
- test-results/
|
|
- playwright-report/
|
|
expire_in: 30 days
|
|
timeout: 60 minutes
|
|
|
|
# Report stage - Aggregate results
|
|
report:
|
|
stage: report
|
|
image: alpine:latest
|
|
needs:
|
|
- test:shard-1
|
|
- test:shard-2
|
|
- test:shard-3
|
|
- test:shard-4
|
|
- burn-in
|
|
when: always
|
|
script:
|
|
- |
|
|
echo "## Test Execution Summary"
|
|
echo ""
|
|
echo "- Pipeline: $CI_PIPELINE_ID"
|
|
echo "- Shards: 4"
|
|
echo "- Branch: $CI_COMMIT_REF_NAME"
|
|
echo ""
|
|
echo "View detailed results in job artifacts"
|