Skip to content

feat: support amd64 + arm64 #5

feat: support amd64 + arm64

feat: support amd64 + arm64 #5

name: Test Coverage
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests with coverage
run: npm run test:coverage
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# Repository Secrets: https://github.com/PaperDebugger/paperdebugger-mcp/settings/secrets/actions
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
retention-days: 30
- name: Coverage Report Summary
if: always()
run: |
echo "## πŸ“Š Test Coverage Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f coverage/coverage-summary.json ]; then
echo "### Overall Coverage:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`json" >> $GITHUB_STEP_SUMMARY
cat coverage/coverage-summary.json | jq '.' >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "πŸ“ [Download detailed coverage report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY
- name: Comment PR with coverage
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
if (fs.existsSync('coverage/coverage-summary.json')) {
const coverage = JSON.parse(fs.readFileSync('coverage/coverage-summary.json', 'utf8'));
const total = coverage.total;
const comment = `## πŸ“Š Test Coverage Report
| Metric | Coverage |
|--------|----------|
| Lines | ${total.lines.pct}% (${total.lines.covered}/${total.lines.total}) |
| Functions | ${total.functions.pct}% (${total.functions.covered}/${total.functions.total}) |
| Branches | ${total.branches.pct}% (${total.branches.covered}/${total.branches.total}) |
| Statements | ${total.statements.pct}% (${total.statements.covered}/${total.statements.total}) |
πŸ”— [View detailed report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
}