Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. # CI/CD Pipeline Setup - Validation Checklist
  2. ## Prerequisites
  3. - [ ] Git repository initialized (`.git/` exists)
  4. - [ ] Git remote configured (`git remote -v` shows origin)
  5. - [ ] Test framework configured (appropriate config for detected stack type)
  6. - [ ] Local tests pass (test command succeeds)
  7. - [ ] Team agrees on CI platform
  8. - [ ] Access to CI platform settings (if updating)
  9. ### Multi-Stack Detection
  10. - [ ] Test stack type detected or configured (`frontend`, `backend`, `fullstack`)
  11. - [ ] Test framework detected or configured (Playwright, Cypress, Jest, Vitest, etc.)
  12. - [ ] Stack-appropriate test commands identified
  13. ### Multi-Platform Detection
  14. - [ ] CI platform detected or configured
  15. - [ ] Supported platform: GitHub Actions, GitLab CI, Jenkins, Azure DevOps, Harness, or Circle CI
  16. - [ ] Platform-specific template selected
  17. Note: CI setup is typically a one-time task per repo and can be run any time after the test framework is configured.
  18. ## Process Steps
  19. ### Step 1: Preflight Checks
  20. - [ ] Git repository validated
  21. - [ ] Framework configuration detected
  22. - [ ] Local test execution successful
  23. - [ ] CI platform detected or selected
  24. - [ ] Node version identified (.nvmrc or default)
  25. - [ ] No blocking issues found
  26. ### Step 2: CI Pipeline Configuration
  27. - [ ] CI configuration file created at platform-correct path
  28. - GitHub Actions: `.github/workflows/test.yml`
  29. - GitLab CI: `.gitlab-ci.yml`
  30. - Jenkins: `Jenkinsfile`
  31. - Azure DevOps: `azure-pipelines.yml`
  32. - Harness: `.harness/pipeline.yaml`
  33. - Circle CI: `.circleci/config.yml`
  34. - [ ] File is syntactically valid (no YAML/Groovy errors)
  35. - [ ] Correct framework commands configured for detected stack type
  36. - [ ] Node version matches project
  37. - [ ] Test directory paths correct
  38. - [ ] Stack-conditional steps applied:
  39. - [ ] Browser install included for frontend/fullstack stacks
  40. - [ ] Browser install omitted for backend-only stacks
  41. - [ ] Test commands match detected framework
  42. ### Step 3: Parallel Sharding
  43. - [ ] Matrix strategy configured (4 shards default)
  44. - [ ] Shard syntax correct for framework
  45. - [ ] fail-fast set to false
  46. - [ ] Shard count appropriate for test suite size
  47. ### Step 4: Burn-In Loop
  48. - [ ] Burn-in job created (frontend/fullstack stacks) or intentionally skipped (backend-only)
  49. - [ ] 10 iterations configured (when enabled)
  50. - [ ] Proper exit on failure (`|| exit 1`)
  51. - [ ] Runs on appropriate triggers (PR, cron)
  52. - [ ] Failure artifacts uploaded
  53. - [ ] Backend-only stacks: burn-in skipped by default (documented reason: targets UI flakiness)
  54. ### Step 5: Caching Configuration
  55. - [ ] Dependency cache configured (npm/yarn)
  56. - [ ] Cache key uses lockfile hash
  57. - [ ] Browser cache configured (Playwright/Cypress)
  58. - [ ] Restore-keys defined for fallback
  59. - [ ] Cache paths correct for platform
  60. ### Step 6: Artifact Collection
  61. - [ ] Artifacts upload on failure only
  62. - [ ] Correct artifact paths (test-results/, traces/, etc.)
  63. - [ ] Retention days set (30 default)
  64. - [ ] Artifact names unique per shard
  65. - [ ] No sensitive data in artifacts
  66. ### Step 7: Retry Logic
  67. - [ ] Retry action/strategy configured
  68. - [ ] Max attempts: 2-3
  69. - [ ] Timeout appropriate (30 min)
  70. - [ ] Retry only on transient errors
  71. ### Step 8: Helper Scripts
  72. - [ ] `scripts/test-changed.sh` created
  73. - [ ] `scripts/ci-local.sh` created
  74. - [ ] `scripts/burn-in.sh` created (optional)
  75. - [ ] Scripts are executable (`chmod +x`)
  76. - [ ] Scripts use correct test commands
  77. - [ ] Shebang present (`#!/bin/bash`)
  78. ### Step 9: Documentation
  79. - [ ] `docs/ci.md` created with pipeline guide
  80. - [ ] `docs/ci-secrets-checklist.md` created
  81. - [ ] Required secrets documented
  82. - [ ] Setup instructions clear
  83. - [ ] Troubleshooting section included
  84. - [ ] Badge URLs provided (optional)
  85. ## Output Validation
  86. ### Configuration Validation
  87. - [ ] CI file loads without errors
  88. - [ ] All paths resolve correctly
  89. - [ ] No hardcoded values (use env vars)
  90. - [ ] Triggers configured (push, pull_request, schedule)
  91. - [ ] Platform-specific syntax correct
  92. ### Execution Validation
  93. - [ ] First CI run triggered (push to remote)
  94. - [ ] Pipeline starts without errors
  95. - [ ] All jobs appear in CI dashboard
  96. - [ ] Caching works (check logs for cache hit)
  97. - [ ] Tests execute in parallel
  98. - [ ] Artifacts collected on failure
  99. ### Performance Validation
  100. - [ ] Lint stage: <2 minutes
  101. - [ ] Test stage (per shard): <10 minutes
  102. - [ ] Burn-in stage: <30 minutes
  103. - [ ] Total pipeline: <45 minutes
  104. - [ ] Cache reduces install time by 2-5 minutes
  105. ## Quality Checks
  106. ### Best Practices Compliance
  107. - [ ] Burn-in loop follows production patterns
  108. - [ ] Parallel sharding configured optimally
  109. - [ ] Failure-only artifact collection
  110. - [ ] Selective testing enabled (optional)
  111. - [ ] Retry logic handles transient failures only
  112. - [ ] No secrets in configuration files
  113. ### Knowledge Base Alignment
  114. - [ ] Burn-in pattern matches `ci-burn-in.md`
  115. - [ ] Selective testing matches `selective-testing.md`
  116. - [ ] Artifact collection matches `visual-debugging.md`
  117. - [ ] Test quality matches `test-quality.md`
  118. ### Security Checks
  119. - [ ] No credentials in CI configuration
  120. - [ ] Secrets use platform secret management
  121. - [ ] Environment variables for sensitive data
  122. - [ ] Artifact retention appropriate (not too long)
  123. - [ ] No debug output exposing secrets
  124. - [ ] **MUST**: No `${{ inputs.* }}` or user-controlled GitHub context (`github.event.pull_request.title`, `github.event.issue.body`, `github.event.comment.body`, `github.head_ref`) directly in `run:` blocks — all passed through `env:` intermediaries and referenced as `"$ENV_VAR"`
  125. ## Integration Points
  126. ### Status File Integration
  127. - [ ] CI setup logged in Quality & Testing Progress section
  128. - [ ] Status updated with completion timestamp
  129. - [ ] Platform and configuration noted
  130. ### Knowledge Base Integration
  131. - [ ] Relevant knowledge fragments loaded
  132. - [ ] Patterns applied from knowledge base
  133. - [ ] Documentation references knowledge base
  134. - [ ] Knowledge base references in README
  135. ### Workflow Dependencies
  136. - [ ] `framework` workflow completed first
  137. - [ ] Can proceed to `atdd` workflow after CI setup
  138. - [ ] Can proceed to `automate` workflow
  139. - [ ] CI integrates with `gate` workflow
  140. ## Completion Criteria
  141. **All must be true:**
  142. - [ ] All prerequisites met
  143. - [ ] All process steps completed
  144. - [ ] All output validations passed
  145. - [ ] All quality checks passed
  146. - [ ] All integration points verified
  147. - [ ] First CI run successful
  148. - [ ] Performance targets met
  149. - [ ] Documentation complete
  150. ## Post-Workflow Actions
  151. **User must complete:**
  152. 1. [ ] Commit CI configuration
  153. 2. [ ] Push to remote repository
  154. 3. [ ] Configure required secrets in CI platform
  155. 4. [ ] Open PR to trigger first CI run
  156. 5. [ ] Monitor and verify pipeline execution
  157. 6. [ ] Adjust parallelism if needed (based on actual run times)
  158. 7. [ ] Set up notifications (optional)
  159. **Recommended next workflows:**
  160. 1. [ ] Run `atdd` workflow for test generation
  161. 2. [ ] Run `automate` workflow for coverage expansion
  162. 3. [ ] Run `gate` workflow for quality gates
  163. ## Rollback Procedure
  164. If workflow fails:
  165. 1. [ ] Delete CI configuration file
  166. 2. [ ] Remove helper scripts directory
  167. 3. [ ] Remove documentation (docs/ci.md, etc.)
  168. 4. [ ] Clear CI platform secrets (if added)
  169. 5. [ ] Review error logs
  170. 6. [ ] Fix issues and retry workflow
  171. ## Notes
  172. ### Common Issues
  173. **Issue**: CI file syntax errors
  174. - **Solution**: Validate YAML syntax online or with linter
  175. **Issue**: Tests fail in CI but pass locally
  176. - **Solution**: Use `scripts/ci-local.sh` to mirror CI environment
  177. **Issue**: Caching not working
  178. - **Solution**: Check cache key formula, verify paths
  179. **Issue**: Burn-in too slow
  180. - **Solution**: Reduce iterations or run on cron only
  181. ### Platform-Specific
  182. **GitHub Actions:**
  183. - Secrets: Repository Settings → Secrets and variables → Actions
  184. - Runners: Ubuntu latest recommended
  185. - Concurrency limits: 20 jobs for free tier
  186. **GitLab CI:**
  187. - Variables: Project Settings → CI/CD → Variables
  188. - Runners: Shared or project-specific
  189. - Pipeline quota: 400 minutes/month free tier
  190. **Jenkins:**
  191. - Credentials: Manage Jenkins → Manage Credentials
  192. - Agents: Configure build agents with Node.js
  193. - Plugins: Pipeline, JUnit, HTML Publisher recommended
  194. **Azure DevOps:**
  195. - Variables: Pipelines → Library → Variable groups
  196. - Agent pools: Azure-hosted or self-hosted
  197. - Parallel jobs: 1 free (Microsoft-hosted)
  198. **Harness:**
  199. - Connectors: Configure container registry and code repo connectors
  200. - Delegates: Install Harness delegate in target infrastructure
  201. - Steps: Use Run steps with appropriate container images
  202. ---
  203. **Checklist Complete**: Sign off when all items validated.
  204. **Completed by:** {name}
  205. **Date:** {date}
  206. **Platform:** {GitHub Actions, GitLab CI, Other}
  207. **Notes:** {notes}