|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { CodeBlock } from "./CodeBlock"; |
| 4 | + |
| 5 | +interface CommonSectionsProps { |
| 6 | + framework: string; |
| 7 | + workflowCode: string; |
| 8 | + workflowFilename: string; |
| 9 | + configPoints: string[]; |
| 10 | + setupCode?: { |
| 11 | + filename: string; |
| 12 | + language: string; |
| 13 | + code: string; |
| 14 | + }[]; |
| 15 | +} |
| 16 | + |
| 17 | +export function CommonSections({ |
| 18 | + framework, |
| 19 | + workflowCode, |
| 20 | + workflowFilename, |
| 21 | + configPoints, |
| 22 | + setupCode, |
| 23 | +}: CommonSectionsProps) { |
| 24 | + return ( |
| 25 | + <div className="space-y-12"> |
| 26 | + {setupCode && ( |
| 27 | + <section> |
| 28 | + <h2 className="text-2xl font-semibold mb-4 text-left">Framework Configuration</h2> |
| 29 | + <p className="text-gray-600 mb-4"> |
| 30 | + Configure {framework} to generate LCOV coverage reports: |
| 31 | + </p> |
| 32 | + {setupCode.map((code, index) => ( |
| 33 | + <CodeBlock |
| 34 | + key={index} |
| 35 | + code={code.code} |
| 36 | + language={code.language} |
| 37 | + filename={code.filename} |
| 38 | + /> |
| 39 | + ))} |
| 40 | + </section> |
| 41 | + )} |
| 42 | + |
| 43 | + <section> |
| 44 | + <h2 className="text-2xl font-semibold mb-4 text-left">Setting Up GitHub Actions</h2> |
| 45 | + <p className="text-gray-600 mb-4"> |
| 46 | + Create a workflow file in{" "} |
| 47 | + <code className="bg-gray-100 px-2 py-1 rounded">.github/workflows/</code> directory. The |
| 48 | + filename can be anything you prefer (e.g.{" "} |
| 49 | + <code className="bg-gray-100 px-2 py-1 rounded">{workflowFilename}</code>). Add the |
| 50 | + following content to your workflow file: |
| 51 | + </p> |
| 52 | + <CodeBlock code={workflowCode} language="yaml" filename={workflowFilename} /> |
| 53 | + <div className="bg-yellow-50 p-4 rounded-lg mb-6 mt-4"> |
| 54 | + <h3 className="text-lg font-medium text-yellow-950 mb-2">Key Configuration Points</h3> |
| 55 | + <ul className="list-disc list-outside space-y-1 text-yellow-800 ml-5"> |
| 56 | + {configPoints.map((point, index) => ( |
| 57 | + <li key={index} dangerouslySetInnerHTML={{ __html: point }} /> |
| 58 | + ))} |
| 59 | + </ul> |
| 60 | + </div> |
| 61 | + </section> |
| 62 | + |
| 63 | + <section> |
| 64 | + <h2 className="text-2xl font-semibold mb-4 text-left">Viewing Coverage Reports</h2> |
| 65 | + <p className="text-gray-600 mb-4"> |
| 66 | + After your workflow runs successfully, GitAuto automatically processes the coverage |
| 67 | + reports and displays them in the Coverage Dashboard. The data updates whenever: |
| 68 | + </p> |
| 69 | + <ul className="list-disc list-outside space-y-2 text-gray-600 mb-6 ml-5"> |
| 70 | + <li>You push to any branch (except master)</li> |
| 71 | + <li>You push additional commits to a pull request</li> |
| 72 | + <li>You manually trigger the workflow</li> |
| 73 | + </ul> |
| 74 | + </section> |
| 75 | + |
| 76 | + <div className="bg-gray-50 p-4 rounded-lg mt-4"> |
| 77 | + <p className="text-gray-700"> |
| 78 | + <strong>About LCOV:</strong> LCOV (Linux Code Coverage) is a standard format for code |
| 79 | + coverage data. It's pronounced "el-cov" and is widely supported by various tools and |
| 80 | + services. |
| 81 | + </p> |
| 82 | + </div> |
| 83 | + </div> |
| 84 | + ); |
| 85 | +} |
0 commit comments