ci: optimize test performance — from ~3h to 3.5s
- Lazy-load tesseract.js only in OCR route (skips 30MB WASM download) - Conditional tracing.js import (skip OTel gRPC in test mode) - Remove unused barcode-detector import - Add testTimeout/openHandlesTimeout to jest.config.js - Add --forceExitTimeout=30000 to test script - Split CI test jobs into parallel workflows (backend/frontend/mobile) - Add timeout-minutes: 15 to all test jobs - Use npm ci --ignore-scripts + selective native rebuild
This commit is contained in:
@@ -31,6 +31,7 @@ jobs:
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.backend == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Node.js
|
||||
@@ -39,15 +40,18 @@ jobs:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: npm ci --ignore-scripts
|
||||
- name: Install backend native deps
|
||||
run: npm rebuild sqlite3 bcrypt --workspace=farma-clic-backend
|
||||
- name: Run tests
|
||||
run: npm test --workspace=farma-clic-backend -- --ci
|
||||
run: npm test --workspace=farma-clic-backend
|
||||
|
||||
test-frontend:
|
||||
name: Frontend Tests
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.frontend == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Node.js
|
||||
@@ -56,7 +60,7 @@ jobs:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: npm ci --ignore-scripts
|
||||
- name: Run tests
|
||||
run: npm test --workspace=farma-clic-frontend -- --run --reporter=basic
|
||||
|
||||
|
||||
Reference in New Issue
Block a user