fix: resolve intermittent build failures in CI workflows

Root causes identified and fixed:

1. AirAppHost recursive build issue:
   - Main project triggers AirAppHost build as post-build step
   - AirAppHost references main project, creating circular dependency
   - Added SkipAirAppHostBuild=true to build.yml to break the cycle
   - Release workflow handles AirAppHost separately in publish step

2. NuGet cache path issues:
   - Changed from relative path (.nuget/packages) to absolute path
   - Added NUGET_PACKAGES environment variable with github.workspace
   - Added actions/cache for NuGet packages across all workflows

3. Missing NuGet package caching:
   - Added actions/cache@v4 with proper cache keys
   - Cache key based on Directory.Packages.props hash
   - Fallback restore keys for partial cache hits

These changes should eliminate the intermittent failures caused by:
- File locking conflicts from recursive builds
- Path resolution inconsistencies
- Network-dependent package downloads on every build
This commit is contained in:
lincube
2026-06-25 17:18:08 +08:00
parent e8254e5048
commit daf294f21e
2 changed files with 53 additions and 0 deletions

View File

@@ -20,6 +20,8 @@ env:
DOTNET_VERSION: '10.0.x'
Solution_Name: LanMountainDesktop.slnx
DOTNET_gcServer: 1
# Use absolute path for NuGet cache to avoid path resolution issues
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
prepare:
@@ -437,6 +439,14 @@ jobs:
dotnet-version: ${{ env.DOTNET_VERSION }}
dotnet-quality: 'preview'
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Stamp release version metadata
shell: pwsh
run: |