-
Notifications
You must be signed in to change notification settings - Fork 330
PR Pipeline - Code Coverage and Triggers #4360
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
963bccc
First crack at adding test result publishing to non-manual test jobs.
benrr101 1ce8fca
If statement syntax?
benrr101 3e28bcd
Ok forget the if statement.
benrr101 824f0d2
Version
benrr101 7bd1466
Unique job names... could be better, but let's start here.
benrr101 7bc3a20
Tree in linux?
benrr101 3388570
Ok forget it, we don't need do emit the tree....
benrr101 412f2e0
Wire up test result uploading to sqlclient manual test jobs
benrr101 9818712
Give a test display name to sql manual tests
benrr101 800a688
First attempt at code coverage report publishing
benrr101 7056130
:robot: Code coverage takes a dynamic dependency on the platforms to …
benrr101 5acf9e3
We only need *one* set of parameters
benrr101 ba57adc
We only need *one* pool name
benrr101 f6f4726
Add triggers and fix code coverage verbosity thingy
benrr101 2f28f24
:robot: fixes for codecov CLI
benrr101 0172b62
:curly_haired_man: and :robot: comments
benrr101 aed4424
:robot: Use dotnet-tools.json
benrr101 f213eaa
Comments for general variables
benrr101 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
Some comments aren't visible on the classic Files Changed page.
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
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 was deleted.
Oops, something went wrong.
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,147 @@ | ||
| ################################################################################# | ||
| # 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 and tests all products that we release. It is intended to run as validation | ||
| # for every PR. The set of tests it executes is not exhaustive, as many tests require special | ||
| # environments to provide complete coverage. Instead, this PR strikes a balance between complete | ||
| # confidence and speed of PR validation. | ||
| # | ||
| # It is triggered by pushes to PRs that target the main, dev/*, feat/*, and release/* branches in | ||
| # GitHub. The dev/* pattern includes dev/automation/* branches created by AI agents. | ||
| # | ||
| # It maps to the "sqlclient-pr" pipeline in the Public ADO project: | ||
| # https://sqlclientdrivers.visualstudio.com/public/_build?definitionId=2281 | ||
| # And the "sqlclient-pr" pipeline in the internal ADO project: | ||
| # https://dev.azure.com/SqlClientDrivers/ADO.Net/_build?definitionId=2271 | ||
|
|
||
| # Set the pipeline run name to the day-of-year and the daily run counter. | ||
| name: $(DayOfYear)$(Rev:rr) | ||
|
|
||
| # Trigger PR validation runs for all pushes to PRs that target the specified branches. | ||
| # https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#pr-triggers | ||
| pr: | ||
| branches: | ||
| include: | ||
| # GitHub repo branch targets that will trigger PR validation builds. | ||
| - dev/* | ||
| - feat/* | ||
| - main | ||
| - release/* | ||
|
|
||
| paths: | ||
| include: | ||
| - .azuredevops/* | ||
| - .config/* | ||
| - doc/* | ||
| - eng/pipelines/common/* | ||
| - eng/pipelines/pr/* | ||
| - src/* | ||
| - tools/* | ||
| - azurepipelines-coverage.yml | ||
| - build.proj | ||
| - Directory.Packages.props | ||
| - dotnet-tools.json | ||
| - global.json | ||
| - NuGet.config | ||
|
|
||
| # Do not trigger commit or schedule runs for this pipeline. | ||
| trigger: none | ||
|
|
||
| parameters: | ||
| # General Parameters ===================================================== | ||
|
|
||
| # Dotnet CLI verbosity level. | ||
| - name: dotnetVerbosity | ||
| displayName: dotnet CLI Verbosity | ||
| type: string | ||
| default: normal | ||
| values: | ||
| - quiet | ||
| - minimal | ||
| - normal | ||
| - detailed | ||
| - diagnostic | ||
|
|
||
| - name: platforms | ||
| type: object | ||
| default: | ||
| - displayName: "windows_net462" | ||
| dotnet: "net462" | ||
| image: "ADO-MMS22-SQL22" | ||
| operatingSystem: "Windows" | ||
| - displayName: "windows_net8" | ||
| dotnet: "net8.0" | ||
| image: "ADO-MMS22-SQL22" | ||
| operatingSystem: "Windows" | ||
| - displayName: "windows_net9" | ||
| dotnet: "net9.0" | ||
| image: "ADO-MMS22-SQL22" | ||
| operatingSystem: "Windows" | ||
| - displayName: "windows_net10" | ||
| dotnet: "net10.0" | ||
| image: "ADO-MMS22-SQL22" | ||
| operatingSystem: "Windows" | ||
|
|
||
| - displayName: "linux_net8" | ||
| dotnet: "net8.0" | ||
| image: "ADO-UB22-SQL22" | ||
| operatingSystem: "Linux" | ||
| - displayName: "linux_net9" | ||
| dotnet: "net9.0" | ||
| image: "ADO-UB22-SQL22" | ||
| operatingSystem: "Linux" | ||
| - displayName: "linux_net10" | ||
| dotnet: "net10.0" | ||
| image: "ADO-UB22-SQL22" | ||
| operatingSystem: "Linux" | ||
|
|
||
| variables: | ||
| - template: /eng/pipelines/common/variables/common-variables.yml@self | ||
| - template: /eng/pipelines/pr/variables/pr-variables.yml@self | ||
|
|
||
| stages: | ||
| # Stage 1a: Build and pack all projects in the repository | ||
| - template: /eng/pipelines/pr/stages/pack-stage.yml@self | ||
| parameters: | ||
| buildConfiguration: Debug | ||
| buildSuffix: pr | ||
| stageName: ${{ variables.stageNamePack }} | ||
|
|
||
| # Stage 1b: Generate secrets | ||
| - template: /eng/pipelines/pr/stages/generate-secrets-stage.yml@self | ||
|
cheenamalhotra marked this conversation as resolved.
|
||
| parameters: | ||
| stageName: ${{ variables.stageNameSecrets }} | ||
|
|
||
| # Stage 2: Execute tests and collect code coverage | ||
| - template: /eng/pipelines/pr/stages/test-stages.yml@self | ||
| parameters: | ||
| buildConfiguration: Debug | ||
| buildSuffix: pr | ||
| dotnetVerbosity: ${{ parameters.dotnetVerbosity }} | ||
| poolName: $(PoolNameDefault) | ||
| stageNamePack: ${{ variables.stageNamePack }} | ||
| stageNameSecrets: ${{ variables.stageNameSecrets }} | ||
| testResultsArtifactBaseName: ${{ variables.testResultsArtifactBaseName }} | ||
|
|
||
| platforms: ${{ parameters.platforms }} | ||
|
|
||
| manualTestAzureKeyVaultUrl: $(AzureKeyVaultUrl) | ||
| manualTestAzureKeyVaultTenantId: $(AzureKeyVaultTenantId) | ||
| manualTestConnectionStringNpLocalhost: $(ConnectionStringNp_LocalhostDefault_UsernamePassword) | ||
| manualTestConnectionStringTcpLocalhost: $(ConnectionStringTcp_LocalhostDefault_UsernamePassword) | ||
| manualTestConnectionStringNpAzure: $(ConnectionStringNp_Azure_ManagedIdentity) | ||
| manualTestConnectionStringTcpAzure: $(ConnectionStringTcp_Azure_ManagedIdentity) | ||
| manualTestFileStreamDirectory: "$(Pipeline.Workspace)/filestream" | ||
| manualTestLocalDbAppName: $(LocalDbAppName) | ||
| manualTestLocalDbSharedInstanceName: $(LocalDbSharedInstanceName) | ||
| manualTestUserManagedIdentityClientId: $(UserManagedIdentityClientId) | ||
|
|
||
| # Stage 3: Collect code coverage | ||
| - template: /eng/pipelines/pr/stages/collect-coverage-stage.yml@self | ||
| parameters: | ||
| dependsOn: | ||
| - ${{ each platform in parameters.platforms }}: | ||
| - "test_${{ platform.displayName }}" | ||
|
cheenamalhotra marked this conversation as resolved.
|
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,75 @@ | ||
| ################################################################################# | ||
| # 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. # | ||
| ################################################################################# | ||
|
|
||
| parameters: | ||
|
|
||
| # Names of the test stages that must complete before collecting coverage. | ||
| - name: dependsOn | ||
| type: object | ||
| default: [] | ||
|
|
||
| stages: | ||
| - stage: collect_code_coverage | ||
| displayName: "Collect code coverage" | ||
| dependsOn: ${{ parameters.dependsOn }} | ||
|
|
||
| jobs: | ||
| - job: collect_code_coverage | ||
| displayName: "Collect Code Coverage" | ||
|
|
||
| pool: | ||
| vmImage: ubuntu-latest | ||
|
|
||
| variables: | ||
|
|
||
| # Set up a temporary directory that is cleaned up after each job run. This helps avoid | ||
| # disk space issues on pooled agents that may run many jobs before being retired. | ||
| - name: workingDir | ||
| value: "$(Agent.TempDirectory)/coverage" | ||
|
|
||
| steps: | ||
|
|
||
| # Part 1) Merge coverage reports ================================= | ||
|
|
||
| # Install .NET SDK | ||
| - template: /eng/pipelines/common/steps/install-dotnet.yml@self | ||
|
|
||
| # Restore additional dotnet tools | ||
| - template: /eng/pipelines/common/steps/restore-dotnet-tools.yml@self | ||
|
|
||
| # Download coverage reports from the test jobs. | ||
| # NOTE: The artifact name is not specified, so *all* artifacts of the build will be | ||
| # checked for the coverage reports. | ||
| - task: DownloadPipelineArtifact@2 | ||
| displayName: Download coverage reports | ||
| inputs: | ||
| itemPattern: '**/*.coverage' | ||
| targetPath: "${{ variables.workingDir }}/originals" | ||
|
|
||
| # Merge original files into a single Cobertura XML file | ||
| - script: >- | ||
| dotnet tool run dotnet-coverage -- merge "${{ variables.workingDir }}/originals/**/*.coverage" | ||
| --output "${{ variables.workingDir }}/merge/cobertura.xml" | ||
| --output-format cobertura | ||
| --log-file "${{ variables.workingDir }}/merge/merge.log" | ||
| --log-level Verbose | ||
| displayName: Merge coverage files | ||
| workingDirectory: $(REPO_ROOT) | ||
|
|
||
| # Part 2) Publish merged results to the pipeline results/artifacts | ||
|
|
||
| # Publish the merged coverage file as a pipeline artifact | ||
| - task: PublishPipelineArtifact@1 | ||
| displayName: Publish coverage artifact | ||
| inputs: | ||
| artifact: merged_coverage | ||
| targetPath: "${{ variables.workingDir }}/merge" | ||
|
paulmedynski marked this conversation as resolved.
|
||
|
|
||
| # Publish the merged coverage file as coverage results so they can be viewed in ADO UI. | ||
| - task: PublishCodeCoverageResults@2 | ||
| displayName: Publish coverage results | ||
| inputs: | ||
| summaryFileLocation: "${{ variables.workingDir }}/merge/cobertura.xml" | ||
Oops, something went wrong.
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.