Files
hiha-arvio/.github/workflows/build.yml
Ismo Vuorinen 571b783054 fix: Update GitHub workflows to handle platform-specific builds correctly
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 <noreply@anthropic.com>
2025-11-18 14:05:49 +02:00

91 lines
2.4 KiB
YAML

name: Build
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
jobs:
build-ios:
name: Build iOS
runs-on: macos-14
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore workloads
run: dotnet workload restore src/HihaArvio/HihaArvio.csproj
- name: Restore dependencies
run: dotnet restore src/HihaArvio/HihaArvio.csproj
- name: Build iOS
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
with:
name: ios-build
path: |
src/HihaArvio/bin/Release/net8.0-ios/**/*.app
src/HihaArvio/bin/Release/net8.0-ios/**/*.ipa
retention-days: 7
build-maccatalyst:
name: Build macOS Catalyst
runs-on: macos-14
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore workloads
run: dotnet workload restore src/HihaArvio/HihaArvio.csproj
- name: Restore dependencies
run: dotnet restore src/HihaArvio/HihaArvio.csproj
- name: Build macOS Catalyst
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
with:
name: maccatalyst-build
path: |
src/HihaArvio/bin/Release/net8.0-maccatalyst/**/*.app
src/HihaArvio/bin/Release/net8.0-maccatalyst/**/*.pkg
retention-days: 7
build-status:
name: Build Status
runs-on: ubuntu-latest
needs: [build-ios, build-maccatalyst]
if: always()
steps:
- name: Check build status
run: |
if [[ "${{ needs.build-ios.result }}" == "success" ]] && [[ "${{ needs.build-maccatalyst.result }}" == "success" ]]; then
echo "✅ All builds succeeded"
exit 0
else
echo "❌ One or more builds failed"
echo "iOS: ${{ needs.build-ios.result }}"
echo "macOS Catalyst: ${{ needs.build-maccatalyst.result }}"
exit 1
fi