ci: test fix #112
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Trion CI | |
| on: | |
| push: | |
| branches: [ main, dev ] | |
| pull_request: | |
| branches: [ main, dev ] | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Setup .NET 9 runtime | |
| - name: Setup .NET 9 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| # MAUI is Windows-only, skip on Linux to avoid workload installation errors | |
| - name: Install MAUI workload (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: dotnet workload install maui | |
| # wasm-tools needed for web projects on all platforms | |
| - name: Install wasm-tools workload | |
| run: dotnet workload install wasm-tools | |
| # RESTORE: Windows restores all projects with win-x64 RID for Desktop publishing | |
| # Also restore MAUI runtime pack explicitly to avoid CI caching issues | |
| # Linux only restores Web project to avoid MAUI-tizen dependency errors | |
| - name: Restore (Windows - all projects) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| dotnet restore | |
| dotnet workload restore | |
| - name: Restore (Linux - Web only) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: dotnet restore src/Trion.Web/Trion.Web.csproj | |
| # BUILD: Windows builds all projects (Desktop + Web) | |
| # Use --runtime win-x64 to ensure desktop runtime pack is available | |
| # Linux builds Web only to avoid MAUI compilation errors | |
| - name: Build (Windows - all projects) | |
| if: matrix.os == 'windows-latest' | |
| run: dotnet build -c Release --no-restore --warnaserror --runtime win-x64 | |
| - name: Build (Linux - Web only) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: dotnet build src/Trion.Web/Trion.Web.csproj -c Release --no-restore --warnaserror | |
| # TEST: Windows tests all projects, Linux tests Web only | |
| - name: Test (Windows - all projects) | |
| if: matrix.os == 'windows-latest' | |
| run: dotnet test -c Release --no-build --logger trx --collect:"XPlat Code Coverage" | |
| - name: Test (Linux - Web only) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: dotnet test src/Trion.Web/Trion.Web.csproj -c Release --no-build --logger trx --collect:"XPlat Code Coverage" | |
| # PUBLISH DESKTOP: Windows only - creates self-contained single-file exe | |
| - name: Publish desktop (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: dotnet publish src/Trion.Desktop/Trion.Desktop.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o artifacts/desktop | |
| # PUBLISH WEB: Both platforms - portable web app deployment | |
| - name: Publish web (portable) | |
| run: dotnet publish src/Trion.Web/Trion.Web.csproj -c Release -o artifacts/web | |
| # ARTIFACT UPLOADS | |
| # Upload test results from both platforms | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.os }} | |
| path: '**/*.trx' | |
| # Upload code coverage to codecov (Linux only to avoid duplicates) | |
| - name: Upload coverage | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: '**/coverage.cobertura.xml' | |
| # Upload all build artifacts (desktop exe on Windows, web files on both) | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Trion-Build-${{ matrix.os }} | |
| path: artifacts/ |