Add CI package pipeline for building and publishing NuGet packages#4292
Add CI package pipeline for building and publishing NuGet packages#4292paulmedynski wants to merge 22 commits into
Conversation
Wire Microsoft.SqlServer.Server as a project reference (ReferenceType=Project) or package reference (ReferenceType=Package) across all consuming projects: SqlClient src/ref/notsupported, Abstractions, Azure, AKV Provider, UDT test projects, samples, and doc projects. - Add Versions.props to each sibling project for package version management - Add PackageVersionSqlServer build argument to build.proj - Update Directory.Packages.props with SqlServer version properties - Add local feed mirroring for Package mode builds - Update versioning comment documentation in Directory.Build.props
- Add SqlServerStrongNameTestCondition to detect unsigned assemblies - Skip net462 UDT tests when SqlServer.Server is not strong-name signed - Fix SqlServer pack output path in build.proj
- Replace hardcoded SqlServer.Server 1.0.0 dependency in nuspec with $SqlServerPackageVersion$ token, matching Abstractions/Logging pattern. - Import SqlServer Versions.props in csproj for version resolution during pack. - Add SqlServerPackageVersion validation and token expansion in PrepareSqlClientPackNuspec target. - Pass PackageVersionSqlServer through build.proj PackSqlClient target. - Fix BuildTests to not pass ReferenceType to UnitTests (project-only).
Pass the locally-built SqlServer.Server package version through all build and test pipeline templates: - ci-build-nugets-job: accept and forward SqlServerPackageVersion - ci-run-tests-job/stage: download SqlServer artifacts, forward version - ci-project-build-step: pass version to dotnet build - run-all-tests-step: pass version to all MSBuild test invocations - dotnet-sqlclient-ci-core: wire version to all stages - build-sqlclient-package-ci-stage: forward to build job - build-azure-package-ci-stage: forward to build and test jobs - test-azure-package-ci-job: download SqlServer artifacts
- Add ImplicitUsings=enable to TestCommon.csproj so System.Type resolves on net462 (fixes CS0246 in SqlServerStrongNameTestCondition.cs) - Fix typo: 'assembly us signed' -> 'assembly is signed'
Document the two-path import strategy (Directory.Packages.props for Package mode vs. csproj-level conditional imports for Project mode) and how guard properties prevent double-evaluation.
…ork builds
- Add [Trait("Category", "signed")] under #if NETFRAMEWORK to tests that
load Microsoft.SqlServer.Types (depends on strongly-named SqlServer.Server)
- Append category!=signed to TestFilters in build.proj when SigningKeyPath is
empty (unsigned build)
- Remove SqlServerStrongNameTestCondition runtime probe (no longer needed)
- Revert ConditionalFact wrappers to original form in SqlServerTypesTest
There was a problem hiding this comment.
Pull request overview
Adds a new CI pipeline that builds and publishes NuGet packages via build.proj in ReferenceType=Package mode, alongside a broader refactor to make package-mode builds self-sustaining: version flow is unified through import-guarded Versions.props files imported early by Directory.Packages.props, all Pack* targets now mirror their output into the local packages/ feed and gain DependsOn chains so dependent packages restore against freshly built nupkgs, and many test/csproj files now switch between ProjectReference and PackageReference for Microsoft.SqlServer.Server based on ReferenceType. A new signed test category gates UDT tests that require a strong-name-signed Microsoft.SqlServer.Server.
Changes:
- New pipeline
eng/pipelines/ci/package/sqlclient-package.yml(push tomain/internal/main, nightly, optional strong-name signing on internal builds). build.projandDirectory.Packages.propsoverhaul: package-modeDependsOn/Pack mirroring, centralSqlServerPackageVersiontoken wiring,category!=signedfilter for unsigned builds.- Threading of
sqlServerArtifactsName/sqlServerPackageVersionthrough existing CI templates, and reference-mode switching forMicrosoft.SqlServer.Serveracross csprojs (including nuspec token$SqlServerPackageVersion$).
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| eng/pipelines/ci/package/sqlclient-package.yml | New CI pipeline that packs all packages and publishes Packages artifact. |
| build.proj | Adds package-mode DependsOn chains, output mirroring to packages/, category!=signed filter, and PackageVersionSqlServer threading. |
| Directory.Packages.props | Imports all Versions.props in Package mode to centrally manage sibling package versions. |
| doc/Directory.Packages.props, doc/samples/Microsoft.Data.SqlClient.Samples.csproj | Pin and reorganize Microsoft.SqlServer.Server package usage. |
| src/Directory.Build.props | Comment clarifying FileVersionBuildNumber ordering relative to Directory.Packages.props. |
| src/**/Versions.props (×6) | Add per-product import-guard property to prevent double evaluation. |
| src/**/*.csproj (Logging, Abstractions, Azure, AKV, SqlServer, SqlClient src/ref/notsupported) | Conditional Versions.props import using the new guard; SqlClient ref/notsupported gain SqlServer reference; nuspec token updated. |
| src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj | Adds SqlServer version import, trim, validation error, and nuspec token replacement. |
| src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.nuspec | Replaces hard-coded 1.0.0 with $SqlServerPackageVersion$ token. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/...csproj | Adds ValidateReferenceType target and project reference to Microsoft.SqlServer.Server. |
| src/Microsoft.Data.SqlClient/tests/ManualTests/...csproj | Reference-mode switching for Microsoft.SqlServer.Server (top-level and UDT projects). |
| src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj | Enables ImplicitUsings. |
| src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/SqlServerTypesTest.cs, FunctionalTests/SqlDataRecordTest.cs | Adds [Trait("Category", "signed")] on NETFRAMEWORK for UDT tests requiring signed SqlServer assembly. |
| eng/pipelines/**/*.yml (ci-core, build-sqlclient/azure stages, ci-run-tests stage/job, ci-build-nugets, ci-project-build, run-all-tests, test-azure-package job) | Thread new sqlServerArtifactsName/sqlServerPackageVersion parameter and download the SqlServer artifact for package-mode test/build flows. |
Version bumps (next preview): - SqlServer: 1.0.0 -> 1.1.0-preview1 - Abstractions: 1.0.0 -> 1.1.0-preview1 - Logging: 1.0.0 -> 1.1.0-preview1 - Azure: 1.0.0 -> 1.1.0-preview1 - AKV Provider: 7.0.0 -> 7.1.0-preview1 This fixes NU1605 (package downgrade) errors in Package-mode CI builds where Microsoft.SqlServer.Types >= 1.0.0 conflicts with the CI-produced prerelease 1.0.0-ci* (prerelease sorts below stable in SemVer). build.proj fixes: - Reorder Package-mode DependsOn so PackLogging runs before PackAbstractions (Abstractions has a PackageReference on Logging) - Fix 'Encrpyted' typos in AKV section comments and messages - Fix AkvProviderProjectpath casing
Change PackageVersionSqlServer to SqlServerPackageVersion in test-azure-package-ci-job.yml. This job runs dotnet build directly against Azure.Test.csproj (not build.proj), so the build.proj-level PackageVersionSqlServer property was silently ignored. The csproj consumes SqlServerPackageVersion via Directory.Packages.props and Versions.props.
2b54e4e to
da6d01c
Compare
In Package mode, Azure.csproj depends on Microsoft.Data.SqlClient.Internal.Logging via PackageReference, pinned by LoggingPackageVersion in Directory.Packages.props. The Azure test job downloaded Logging artifacts but never passed the version property, so NuGet restore could pick a mismatched default version. Add loggingPackageVersion parameter to test-azure-package-ci-job.yml and thread it through build-azure-package-ci-stage.yml and dotnet-sqlclient-ci-core.yml so Package-mode restores pin the correct Logging version.
5977b22 to
ccfa6f8
Compare
ccfa6f8 to
98683d2
Compare
98683d2 to
b1e3b65
Compare
b1e3b65 to
9015ee3
Compare
d038ec5 to
2a46b0a
Compare
2a46b0a to
2463f9a
Compare
9015ee3 to
bef42de
Compare
- Change -verbosity: to --verbosity for dotnet CLI consistency - Change isInternalBuild comparisons from string 'True' to boolean true
e91096e to
fd1a2ff
Compare
This is ready for review, but is based on PR #4300. It can't merge until that PR merges and I switch this PR to target main.
Adds a new top-level pipeline at
eng/pipelines/ci/package/sqlclient-package.ymlthat:mainand ADOinternal/mainbranches (batched)packages/directory before buildingbuild.projPack target withReferenceType=PackageTested ADO.Net project runs here:
We can't test Public project runs until this merges, because we can only create new pipelines based on GitHub for YAML files on main.