mcp-office-tools/.github/workflows/test-dashboard.yml
Ryan Malloy c935cec7b6 Add MS Office-themed test dashboard with interactive reporting
- Self-contained HTML dashboard with MS Office 365 design
- pytest plugin captures inputs, outputs, and errors per test
- Unified orchestrator runs pytest + torture tests together
- Test files persisted in reports/test_files/ with relative links
- GitHub Actions workflow with PR comments and job summaries
- Makefile with convenient commands (test, view-dashboard, etc.)
- Works offline with embedded JSON data (no CORS issues)
2026-01-11 00:28:12 -07:00

125 lines
4.5 KiB
YAML

name: Test Dashboard
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
workflow_dispatch: # Allow manual trigger
jobs:
test-and-dashboard:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install UV
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
uv sync --dev
- name: Run tests with dashboard generation
run: |
python run_dashboard_tests.py
continue-on-error: true # Generate dashboard even if tests fail
- name: Extract test summary
id: test_summary
run: |
TOTAL=$(jq '.summary.total' reports/test_results.json)
PASSED=$(jq '.summary.passed' reports/test_results.json)
FAILED=$(jq '.summary.failed' reports/test_results.json)
SKIPPED=$(jq '.summary.skipped' reports/test_results.json)
PASS_RATE=$(jq '.summary.pass_rate' reports/test_results.json)
echo "total=$TOTAL" >> $GITHUB_OUTPUT
echo "passed=$PASSED" >> $GITHUB_OUTPUT
echo "failed=$FAILED" >> $GITHUB_OUTPUT
echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT
echo "pass_rate=$PASS_RATE" >> $GITHUB_OUTPUT
- name: Upload test dashboard
uses: actions/upload-artifact@v4
if: always()
with:
name: test-dashboard
path: reports/
retention-days: 30
- name: Comment PR with results
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const total = ${{ steps.test_summary.outputs.total }};
const passed = ${{ steps.test_summary.outputs.passed }};
const failed = ${{ steps.test_summary.outputs.failed }};
const skipped = ${{ steps.test_summary.outputs.skipped }};
const passRate = ${{ steps.test_summary.outputs.pass_rate }};
const statusEmoji = failed > 0 ? '❌' : '✅';
const passRateEmoji = passRate >= 90 ? '🎉' : passRate >= 70 ? '👍' : '⚠️';
const comment = `## ${statusEmoji} Test Results
| Metric | Value |
|--------|-------|
| Total Tests | ${total} |
| ✅ Passed | ${passed} |
| ❌ Failed | ${failed} |
| ⏭️ Skipped | ${skipped} |
| ${passRateEmoji} Pass Rate | ${passRate.toFixed(1)}% |
### 📊 Interactive Dashboard
[Download test dashboard artifact](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
The dashboard includes:
- Detailed test results with inputs/outputs
- Error tracebacks for failed tests
- Category breakdown (Word, Excel, PowerPoint, etc.)
- Interactive filtering and search
**To view**: Download the artifact, extract, and open \`test_dashboard.html\` in your browser.
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
- name: Create job summary
if: always()
run: |
echo "# 📊 Test Dashboard Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Total**: ${{ steps.test_summary.outputs.total }} tests" >> $GITHUB_STEP_SUMMARY
echo "- **✅ Passed**: ${{ steps.test_summary.outputs.passed }}" >> $GITHUB_STEP_SUMMARY
echo "- **❌ Failed**: ${{ steps.test_summary.outputs.failed }}" >> $GITHUB_STEP_SUMMARY
echo "- **⏭️ Skipped**: ${{ steps.test_summary.outputs.skipped }}" >> $GITHUB_STEP_SUMMARY
echo "- **📈 Pass Rate**: ${{ steps.test_summary.outputs.pass_rate }}%" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## 🌐 Dashboard" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Download the \`test-dashboard\` artifact to view the interactive HTML dashboard." >> $GITHUB_STEP_SUMMARY
- name: Fail job if tests failed
if: steps.test_summary.outputs.failed > 0
run: exit 1