Files
hiha-arvio/.github/workflows/test.yml
Ismo Vuorinen b903941a4c fix: Force net8.0 target framework in test workflow
Add -p:TargetFramework=net8.0 to all dotnet commands in test workflow
to prevent transitive restoration of iOS/macOS target frameworks.

**Problem**:
- Test project references main HihaArvio project
- Main project has multi-target frameworks (net8.0, net8.0-ios, net8.0-maccatalyst)
- Restoring test project transitively restores all target frameworks
- iOS/macOS frameworks require macOS-specific workloads
- These workloads don't exist on Ubuntu runners

**Solution**:
Add `-p:TargetFramework=net8.0` to:
- dotnet restore (only restore for net8.0)
- dotnet build (only build for net8.0)
- dotnet test (only test for net8.0)

**Verification**:
Tested locally - all 189 tests pass with this approach.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:08:13 +02:00

48 lines
1.2 KiB
YAML

name: Test
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore tests/HihaArvio.Tests/HihaArvio.Tests.csproj -p:TargetFramework=net8.0
- name: Build test project
run: dotnet build tests/HihaArvio.Tests/HihaArvio.Tests.csproj --configuration Release --no-restore -p:TargetFramework=net8.0
- name: Run tests
run: dotnet test tests/HihaArvio.Tests/HihaArvio.Tests.csproj --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 --logger "trx;LogFileName=test-results.trx"
- name: Publish test results
uses: dorny/test-reporter@v1
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@v4
if: always()
with:
name: test-results
path: '**/test-results.trx'
retention-days: 30