-
Notifications
You must be signed in to change notification settings - Fork 330
Add CI package pipeline for building and publishing NuGet packages #4292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
paulmedynski
wants to merge
7
commits into
main
Choose a base branch
from
dev/paul/sqlclient-package
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
143eeb7
Added new sqlclient-package CI pipeline.
paulmedynski cb84b71
Updated pool choice to use the Azure DevOps project name.
paulmedynski 50735cf
Add CI package pipeline for building and publishing NuGet packages
paulmedynski 1ed14bd
Address Copilot review: declare signingKeyArg conditionally, remove d…
paulmedynski 3f268d0
Exclude the new CI pipeline files from PR checks.
paulmedynski 9868788
Address Copilot review: fix verbosity switch and boolean comparisons
paulmedynski 5815f60
Added the new dotnet tools restore step.
paulmedynski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| ################################################################################# | ||
| # Licensed to the .NET Foundation under one or more agreements. # | ||
| # The .NET Foundation licenses this file to you under the MIT license. # | ||
| # See the LICENSE file in the project root for more information. # | ||
| ################################################################################# | ||
|
|
||
| # This pipeline builds all packages using the build.proj Pack target with ReferenceType=Package, | ||
| # then publishes the resulting .nupkg and .snupkg files as a single pipeline artifact. | ||
| # | ||
| # It runs: | ||
| # - On pushes to GitHub main and ADO internal/main (batched) | ||
| # - Nightly at 00:00 UTC on both branches | ||
| # | ||
| # On internal/main the strong-name signing key is downloaded and used to sign assemblies during the | ||
| # build. | ||
| # | ||
| # GOTCHA: This pipeline definition is triggered by GitHub _and_ ADO CI. We distinguish the two via | ||
| # branch filters: | ||
| # | ||
| # - Only the GitHub repo has a 'main' branch. | ||
| # - Only the ADO repo has an 'internal/main' branch. | ||
|
|
||
| name: $(DayOfYear)$(Rev:rr) | ||
|
|
||
| # Do not trigger this pipeline for PRs. | ||
| pr: none | ||
|
|
||
| # Trigger on pushes to main and internal/main, batching concurrent commits. | ||
| trigger: | ||
| batch: true | ||
| branches: | ||
| include: | ||
| - main | ||
| - internal/main | ||
|
|
||
| # Nightly schedule at 00:00 UTC. | ||
| schedules: | ||
| - cron: '0 0 * * *' | ||
| displayName: Nightly Build | ||
| branches: | ||
| include: | ||
| - main | ||
| - internal/main | ||
| always: true | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we omit running this if there were no changes merged in last 24 hours? |
||
|
|
||
| # Pipeline parameters visible in the Azure DevOps UI. | ||
| parameters: | ||
|
|
||
| # The agent image to use for the build. This must exist in both the ADO-1ES-Pool and | ||
| # ADO-CI-1ES-Pool agent pools. | ||
| - name: agentImage | ||
| displayName: Agent Image | ||
| type: string | ||
| default: ADO-UB24 | ||
|
paulmedynski marked this conversation as resolved.
|
||
| values: | ||
| - ADO-UB24 | ||
| - ADO-Win25 | ||
|
|
||
| # The build configuration to use, either Debug or Release. | ||
| - name: buildConfiguration | ||
| displayName: Build Configuration | ||
| type: string | ||
| default: Release | ||
| values: | ||
| - Debug | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not build in debug mode I think. |
||
| - Release | ||
|
|
||
| # True to enable debug steps and output. | ||
| - name: debug | ||
| displayName: Enable debug output | ||
| type: boolean | ||
| default: false | ||
|
|
||
| # The verbosity level of dotnet CLI commands. | ||
| - name: dotnetVerbosity | ||
| displayName: dotnet CLI Verbosity | ||
| type: string | ||
| default: normal | ||
| values: | ||
| - quiet | ||
| - minimal | ||
| - normal | ||
| - detailed | ||
| - diagnostic | ||
|
|
||
| variables: | ||
| # Whether this is an internal (ADO.Net project) or public (Public project) build. | ||
| - name: isInternalBuild | ||
| value: ${{ eq(variables['System.TeamProject'], 'ADO.Net') }} | ||
|
|
||
| # Signing key argument passed to build.proj. On internal builds this references the secure file | ||
| # downloaded by DownloadSecureFile@1; on public builds it expands to empty. | ||
| - name: signingKeyArg | ||
| ${{ if eq(variables.isInternalBuild, true) }}: | ||
| value: '-p:SigningKeyPath="$(keyFile.secureFilePath)"' | ||
|
paulmedynski marked this conversation as resolved.
|
||
| ${{ else }}: | ||
| value: '' | ||
|
|
||
| jobs: | ||
| - job: pack_all_packages | ||
| displayName: Pack All Packages | ||
|
|
||
| pool: | ||
| ${{ if eq(variables.isInternalBuild, true) }}: | ||
| name: ADO-1ES-Pool | ||
| ${{ else }}: | ||
| name: ADO-CI-1ES-Pool | ||
| demands: | ||
| - ImageOverride -equals ${{ parameters.agentImage }} | ||
|
|
||
|
paulmedynski marked this conversation as resolved.
|
||
| steps: | ||
|
|
||
| # Emit environment variables if debug is enabled. | ||
| - ${{ if eq(parameters.debug, true) }}: | ||
| - pwsh: | | ||
| Get-ChildItem Env: | Sort-Object Name | Format-Table -AutoSize -Wrap | ||
| displayName: '[Debug] Print Environment Variables' | ||
|
|
||
| # Install the .NET SDK from global.json. | ||
| - template: /eng/pipelines/steps/install-dotnet.yml@self | ||
| parameters: | ||
| debug: ${{ parameters.debug }} | ||
|
|
||
| # Restore dotnet local tools (pwsh, apicompat, etc.). | ||
| - template: /eng/pipelines/steps/restore-dotnet-tools.yml@self | ||
|
|
||
| # Clean any pre-existing .nupkg / .snupkg files from the packages/ directory | ||
| # to ensure we only publish packages produced by this run. | ||
| - pwsh: | | ||
| Write-Host 'Cleaning packages/ directory...' | ||
| Remove-Item -Force "$(Build.SourcesDirectory)/packages/*.nupkg" -ErrorAction SilentlyContinue | ||
| Remove-Item -Force "$(Build.SourcesDirectory)/packages/*.snupkg" -ErrorAction SilentlyContinue | ||
| Write-Host 'Done.' | ||
| displayName: Clean packages/ directory | ||
|
|
||
| # On internal builds, download the strong-name signing key. | ||
| - ${{ if eq(variables.isInternalBuild, true) }}: | ||
| - task: DownloadSecureFile@1 | ||
| displayName: Download Signing Key | ||
| inputs: | ||
| secureFile: netfxKeypair.snk | ||
| name: keyFile | ||
|
|
||
| # Run the Pack target via build.proj. | ||
| - task: DotNetCoreCLI@2 | ||
| displayName: build.proj - Pack (ReferenceType=Package) | ||
| inputs: | ||
| command: build | ||
| projects: '$(Build.SourcesDirectory)/build.proj' | ||
| arguments: >- | ||
| -t:Pack | ||
| -p:Configuration=${{ parameters.buildConfiguration }} | ||
| -p:ReferenceType=Package | ||
| -p:BuildNumber="$(Build.BuildNumber)" | ||
| -p:BuildSuffix=ci | ||
| $(signingKeyArg) | ||
| --verbosity ${{ parameters.dotnetVerbosity }} | ||
|
|
||
| # List produced packages for diagnostics. | ||
| - pwsh: | | ||
| Write-Host 'Packages produced:' | ||
| Get-ChildItem "$(Build.SourcesDirectory)/packages/*.nupkg" -ErrorAction SilentlyContinue | Format-Table Name, Length -AutoSize -Wrap | ||
| Get-ChildItem "$(Build.SourcesDirectory)/packages/*.snupkg" -ErrorAction SilentlyContinue | Format-Table Name, Length -AutoSize -Wrap | ||
| displayName: List produced packages | ||
|
|
||
| # Publish all .nupkg and .snupkg files from packages/ as a pipeline artifact. | ||
| - task: PublishPipelineArtifact@1 | ||
| displayName: Publish NuGet Packages | ||
| inputs: | ||
| targetPath: '$(Build.SourcesDirectory)/packages' | ||
| artifactName: Packages | ||
| publishLocation: pipeline | ||
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.