K6 CI/CD Integration
Intermediatev1.0.0
Integrate k6 load tests into CI/CD pipelines with GitHub Actions — automated performance gates, result artifacts, trend tracking, and Grafana dashboard outputs.
Content
Overview
Running k6 in CI/CD creates automated performance gates — every PR gets tested for performance regressions. Thresholds fail the build if response times or error rates exceed acceptable limits.
How It Works
GitHub Actions Workflow
Smoke Test for Every PR
Output to JSON for Trend Tracking
Best Practices
- -Run smoke tests on every PR (fast, catches regressions)
- -Run full load tests on merge to main or scheduled nightly
- -Use Docker Compose to start the application in CI
- -Upload JSON results as artifacts for historical comparison
- -Set thresholds based on baseline measurements, not arbitrary numbers
- -Use
--summary-exportfor machine-readable output
Common Mistakes
- -Running full load tests on every PR (too slow, blocks merges)
- -Not starting the application before k6 runs
- -Not waiting for the application to be healthy before testing
- -Ignoring threshold failures ("it is just a performance test")
FAQ
Discussion
Loading comments...