fix: Add diagnostic logging to Initialization and fix Save() placement #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Foundry Local Performance Benchmark | |
| on: | |
| push: | |
| branches: | |
| - 'perf/foundry-local-benchmark-*' | |
| jobs: | |
| benchmark: | |
| runs-on: windows-2025 | |
| timeout-minutes: 60 | |
| permissions: | |
| contents: read | |
| checks: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@v2 | |
| # CLI branch only: Install Foundry Local CLI | |
| - name: Install Foundry Local CLI | |
| if: contains(github.ref, 'benchmark-cli') | |
| shell: pwsh | |
| run: | | |
| Write-Host "Installing Foundry Local CLI via winget..." | |
| winget install Microsoft.FoundryLocal --accept-source-agreements --accept-package-agreements --silent | |
| # Refresh PATH | |
| $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") | |
| # Verify installation | |
| $foundryPath = Get-Command foundry -ErrorAction SilentlyContinue | |
| if ($foundryPath) { | |
| Write-Host "Foundry CLI installed at: $($foundryPath.Source)" | |
| foundry --version | |
| } else { | |
| Write-Error "Foundry CLI installation failed - 'foundry' command not found" | |
| exit 1 | |
| } | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-x64-nuget-perf-${{ hashFiles('**/packages.lock.json', 'Directory.Packages.props', '**/*.csproj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-x64-nuget- | |
| - name: Restore dependencies | |
| run: dotnet restore AIDevGallery.sln -r win-x64 /p:Configuration=Release /p:Platform=x64 | |
| - name: Build AIDevGallery.Utils | |
| run: dotnet build AIDevGallery.Utils --no-restore /p:Configuration=Release | |
| - name: Build Test Project | |
| run: dotnet build AIDevGallery.Tests -r win-x64 -f net9.0-windows10.0.26100.0 /p:Configuration=Release /p:Platform=x64 | |
| - name: Run Performance Benchmarks | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\TestResults" | Out-Null | |
| New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\PerfResults" | Out-Null | |
| $env:PERFORMANCE_OUTPUT_PATH = "${{ github.workspace }}\PerfResults" | |
| dotnet test AIDevGallery.Tests\bin\x64\Release\net9.0-windows10.0.26100.0\win-x64\AIDevGallery.Tests.dll ` | |
| --filter "TestCategory=PerformanceBenchmark" ` | |
| --logger "trx;LogFileName=${{ github.workspace }}\TestResults\PerfBenchmarkResults.trx" ` | |
| --logger "console;verbosity=detailed" ` | |
| --results-directory "${{ github.workspace }}\TestResults" ` | |
| --verbosity normal | |
| Write-Host "Test exit code: $LASTEXITCODE" | |
| # Show performance results | |
| Write-Host "`n=== Performance Results ===" | |
| Get-ChildItem -Path "${{ github.workspace }}\PerfResults" -Filter "*.json" | ForEach-Object { | |
| Write-Host "`nFile: $($_.Name)" | |
| Get-Content $_.FullName | Write-Host | |
| } | |
| - name: Upload Performance Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: perf-results-${{ contains(github.ref, 'benchmark-cli') && 'cli' || 'sdk' }} | |
| path: | | |
| PerfResults/ | |
| TestResults/ | |
| - name: Display Test Report | |
| if: always() | |
| uses: dorny/test-reporter@v2 | |
| with: | |
| name: Performance Benchmark - ${{ contains(github.ref, 'benchmark-cli') && 'CLI' || 'SDK' }} | |
| path: 'TestResults/*.trx' | |
| reporter: dotnet-trx | |
| fail-on-error: false |