Skip to content

Commit 6f2b8bf

Browse files
save md to docs
1 parent 110736d commit 6f2b8bf

File tree

1 file changed

+50
-42
lines changed

1 file changed

+50
-42
lines changed

.github/workflows/unit-tests.yml

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -30,61 +30,69 @@ jobs:
3030
run: dotnet build tests/SharpGraph.Tests/SharpGraph.Tests.csproj --configuration Debug
3131

3232
- name: Run Tests
33-
run: dotnet test tests/SharpGraph.Tests/SharpGraph.Tests.csproj --configuration Debug --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx" --logger "console;verbosity=detailed"
33+
run: dotnet test tests/SharpGraph.Tests/SharpGraph.Tests.csproj --configuration Debug --no-build --verbosity normal --logger "trx;LogFileName=../../test-results.trx" --logger "console;verbosity=detailed"
3434

3535
- name: Generate Test Report
3636
if: always()
3737
shell: pwsh
3838
run: |
3939
$trxFile = Get-ChildItem -Path . -Filter "test-results.trx" -Recurse | Select-Object -First 1
40+
Write-Host "Looking for TRX file..."
41+
4042
if ($null -ne $trxFile) {
43+
Write-Host "TRX File found: $($trxFile.FullName)"
4144
[xml]$trx = Get-Content $trxFile.FullName
42-
$passed = $trx.TestRun.ResultSummary.Counters.passed
43-
$failed = $trx.TestRun.ResultSummary.Counters.failed
44-
$total = $trx.TestRun.ResultSummary.Counters.total
45+
$passed = [int]$trx.TestRun.ResultSummary.Counters.passed
46+
$failed = [int]$trx.TestRun.ResultSummary.Counters.failed
47+
$total = [int]$trx.TestRun.ResultSummary.Counters.total
4548
$duration = $trx.TestRun.Times.duration
4649
47-
$report = @"
48-
# Unit Test Report
49-
50-
**Run Date**: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss UTC')
51-
**Branch**: `${{ github.ref_name }}`
52-
**Commit**: `${{ github.sha }}`
53-
54-
## Summary
55-
56-
| Metric | Count |
57-
|--------|-------|
58-
| Total Tests | $total |
59-
| ✅ Passed | $passed |
60-
| ❌ Failed | $failed |
61-
| Duration | $duration |
62-
63-
## Test Categories
64-
65-
- Lexer Tests
66-
- Filtering Tests
67-
- Storage Tests
68-
- Index Tests (BTree, Hash)
69-
- Mutation Tests
70-
- Parsing Tests
71-
72-
## Status
73-
74-
$( if ($failed -eq 0) { "✅ **All tests passing**" } else { "❌ **Tests failed**" } )
75-
76-
---
77-
78-
[View Full Test Results](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
79-
"@
50+
Write-Host "Tests - Total: $total, Passed: $passed, Failed: $failed"
8051
81-
# Save to docs folder
8252
New-Item -ItemType Directory -Path "docs" -Force | Out-Null
83-
$report | Out-File -FilePath "docs/unit-test-report.md" -Encoding UTF8
84-
Write-Host $report
8553
86-
# Add to GitHub summary
87-
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "## 🧪 Unit Tests`n`n✅ **$passed** / $total tests passed"
54+
$reportLines = @(
55+
"# Unit Test Report",
56+
"",
57+
"**Run Date**: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss UTC')",
58+
"**Branch**: ${{ github.ref_name }}",
59+
"**Commit**: ${{ github.sha }}",
60+
"",
61+
"## Summary",
62+
"",
63+
"| Metric | Count |",
64+
"|--------|-------|",
65+
"| Total Tests | $total |",
66+
"| ✅ Passed | $passed |",
67+
"| ❌ Failed | $failed |",
68+
"| Duration | $duration |",
69+
"",
70+
"## Test Categories",
71+
"",
72+
"- Lexer Tests",
73+
"- Filtering Tests",
74+
"- Storage Tests",
75+
"- Index Tests (BTree, Hash)",
76+
"- Mutation Tests",
77+
"- Parsing Tests",
78+
"",
79+
"## Status",
80+
"",
81+
if ($failed -eq 0) { "✅ **All tests passing**" } else { "❌ **Tests failed**" },
82+
"",
83+
"---",
84+
"",
85+
"[View Full Test Results](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
86+
)
87+
88+
$report = $reportLines -join "`n"
89+
$report | Out-File -FilePath "docs/unit-test-report.md" -Encoding UTF8 -Force
90+
91+
Write-Host "Report saved to docs/unit-test-report.md"
92+
Write-Host "File exists: $(Test-Path 'docs/unit-test-report.md')"
93+
} else {
94+
Write-Host "ERROR: TRX file not found!"
95+
Get-ChildItem -Path . -Recurse -Filter "*.trx" | ForEach-Object { Write-Host $_.FullName }
8896
}
8997
9098
- name: Commit Test Report

0 commit comments

Comments
 (0)