mirror of
https://github.com/ivuorinen/hiha-arvio.git
synced 2026-01-26 11:24:04 +00:00
Critical fixes per spec.md requirements: - Restructure EstimateService with two-pool algorithm (gentle vs hard shake) - Expand all estimate pools to 5x spec size for more variety: * Work gentle: 7 → 35 estimates * Work hard: 12 → 60 estimates * Generic gentle: 8 → 40 estimates * Generic hard: 15 → 75 estimates * Humorous: 9 → 45 estimates - Add NSMotionUsageDescription to iOS Info.plist (required for accelerometer) - Add code coverage enforcement to test workflow (95% minimum per spec) - Update all tests to match new two-pool selection algorithm - Use 0.5 intensity threshold to choose between gentle/hard pools All 193 tests passing. Addresses critical spec deviations identified in code review.
81 lines
2.6 KiB
YAML
81 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: Check coverage threshold
|
|
run: |
|
|
# Extract line coverage percentage from coverage report
|
|
COVERAGE=$(grep -oP 'Line coverage: \K[\d.]+' coverage/Summary.txt | head -1)
|
|
echo "Code coverage: ${COVERAGE}%"
|
|
|
|
# Per spec: Enforce 95% minimum coverage
|
|
THRESHOLD=95.0
|
|
if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then
|
|
echo "❌ Coverage ${COVERAGE}% is below required threshold of ${THRESHOLD}%"
|
|
exit 1
|
|
else
|
|
echo "✅ Coverage ${COVERAGE}% meets or exceeds required threshold of ${THRESHOLD}%"
|
|
fi
|
|
|
|
- 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
|