feat: Agent Delegation Visualizer - interactive multi-agent task dele… #133
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Code Coverage | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| concurrency: | |
| group: coverage-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests with coverage | |
| run: npx jest --coverage --coverageReporters=json-summary --coverageReporters=lcov --coverageReporters=text --ci | |
| env: | |
| CI: true | |
| - name: Upload coverage to Codecov | |
| if: always() | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| files: ./coverage/lcov.info | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Coverage summary | |
| if: always() | |
| run: | | |
| if [ -f coverage/coverage-summary.json ]; then | |
| echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| node -e " | |
| const c = require('./coverage/coverage-summary.json').total; | |
| const fmt = (v) => v.pct + '%'; | |
| console.log('| Metric | Coverage |'); | |
| console.log('|--------|----------|'); | |
| console.log('| Statements | ' + fmt(c.statements) + ' |'); | |
| console.log('| Branches | ' + fmt(c.branches) + ' |'); | |
| console.log('| Functions | ' + fmt(c.functions) + ' |'); | |
| console.log('| Lines | ' + fmt(c.lines) + ' |'); | |
| " >> $GITHUB_STEP_SUMMARY | |
| fi | |
| - name: Comment coverage on PR | |
| if: github.event_name == 'pull_request' && always() | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| if (!fs.existsSync('coverage/coverage-summary.json')) return; | |
| const summary = JSON.parse(fs.readFileSync('coverage/coverage-summary.json', 'utf8')); | |
| const t = summary.total; | |
| const badge = (pct) => pct >= 80 ? '🟢' : pct >= 60 ? '🟡' : '🔴'; | |
| const body = `## 📊 Coverage Report | |
| | Metric | Coverage | | | |
| |--------|----------|---| | |
| | Statements | ${t.statements.pct}% | ${badge(t.statements.pct)} | | |
| | Branches | ${t.branches.pct}% | ${badge(t.branches.pct)} | | |
| | Functions | ${t.functions.pct}% | ${badge(t.functions.pct)} | | |
| | Lines | ${t.lines.pct}% | ${badge(t.lines.pct)} |`; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find(c => c.body.includes('📊 Coverage Report')); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| } |