Skip to content

ci: MAUI workload on Linux #100

ci: MAUI workload on Linux

ci: MAUI workload on Linux #100

Workflow file for this run

name: Trion CI
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Run on both Windows (for MAUI desktop) and Linux (for cross-platform validation)
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
# MAUI workload needed on both platforms for multi-targeted project
# Windows uses it for net9.0-windows, Linux needs it to restore all targets
- name: Install MAUI workload
run: dotnet workload install maui
- name: Restore
run: dotnet restore
# Build everything with warnings as errors to catch issues early
- name: Build
run: dotnet build -c Release --no-restore --warnaserror
# Run tests with coverage collection for CodeCov integration
- name: Test
run: dotnet test -c Release --no-build --logger trx --collect:"XPlat Code Coverage"
# Desktop app: Build for both platforms
# Windows: Single-file .exe with embedded runtime (no .NET install needed)
- name: Publish desktop (Windows)
if: runner.os == 'Windows'
run: dotnet publish src/Trion.Desktop/Trion.Desktop.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o artifacts/desktop-win -f net9.0-windows10.0.19041.0
# Linux: Single-file executable using GTK bindings
- name: Publish desktop (Linux)
if: runner.os == 'Linux'
run: dotnet publish src/Trion.Desktop/Trion.Desktop.csproj -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o artifacts/desktop-linux -f net9.0
# Web app: Framework-dependent, publish on both OS to verify cross-platform compatibility
- name: Publish web
run: dotnet publish src/Trion.Web/Trion.Web.csproj -c Release -o artifacts/web
# Always upload test results even if tests fail (for debugging)
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: '**/*.trx'
# Only need coverage from one OS, Linux is faster
- name: Upload coverage
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: '**/coverage.cobertura.xml'
# Upload Windows desktop build artifact
- name: Upload desktop artifact (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: Trion-Desktop-Win
path: artifacts/desktop-win/
# Upload Linux desktop build artifact
- name: Upload desktop artifact (Linux)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: Trion-Desktop-Linux
path: artifacts/desktop-linux/
# Upload web artifacts from both OS (helps catch platform-specific issues)
- name: Upload web artifact
uses: actions/upload-artifact@v4
with:
name: Trion-Web-${{ matrix.os }}
path: artifacts/web/