31 / 48 · 16 CI/CD Pipelines · Pipeline Optimization← prev⊞ allnext →☰ Read as one page
5.6Pipeline Configuration for Test Performance
Environment variables that affect test speed:
env:
TEST_TIMEOUT: 30000 # 30s timeout per test (prevent hanging tests)
RETRY_COUNT: 2 # Retry failed tests twice (handle infrastructure flakes)
HEADLESS: true # Run browsers in headless mode (faster)
SLOW_MO: 0 # No artificial delay between actions
WORKERS: 4 # Number of parallel test workers
Retry Logic
Retries should handle infrastructure flakes (network timeouts, container startup delays), not test bugs. If a test consistently needs retries to pass, it is flaky and needs fixing.
# Playwright retry configuration
- run: npx playwright test --retries=2
# Job-level retry (GitHub Actions does not support this natively;
# use reusable workflows or third-party actions)
Timeout Settings
Always set timeouts to prevent hung jobs from consuming runners:
jobs:
unit-tests:
runs-on: ubuntu-latest
timeout-minutes: 10 # Kill the job if it takes longer than 10 minutes
browser-tests:
runs-on: ubuntu-latest
timeout-minutes: 30 # Browser tests get more time