mirror of
https://github.com/ivuorinen/hiha-arvio.git
synced 2026-01-26 03:14:00 +00:00
Coverage Documentation: - Remove 95% coverage threshold enforcement from test workflow - Change to informational coverage display only - Document in spec.md why coverage can't be enforced on Linux runners - Explain that full coverage requires macOS runners with all target frameworks README Maintenance: - Remove hardcoded test counts (189 tests) that become outdated quickly - Change to generic "comprehensive test suite" description - Remove specific test count breakdowns by layer
76 lines
2.6 KiB
YAML
76 lines
2.6 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
pull_request:
|
|
branches: [ main, develop ]
|
|
|
|
jobs:
|
|
test:
|
|
name: Run Tests
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
checks: write
|
|
actions: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
|
|
with:
|
|
dotnet-version: '8.0.x'
|
|
|
|
- name: Restore dependencies
|
|
run: dotnet restore tests/HihaArvio.Tests/HihaArvio.Tests.csproj /p:TargetFrameworks=net8.0
|
|
|
|
- name: Build test project
|
|
run: dotnet build tests/HihaArvio.Tests/HihaArvio.Tests.csproj --configuration Release --no-restore /p:TargetFrameworks=net8.0
|
|
|
|
- name: Run tests with coverage
|
|
run: dotnet test tests/HihaArvio.Tests/HihaArvio.Tests.csproj --configuration Release --no-build --verbosity normal /p:TargetFrameworks=net8.0 --collect:"XPlat Code Coverage" --logger "trx;LogFileName=test-results.trx"
|
|
|
|
- name: Install ReportGenerator
|
|
run: dotnet tool install --global dotnet-reportgenerator-globaltool
|
|
|
|
- name: Generate coverage report
|
|
run: reportgenerator -reports:**/coverage.cobertura.xml -targetdir:coverage -reporttypes:"Html;Cobertura;TextSummary"
|
|
|
|
- name: Display coverage summary
|
|
run: |
|
|
# Extract and display line coverage percentage
|
|
COVERAGE=$(grep -oP 'Line coverage: \K[\d.]+' coverage/Summary.txt | head -1)
|
|
echo "📊 Code coverage for net8.0 target: ${COVERAGE}%"
|
|
echo ""
|
|
echo "Note: Multi-target MAUI projects cannot achieve full coverage on Linux runners."
|
|
echo "Platform-specific code (iOS/macOS) is excluded when building net8.0 only."
|
|
echo "Full coverage measurement requires macOS runners with all target frameworks."
|
|
|
|
- name: Upload coverage report
|
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
|
if: always()
|
|
with:
|
|
name: coverage-report
|
|
path: coverage/
|
|
retention-days: 30
|
|
|
|
- name: Publish test results
|
|
uses: dorny/test-reporter@dc3a92680fcc15842eef52e8c4606ea7ce6bd3f3 # v2.1.1
|
|
if: always()
|
|
with:
|
|
name: Test Results
|
|
path: '**/test-results.trx'
|
|
reporter: dotnet-trx
|
|
fail-on-error: true
|
|
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
|
if: always()
|
|
with:
|
|
name: test-results
|
|
path: '**/test-results.trx'
|
|
retention-days: 30
|