From 571b783054193362869d9055fbee60d299c8cd65 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Tue, 18 Nov 2025 14:05:49 +0200 Subject: [PATCH] fix: Update GitHub workflows to handle platform-specific builds correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix workflow issues preventing builds from running: **Test Workflow (test.yml)** - Change from solution restore to test project only - Only restore/build HihaArvio.Tests.csproj (net8.0 target) - Prevents iOS/macOS workload errors on Ubuntu runner - Tests run on Ubuntu (fast, cheap, no platform dependencies) **Build Workflow (build.yml)** - Replace `dotnet workload install maui` with `dotnet workload restore` - Use project-specific restore instead of solution restore - Restore only HihaArvio.csproj for each platform job - Add `--no-restore` flag to build commands - More reliable workload installation **Publish Workflow (publish.yml)** - Replace `dotnet workload install maui` with `dotnet workload restore` - Use project-specific restore instead of solution restore - Add `--no-restore` flag to publish commands - Consistent with build workflow pattern **Why These Changes**: 1. Solution restore on Linux tries to restore iOS/macOS targets 2. This requires workloads that don't exist on Ubuntu 3. Error: "NETSDK1147: workloads must be installed: wasm-tools-net8" 4. Solution: Only restore what each platform needs 5. Test project (net8.0) works on any platform 6. MAUI projects (iOS/macOS) only on macOS runners **Benefits**: - Tests run successfully on Ubuntu - Faster workload installation (restore vs install) - More explicit about dependencies - Avoids unnecessary multi-platform restore - Cleaner build logs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/build.yml | 16 ++++++++-------- .github/workflows/publish.yml | 14 ++++++++------ .github/workflows/test.yml | 8 ++++---- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84c3657..202c6cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,14 +21,14 @@ jobs: with: dotnet-version: '8.0.x' - - name: Install MAUI workload - run: dotnet workload install maui --source https://api.nuget.org/v3/index.json + - name: Restore workloads + run: dotnet workload restore src/HihaArvio/HihaArvio.csproj - name: Restore dependencies - run: dotnet restore HihaArvio.sln + run: dotnet restore src/HihaArvio/HihaArvio.csproj - name: Build iOS - run: dotnet build src/HihaArvio/HihaArvio.csproj -f net8.0-ios -c Release /p:ArchiveOnBuild=false /p:EnableCodeSigning=false + run: dotnet build src/HihaArvio/HihaArvio.csproj -f net8.0-ios -c Release --no-restore /p:ArchiveOnBuild=false /p:EnableCodeSigning=false - name: Upload iOS build artifacts uses: actions/upload-artifact@v4 @@ -52,14 +52,14 @@ jobs: with: dotnet-version: '8.0.x' - - name: Install MAUI workload - run: dotnet workload install maui --source https://api.nuget.org/v3/index.json + - name: Restore workloads + run: dotnet workload restore src/HihaArvio/HihaArvio.csproj - name: Restore dependencies - run: dotnet restore HihaArvio.sln + run: dotnet restore src/HihaArvio/HihaArvio.csproj - name: Build macOS Catalyst - run: dotnet build src/HihaArvio/HihaArvio.csproj -f net8.0-maccatalyst -c Release /p:ArchiveOnBuild=false /p:EnableCodeSigning=false + run: dotnet build src/HihaArvio/HihaArvio.csproj -f net8.0-maccatalyst -c Release --no-restore /p:ArchiveOnBuild=false /p:EnableCodeSigning=false - name: Upload macOS build artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 85887dd..783f498 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -98,17 +98,18 @@ jobs: with: dotnet-version: ${{ env.DOTNET_VERSION }} - - name: Install MAUI workload - run: dotnet workload install maui --source https://api.nuget.org/v3/index.json + - name: Restore workloads + run: dotnet workload restore src/HihaArvio/HihaArvio.csproj - name: Restore dependencies - run: dotnet restore HihaArvio.sln + run: dotnet restore src/HihaArvio/HihaArvio.csproj - name: Build iOS Release run: | dotnet publish src/HihaArvio/HihaArvio.csproj \ -f net8.0-ios \ -c Release \ + --no-restore \ /p:ApplicationDisplayVersion=${{ needs.create-release.outputs.version }} \ /p:ApplicationVersion=${{ github.run_number }} \ /p:ArchiveOnBuild=false \ @@ -144,17 +145,18 @@ jobs: with: dotnet-version: ${{ env.DOTNET_VERSION }} - - name: Install MAUI workload - run: dotnet workload install maui --source https://api.nuget.org/v3/index.json + - name: Restore workloads + run: dotnet workload restore src/HihaArvio/HihaArvio.csproj - name: Restore dependencies - run: dotnet restore HihaArvio.sln + run: dotnet restore src/HihaArvio/HihaArvio.csproj - name: Build macOS Catalyst Release run: | dotnet publish src/HihaArvio/HihaArvio.csproj \ -f net8.0-maccatalyst \ -c Release \ + --no-restore \ /p:ApplicationDisplayVersion=${{ needs.create-release.outputs.version }} \ /p:ApplicationVersion=${{ github.run_number }} \ /p:ArchiveOnBuild=false \ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 10328ad..6ab9967 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,13 +21,13 @@ jobs: dotnet-version: '8.0.x' - name: Restore dependencies - run: dotnet restore HihaArvio.sln + run: dotnet restore tests/HihaArvio.Tests/HihaArvio.Tests.csproj - - name: Build solution - run: dotnet build HihaArvio.sln --configuration Release --no-restore -f net8.0 + - name: Build test project + run: dotnet build tests/HihaArvio.Tests/HihaArvio.Tests.csproj --configuration Release --no-restore - name: Run tests - run: dotnet test HihaArvio.sln --configuration Release --no-build --verbosity normal -f net8.0 --logger "trx;LogFileName=test-results.trx" + run: dotnet test tests/HihaArvio.Tests/HihaArvio.Tests.csproj --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx" - name: Publish test results uses: dorny/test-reporter@v1