diff --git a/.github/workflows/build-samples-todoapp-tutorial.yml b/.github/workflows/build-samples-todoapp-tutorial.yml index ad553c2..8e9435a 100644 --- a/.github/workflows/build-samples-todoapp-tutorial.yml +++ b/.github/workflows/build-samples-todoapp-tutorial.yml @@ -8,17 +8,16 @@ env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 DOTNET_NOLOGO: true DOTNET_CONFIGURATION: 'Release' - # NOTE: This sample's solution (todoapp.sln) also contains ClientApp, a WPF project - # targeting net10.0-windows. That head requires a windows-latest runner and is tracked - # separately in https://github.com/CommunityToolkit/Datasync/issues/510 (Phase 2). Only - # ServerApp (net10.0) is built here. - ProjectFile: 'samples/todoapp-tutorial/ServerApp/ServerApp.csproj' + ServerProjectFile: 'samples/todoapp-tutorial/ServerApp/ServerApp.csproj' + # ClientApp is a WPF project targeting net10.0-windows, so it is built on a windows-latest + # runner in a separate job below. See https://github.com/CommunityToolkit/Datasync/issues/510. + ClientProjectFile: 'samples/todoapp-tutorial/ClientApp/ClientApp.csproj' permissions: contents: read jobs: - build: + build-serverapp: runs-on: ubuntu-latest steps: - name: Checkout Repository @@ -30,10 +29,30 @@ jobs: dotnet-version: ${{ env.DOTNET_VERSION }} - name: Restore dependencies - run: dotnet restore ${{ env.ProjectFile }} + run: dotnet restore ${{ env.ServerProjectFile }} - name: Build sample run: > - dotnet build ${{ env.ProjectFile }} + dotnet build ${{ env.ServerProjectFile }} + --configuration ${{ env.DOTNET_CONFIGURATION }} + --no-restore + + build-clientapp: + runs-on: windows-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v7 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Restore dependencies + run: dotnet restore ${{ env.ClientProjectFile }} + + - name: Build sample + run: > + dotnet build ${{ env.ClientProjectFile }} --configuration ${{ env.DOTNET_CONFIGURATION }} --no-restore diff --git a/.github/workflows/build-samples-todoapp-windows.yml b/.github/workflows/build-samples-todoapp-windows.yml new file mode 100644 index 0000000..73fba07 --- /dev/null +++ b/.github/workflows/build-samples-todoapp-windows.yml @@ -0,0 +1,69 @@ +name: Build Sample - TodoApp Windows (WinUI3 / WPF / MAUI) + +on: + workflow_call: + +env: + DOTNET_VERSION: '10.0.x' + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: true + DOTNET_CONFIGURATION: 'Release' + # WinUI3 declares x86;x64;ARM64 with no AnyCPU, so Platform must be + # specified explicitly - the CLI default of AnyCPU is not a valid configuration for this project. + WinUI3ProjectFile: 'samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj' + WpfProjectFile: 'samples/todoapp/TodoApp.WPF/TodoApp.WPF.csproj' + # TodoApp.MAUI.csproj targets net10.0-android;net10.0-ios, with net10.0-windows10.0.19041.0 + # conditionally appended only when building on Windows. Android/iOS heads require separate + # workloads and are tracked in https://github.com/CommunityToolkit/Datasync/issues/511 (Phase 3), + # so restore/build here is explicitly scoped to the Windows TargetFramework only. + MauiProjectFile: 'samples/todoapp/TodoApp.MAUI/TodoApp.MAUI.csproj' + MauiWindowsTargetFramework: 'net10.0-windows10.0.19041.0' + +permissions: + contents: read + +jobs: + build: + runs-on: windows-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v7 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Restore WinUI3 project + run: dotnet restore ${{ env.WinUI3ProjectFile }} -p:Platform=x64 + + - name: Build WinUI3 project + run: > + dotnet build ${{ env.WinUI3ProjectFile }} + --configuration ${{ env.DOTNET_CONFIGURATION }} + -p:Platform=x64 + --no-restore + + - name: Restore WPF project + run: dotnet restore ${{ env.WpfProjectFile }} + + - name: Build WPF project + run: > + dotnet build ${{ env.WpfProjectFile }} + --configuration ${{ env.DOTNET_CONFIGURATION }} + --no-restore + + - name: Install MAUI Windows workload + run: dotnet workload install maui-windows + + - name: Restore MAUI project (Windows TFM only) + # NOTE: 'dotnet restore' has no -f|--framework option (-f means --force there, unlike + # 'dotnet build'). Use the MSBuild property directly to scope restore to one TFM. + run: dotnet restore ${{ env.MauiProjectFile }} -p:TargetFramework=${{ env.MauiWindowsTargetFramework }} + + - name: Build MAUI project (Windows TFM only) + run: > + dotnet build ${{ env.MauiProjectFile }} + -f ${{ env.MauiWindowsTargetFramework }} + --configuration ${{ env.DOTNET_CONFIGURATION }} + --no-restore diff --git a/.github/workflows/build-samples.yml b/.github/workflows/build-samples.yml index bc07f02..31faae6 100644 --- a/.github/workflows/build-samples.yml +++ b/.github/workflows/build-samples.yml @@ -31,9 +31,12 @@ jobs: todoapp-avalonia: uses: ./.github/workflows/build-samples-todoapp-avalonia.yml + todoapp-windows: + uses: ./.github/workflows/build-samples-todoapp-windows.yml + # Single aggregation point so branch protection only needs to require one check, - # regardless of how many sample workflows are added over time (see Phase 2/3 - # follow-ups: https://github.com/CommunityToolkit/Datasync/issues/510 and #511). + # regardless of how many sample workflows are added over time (see Phase 3 + # follow-up: https://github.com/CommunityToolkit/Datasync/issues/511). all-samples-built: name: All samples built if: always() @@ -44,6 +47,7 @@ jobs: - todoapp-blazor-wasm - todoapp-tutorial - todoapp-avalonia + - todoapp-windows runs-on: ubuntu-latest steps: - name: Check sample build results diff --git a/samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj b/samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj index 890eaff..b72dafe 100644 --- a/samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj +++ b/samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj @@ -7,7 +7,6 @@ app.manifest x86;x64;ARM64 win-x86;win-x64;win-arm64 - win-$(Platform).pubxml true true preview