build(deps-dev): Bump undici from 7.16.0 to 7.24.1 in the npm_and_yarn group across 1 directory #190
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [macos-latest, ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests with coverage (Linux) | |
| run: xvfb-run -a npm run coverage | |
| if: runner.os == 'Linux' | |
| - name: Run tests with coverage (non-Linux) | |
| run: npm run coverage | |
| if: runner.os != 'Linux' | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| if: runner.os == 'Linux' | |
| with: | |
| name: coverage-report | |
| path: coverage/ | |
| - name: Coverage Summary | |
| if: runner.os == 'Linux' | |
| run: | | |
| COVERAGE=$(cat coverage/lcov.info | awk ' | |
| /^SF:/ { file=$0; sub("SF:", "", file); next } | |
| /^LH:/ { hit=$0; sub("LH:", "", hit); next } | |
| /^LF:/ { | |
| found=$0; sub("LF:", "", found) | |
| if (found > 0) { total_hit += hit; total_found += found } | |
| } | |
| END { if (total_found > 0) printf "%.1f%% (%d/%d lines)", (total_hit/total_found)*100, total_hit, total_found; else print "0.0% (0/0 lines)" } | |
| ') | |
| echo "## 📊 Coverage Report" >> $GITHUB_STEP_SUMMARY | |
| echo "**Lines:** $COVERAGE" >> $GITHUB_STEP_SUMMARY | |
| - name: Comment Coverage on PR | |
| if: runner.os == 'Linux' && github.event_name == 'pull_request' | |
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const lcov = fs.readFileSync('coverage/lcov.info', 'utf8'); | |
| let totalHit = 0, totalFound = 0; | |
| let currentHit = 0; | |
| for (const line of lcov.split('\n')) { | |
| if (line.startsWith('LH:')) currentHit = parseInt(line.slice(3)); | |
| if (line.startsWith('LF:')) { | |
| const found = parseInt(line.slice(3)); | |
| if (found > 0) { totalHit += currentHit; totalFound += found; } | |
| } | |
| } | |
| const pct = totalFound > 0 ? ((totalHit / totalFound) * 100).toFixed(1) : '0.0'; | |
| const body = `## 📊 Coverage Report\n\n**Lines:** ${pct}% (${totalHit}/${totalFound})`; | |
| 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, | |
| }); | |
| } | |
| - name: Package extension | |
| run: npx vsce package --no-dependencies | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| if: runner.os == 'Linux' | |
| with: | |
| name: vscode-acp-vsix | |
| path: "*.vsix" |