diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 930a1eb..30e9809 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -157,6 +157,49 @@ jobs: dotnet build src/Couchbase.Analytics/Couchbase.Analytics.csproj -c Release --no-restore /p:ContinuousIntegrationBuild=true /p:Version="${{ needs.validate-inputs.outputs.tag }}" /p:IncludeSymbols=true /p:IncludeSource=true /p:SourceLinkCreate=true /p:SignAssembly=true /p:AssemblyOriginatorKeyFile="$env:SIGNKEY_PATH" dotnet pack src/Couchbase.Analytics/Couchbase.Analytics.csproj -c Release /p:ContinuousIntegrationBuild=true /p:Version="${{ needs.validate-inputs.outputs.tag }}" /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:IncludeSource=true /p:SourceLinkCreate=true /p:SignAssembly=true /p:AssemblyOriginatorKeyFile="$env:SIGNKEY_PATH" + - name: Verify package contents (DLL <-> PDB parity) + shell: pwsh + run: | + $ver = "${{ needs.validate-inputs.outputs.tag }}" + $packDir = "src/Couchbase.Analytics/bin/Release" + $nupkg = Get-ChildItem -Path $packDir -Filter "*.$ver.nupkg" | Where-Object { $_.Name -notlike "*.symbols.nupkg" } | Select-Object -First 1 + $snupkg = Get-ChildItem -Path $packDir -Filter "*.$ver.snupkg" | Select-Object -First 1 + if (-not $nupkg) { Write-Error "No .nupkg matching version $ver found in $packDir"; exit 1 } + if (-not $snupkg) { Write-Error "No .snupkg matching version $ver found in $packDir"; exit 1 } + + Add-Type -AssemblyName System.IO.Compression.FileSystem + + function Get-LibEntries($path, $extension) { + $zip = [System.IO.Compression.ZipFile]::OpenRead($path) + try { + return @($zip.Entries | Where-Object { $_.FullName -like "lib/*$extension" } | ForEach-Object { $_.FullName }) + } finally { + $zip.Dispose() + } + } + + $dlls = Get-LibEntries $nupkg.FullName ".dll" + $pdbs = Get-LibEntries $snupkg.FullName ".pdb" + + Write-Host "DLLs in $($nupkg.Name):" + $dlls | ForEach-Object { Write-Host " $_" } + Write-Host "PDBs in $($snupkg.Name):" + $pdbs | ForEach-Object { Write-Host " $_" } + + # Every DLL shipped in lib// must have a matching PDB at the same path in the symbol package. + $missing = @() + foreach ($dll in $dlls) { + $expectedPdb = [System.IO.Path]::ChangeExtension($dll, ".pdb") + if (-not ($pdbs -contains $expectedPdb)) { + $missing += $expectedPdb + } + } + if ($missing.Count -gt 0) { + Write-Error ("Symbol package is missing PDB(s) for bundled DLL(s):`n " + ($missing -join "`n ")) + exit 1 + } + Write-Host "Symbol package contains PDBs for all $($dlls.Count) bundled DLL(s)." + - name: Upload Packages Artifact uses: actions/upload-artifact@v4 with: diff --git a/src/Couchbase.Analytics/Couchbase.Analytics.csproj b/src/Couchbase.Analytics/Couchbase.Analytics.csproj index f7c361c..c7eb9d5 100644 --- a/src/Couchbase.Analytics/Couchbase.Analytics.csproj +++ b/src/Couchbase.Analytics/Couchbase.Analytics.csproj @@ -6,15 +6,15 @@ enable Couchbase.AnalyticsClient 1.0.1 - + Couchbase.AnalyticsClient Couchbase.AnalyticsClient Couchbase Analytics Client The Official Couchbase Analytics .NET SDK - + Apache-2.0 README.md - + https://docs.couchbase.com/dotnet-analytics-sdk/current/project-docs/analytics-sdk-release-notes.html true @@ -39,10 +39,30 @@ Couchbase.Core.dll - + - - + + + $(TargetsForTfmSpecificDebugSymbolsInPackage);IncludeReferencedProjectSymbolsInSymbolPackage + + + + + <_ReferencedProjectPdb Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).pdb')" + Condition="'%(ReferenceCopyLocalPaths.ReferenceSourceTarget)' == 'ProjectReference' and '%(ReferenceCopyLocalPaths.Extension)' == '.dll'" /> + + + + + \ No newline at end of file