Repository navigation
deps: Bump the microsoft-packages group with 9 updates #173
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: Squad.Agents.AI CI | |
| on: | |
| pull_request: | |
| paths: | |
| - 'src/Squad.Agents.AI/**' | |
| - 'test/Squad.Agents.AI.Tests/**' | |
| - 'src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample/**' | |
| - 'scripts/verify-squad-agents-ai-consumer.ps1' | |
| - '.github/workflows/squad-agents-ai-ci.yml' | |
| - 'Directory.*.props' | |
| - 'Directory.*.json' | |
| - 'global.json' | |
| - 'nuget.config' | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'src/Squad.Agents.AI/**' | |
| - 'test/Squad.Agents.AI.Tests/**' | |
| - 'src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample/**' | |
| - 'scripts/verify-squad-agents-ai-consumer.ps1' | |
| - '.github/workflows/squad-agents-ai-ci.yml' | |
| - 'Directory.*.props' | |
| - 'Directory.*.json' | |
| - 'global.json' | |
| - 'nuget.config' | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| dotnet: | |
| name: .NET ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| env: | |
| DOTNET_CLI_TELEMETRY_OPTOUT: '1' | |
| DOTNET_NOLOGO: '1' | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 #v6.1.0 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Restore package | |
| run: dotnet restore src/Squad.Agents.AI/Squad.Agents.AI.csproj -p:NuGetAudit=true | |
| - name: Restore tests | |
| run: dotnet restore test/Squad.Agents.AI.Tests/Squad.Agents.AI.Tests.csproj -p:NuGetAudit=true | |
| - name: Restore sample | |
| run: dotnet restore src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample/Squad.Agents.AI.Sample.csproj -p:NuGetAudit=true | |
| # Resolves the Copilot CLI version that GitHub.Copilot.SDK (the version this repo | |
| # actually references, $(SquadCopilotSdkVersion)) pins, straight from that package's | |
| # own build/GitHub.Copilot.SDK.props in the local NuGet cache, so the expected/ | |
| # forbidden CLI versions used by the checks below never need to be hardcoded here | |
| # and can't drift out of sync with a future SDK version bump. | |
| # | |
| # CopilotCliVersion is untrusted third-party content (it comes from the | |
| # GitHub.Copilot.SDK NuGet package, not this repo), so it is validated against a | |
| # narrow version grammar before being written to $GITHUB_OUTPUT. Downstream steps | |
| # then read it via env: rather than interpolating the ${{ }} expression directly | |
| # into their run: script bodies, so a malformed or hostile value can never be | |
| # concatenated into, and executed as, PowerShell source. | |
| - name: Resolve expected Copilot CLI version | |
| id: copilot-cli-version | |
| shell: pwsh | |
| run: | | |
| # Same grammar as the version-validation guard in | |
| # scripts/verify-squad-agents-ai-consumer.ps1 (kept in sync by hand: both | |
| # accept dotted release/prerelease CLI versions such as 1.0.71 or 1.0.64-1, | |
| # single line, no surrounding whitespace). | |
| $versionGrammar = '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z][0-9A-Za-z.]*)?$' | |
| $sdkVersion = (dotnet msbuild src/Squad.Agents.AI/Squad.Agents.AI.csproj -getProperty:SquadCopilotSdkVersion -nologo).Trim() | |
| if ([string]::IsNullOrWhiteSpace($sdkVersion) -or $sdkVersion -notmatch $versionGrammar) { | |
| throw "SquadCopilotSdkVersion resolved to an empty or invalid value from Squad.Agents.AI.csproj: '$sdkVersion'." | |
| } | |
| $globalPackagesOutput = dotnet nuget locals global-packages --list | |
| $nugetPackagesRoot = ($globalPackagesOutput -split ':', 2)[1].Trim() | |
| $sdkPropsPath = Join-Path $nugetPackagesRoot "github.copilot.sdk/$sdkVersion/build/GitHub.Copilot.SDK.props" | |
| if (-not (Test-Path $sdkPropsPath)) { | |
| throw "GitHub.Copilot.SDK $sdkVersion props file not found at '$sdkPropsPath'. Was the package restored yet?" | |
| } | |
| [xml]$sdkProps = Get-Content $sdkPropsPath | |
| $cliVersion = "$($sdkProps.Project.PropertyGroup.CopilotCliVersion)".Trim() | |
| if ([string]::IsNullOrWhiteSpace($cliVersion) -or $cliVersion -notmatch $versionGrammar -or $cliVersion.Contains("`n")) { | |
| throw "CopilotCliVersion parsed from '$sdkPropsPath' is empty, multiline, or does not match the expected grammar ($versionGrammar): '$cliVersion'." | |
| } | |
| Write-Host "GitHub.Copilot.SDK $sdkVersion pins Copilot CLI $cliVersion" | |
| echo "sdk-version=$sdkVersion" >> $env:GITHUB_OUTPUT | |
| echo "cli-version=$cliVersion" >> $env:GITHUB_OUTPUT | |
| - name: Build package | |
| run: dotnet build src/Squad.Agents.AI/Squad.Agents.AI.csproj --no-restore -c Release | |
| - name: Build tests | |
| run: dotnet build test/Squad.Agents.AI.Tests/Squad.Agents.AI.Tests.csproj --no-restore -c Release | |
| - name: Build sample | |
| run: dotnet build src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample/Squad.Agents.AI.Sample.csproj --no-restore -c Release | |
| # Regression guard for Reviewer finding #1 (Squad.Agents.AI PR #1519): before the | |
| # Directory.Build.props fix, test/Squad.Agents.AI.Tests and | |
| # src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample downloaded an OLDER Copilot CLI | |
| # (pinned by whatever GitHub.Copilot.SDK version Microsoft.Agents.AI.GitHub.Copilot's | |
| # buildTransitive bridge defaults to) instead of the CLI this repo actually depends | |
| # on, because neither project has a direct PackageReference to GitHub.Copilot.SDK. | |
| - name: Verify no stale Copilot CLI payload in repo builds | |
| shell: pwsh | |
| env: | |
| EXPECTED_COPILOT_CLI_VERSION: ${{ steps.copilot-cli-version.outputs.cli-version }} | |
| run: | | |
| $versionGrammar = '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z][0-9A-Za-z.]*)?$' | |
| $expected = $env:EXPECTED_COPILOT_CLI_VERSION | |
| if ([string]::IsNullOrWhiteSpace($expected) -or $expected -notmatch $versionGrammar) { | |
| throw "EXPECTED_COPILOT_CLI_VERSION is empty or does not match the expected grammar ($versionGrammar): '$expected'." | |
| } | |
| $forbidden = @('1.0.67') | |
| $projectObjDirs = @( | |
| 'src/Squad.Agents.AI/obj', | |
| 'test/Squad.Agents.AI.Tests/obj', | |
| 'src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample/obj' | |
| ) | |
| $failed = $false | |
| foreach ($objDir in $projectObjDirs) { | |
| $cliDirs = Get-ChildItem -Path $objDir -Recurse -Directory -Filter 'copilot-cli' -ErrorAction SilentlyContinue | |
| $versions = $cliDirs | ForEach-Object { Get-ChildItem -Path $_.FullName -Directory } | Select-Object -ExpandProperty Name -Unique | |
| Write-Host "$objDir -> Copilot CLI version(s): $($versions -join ', ')" | |
| if ($versions -notcontains $expected) { | |
| Write-Host "::error::$objDir did not download the expected Copilot CLI $expected (found: $($versions -join ', '))" | |
| $failed = $true | |
| } | |
| foreach ($bad in $forbidden) { | |
| if ($versions -contains $bad) { | |
| Write-Host "::error::$objDir downloaded forbidden stale Copilot CLI $bad" | |
| $failed = $true | |
| } | |
| } | |
| } | |
| if ($failed) { | |
| throw "Stale or missing Copilot CLI payload detected, see ::error annotations above." | |
| } | |
| Write-Host "All Squad.Agents.AI-related builds resolved Copilot CLI $expected." | |
| - name: Test | |
| run: dotnet test test/Squad.Agents.AI.Tests/Squad.Agents.AI.Tests.csproj --no-build -c Release --logger trx --results-directory TestResults | |
| - name: Pack | |
| run: dotnet pack src/Squad.Agents.AI/Squad.Agents.AI.csproj --no-build -c Release -o nupkgs | |
| # Hermetic consumer-level packaging check (Reviewer finding #1): proves the fix also | |
| # works for a REAL external NuGet consumer of Squad.Agents.AI, not just this repo's | |
| # own ProjectReference-based test/sample projects above (which Directory.Build.props | |
| # alone would cover even without the buildTransitive/Squad.Agents.AI.props fix in | |
| # Squad.Agents.AI.csproj). See scripts/verify-squad-agents-ai-consumer.ps1. | |
| - name: Verify Squad.Agents.AI consumer packaging (native Copilot CLI payload) | |
| shell: pwsh | |
| env: | |
| EXPECTED_COPILOT_CLI_VERSION: ${{ steps.copilot-cli-version.outputs.cli-version }} | |
| run: | | |
| ./scripts/verify-squad-agents-ai-consumer.ps1 -NupkgsDir nupkgs -ExpectedCopilotCliVersion $env:EXPECTED_COPILOT_CLI_VERSION | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 #v7 | |
| with: | |
| name: squad-agents-ai-testresults-${{ matrix.os }} | |
| path: TestResults | |
| if-no-files-found: ignore | |
| - name: Upload NuGet packages | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 #v7 | |
| with: | |
| name: squad-agents-ai-nupkgs-${{ matrix.os }} | |
| path: nupkgs | |
| if-no-files-found: error |