Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .config/CredScanSuppressions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"tool": "Credential Scanner",
"suppressions": [
"suppressions":
[
{
"file": "src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.Servers/TDSServerArguments.cs",
"justification": "Test projects should be skipped"
Expand All @@ -12,6 +13,14 @@
{
"file": "doc/samples/SqlConnectionStringBuilder.cs",
"justification": "Documentation could include sample data and can be ignored"
},
{
"file": "src/Microsoft.Data.SqlClient/tests/UnitTests/Fixtures/AlwaysEncrypted/NativeColumnEncryptionKeyCertificateBaselineFixture.cs",
"justification": "Test projects should be skipped"
},
{
"file": "src/Microsoft.Data.SqlClient/tests/UnitTests/Resources/AlwaysEncrypted/NativeColumnEncryptionKeyBaseline/Certificate.pfx",
"justification": "Test projects should be skipped"
}
]
}
6 changes: 1 addition & 5 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ jobs:
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v5.0.1
with:
# TODO: Update this to .NET 10 once PR #3686 is complete.
# TODO: Replace this with global-json-file once PR #3797 is complete.
dotnet-version: 9.x
dotnet-quality: ga
#global-json-file: global.json
global-json-file: global.json

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
9 changes: 9 additions & 0 deletions BUILDGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

This document provides all the necessary details to build the driver and run tests present in the repository.

## .NET SDK

The projects in this repo require the .NET 10.0 SDK to build. Please ensure you
have the latest version of that SDK installed.

Tests and tools may require different .NET Runtimes that may be installed
independently. For example, tests targeting .NET 8.0 will need that runtime
installed.

## Visual Studio Pre-Requisites

This project should be built with Visual Studio 2019+ for the best compatibility. The required set of components are provided in the below file:
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ When targeting .NET on Windows, a package reference to [Microsoft.Data.SqlClient

| Topic | Link to File |
| :---- | :------------- |
| Coding Style | [coding-style.md](/policy/coding-style.md) |
| Best Practices | [coding-best-practices.md](/policy/coding-best-practices.md) |
| Review Process | [review-process.md](/policy/review-process.md) |
| Guidelines for building the driver | [BUILDGUIDE.md](BUILDGUIDE.md) |
| Guidelines for Contributors | [CONTRIBUTING.md](CONTRIBUTING.md) |
| Changelog for all driver releases | [CHANGELOG.md](CHANGELOG.md) |
| Support Policy | [SUPPORT.md](SUPPORT.md) |
| Build Guide | [BUILDGUIDE.md](/BUILDGUIDE.md) |
| Changelog | [CHANGELOG.md](CHANGELOG.md) |
| Code of Conduct | [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) |
| Coding Style | [coding-style.md](/policy/coding-style.md) |
| Contributing | [CONTRIBUTING.md](CONTRIBUTING.md) |
| Copyright Information | [COPYRIGHT.md](COPYRIGHT.md) |
| Review Process | [review-process.md](/policy/review-process.md) |
| Support Policy | [SUPPORT.md](SUPPORT.md) |

## Our Featured Contributors

Expand Down
7 changes: 7 additions & 0 deletions eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ jobs:
- ${{ if ne(parameters.prebuildSteps, '') }}:
- ${{ parameters.prebuildSteps }} # extra steps to run before the build like downloading sni and the required configuration

# Install whichever .NET SDKs are specified in our global.json.
- task: UseDotNet@2
displayName: Install .NET SDKs
inputs:
packageType: sdk
useGlobalJson: true

- template: ../steps/ci-project-build-step.yml@self
parameters:
platform: ${{ parameters.platform }}
Expand Down
16 changes: 7 additions & 9 deletions eng/pipelines/common/templates/jobs/ci-code-coverage-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,14 @@ jobs:
- pwsh: 'Get-ChildItem env: | Sort-Object Name'
displayName: '[Debug] List Environment Variables'

- template: ../steps/ensure-dotnet-version.yml@self
parameters:
packageType: sdk
version: '10.0'

- template: ../steps/ensure-dotnet-version.yml@self
parameters:
packageType: runtime
version: '9.0'
# Install whichever .NET SDKs are specified in our global.json.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code coverage only runs on Windows x64, so we don't need the special ensure-dotnet.version template here.

- task: UseDotNet@2
displayName: Install .NET SDKs
inputs:
packageType: sdk
useGlobalJson: true

# Install additional dotnet tools.
- pwsh: |
dotnet tool install --global dotnet-coverage
dotnet tool install --global dotnet-reportgenerator-globaltool
Expand Down
110 changes: 84 additions & 26 deletions eng/pipelines/common/templates/jobs/ci-run-tests-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ parameters:
# The timeout, in minutes, for this job.
- name: timeout
type: number

# True if this is an ARM64 job.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to detect ARM64 - we already know explicitly which agent images are ARM64 and we can simply set this flag in those cases.

- name: isArm64
type: boolean
default: false

jobs:
- job: ${{ format('{0}', coalesce(parameters.jobDisplayName, parameters.image, 'unknown_image')) }}
Expand All @@ -102,6 +107,58 @@ jobs:
value: '$(dotnetx86Path)'

steps:

# Install .NET SDKs and runtimes. These may be needed for the pre-build
# steps.
#
# We can use the standard UseDotNet@2 task for non-ARM64 jobs.
- ${{ if eq(parameters.isArm64, false) }}:
- task: UseDotNet@2
displayName: Install .NET SDKs
inputs:
packageType: sdk
useGlobalJson: true

- task: UseDotNet@2
displayName: Install .NET 9 Runtime
inputs:
packageType: runtime
version: 9.x

- task: UseDotNet@2
displayName: Install .NET 8 Runtime
inputs:
packageType: runtime
version: 8.x

# For ARM64, we need to use our custom step to work around a bug in
# UseDotNet@2:
#
# [BUG]: UseDotNet task installs x86 build
# https://github.com/microsoft/azure-pipelines-tasks/issues/20300
#
- ${{ else }}:
- template: ../../../steps/install-dotnet-arm64.yml@self
parameters:
debug: ${{ parameters.debug }}
installType: SDK
# GOTCHA: We always use global.json for SDK version except on ARM64,
# where we have to specify it here. This must be kept synchronized with
# the SDK version in global.json.
version: 10.0

- template: ../../../steps/install-dotnet-arm64.yml@self
parameters:
debug: ${{ parameters.debug }}
installType: Runtime
version: 9.0

- template: ../../../steps/install-dotnet-arm64.yml@self
parameters:
debug: ${{ parameters.debug }}
installType: Runtime
version: 8.0

- ${{ if ne(parameters.prebuildSteps, '') }}:
- ${{ parameters.prebuildSteps }} # extra steps to run before the build like downloading sni and the required configuration

Expand All @@ -121,6 +178,12 @@ jobs:
}
displayName: 'Verify Password'

- ${{ if eq(parameters.buildType, 'Project') }}:
- template: ../steps/ci-project-build-step.yml@self
parameters:
build: allNoDocs
buildConfiguration: ${{ parameters.buildConfiguration }}

- ${{ if ne(parameters.configProperties, '{}') }}:
- template: ../steps/update-config-file-step.yml@self # update config.json file
parameters:
Expand Down Expand Up @@ -253,33 +316,28 @@ jobs:
# it should be acceptable to just install a specific version in all cases.
# @TODO: This setup is very confusing. Ideally we should just be utilizing the dotnet installation
# earlier in the job. There has to be a cleaner way of doing this.
# As it stands now, we install dotnet LTS if we're running netfx tests, and the appropriate netX
# version if we're running netcore tests. Technically LTS is not supported by the UseDotNet task
# but we know we're using install-dotnet since we're on windows (for now ... this will not work
# forever and needs a serious rethinking).
- ${{ if ne(variables['dotnetx86RootPath'], '') }}:
- ${{ if startswith(parameters.targetFramework, 'net4')}}:
- template: ../steps/ensure-dotnet-version.yml
parameters:
installDir: "$(dotnetx86RootPath)"
packageType: "sdk"
usePreview: "false"
version: "LTS"
windowsArchitecture: "x86"
- ${{ else }}:
- script: |
set FrameworkVersion=${{ parameters.targetFramework }}
echo %FrameworkVersion%
set TrimmedFrameworkVersion=%FrameworkVersion:~3%
echo %TrimmedFrameworkVersion%
echo ##vso[task.setvariable variable=netVersionX86]%TrimmedFrameworkVersion%
displayName: "Trim dotnet version"
- template: ../steps/ensure-dotnet-version.yml
parameters:
installDir: "$(dotnetx86RootPath)"
packageType: "sdk"
usePreview: "false"
version: $(netVersionX86)
# Install whichever .NET SDKs are specified in our global.json.
- task: UseDotNet@2
displayName: Install .NET SDKs
inputs:
installationPath: $(dotnetx86RootPath)
packageType: sdk
useGlobalJson: true
env:
# Override the architecture to install for x86.
PROCESSOR_ARCHITECTURE: x86

# Install the .NET 8.0 runtime to run tests that target it.
- task: UseDotNet@2
displayName: Install .NET 8.0 Runtime
inputs:
installationPath: $(dotnetx86RootPath)
packageType: runtime
version: 8.x
env:
# Override the architecture to install for x86.
PROCESSOR_ARCHITECTURE: x86

- template: ../steps/run-all-tests-step.yml@self
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ stages:
publishTestResults: true
configSqlFor: ${{ config.value.configSqlFor }}
operatingSystem: ${{ config.value.operatingSystem }}
isArm64: ${{ eq(config.value.isArm64, 'true') }}
${{if ne(config.value.configProperties, '{}') }}:
${{ each x86TF in config.value.configProperties.x86TestTargetFrameworks }}:
${{ if eq(x86TF, targetFramework) }}:
Expand Down Expand Up @@ -103,6 +104,7 @@ stages:
publishTestResults: true
configSqlFor: ${{ config.value.configSqlFor }}
operatingSystem: ${{ config.value.operatingSystem }}
isArm64: ${{ eq(config.value.isArm64, 'true') }}
${{if and(eq(usemanagedSNI, false), ne(config.value.configProperties, '{}')) }}:
${{ each x86TF in config.value.configProperties.x86TestTargetFrameworks }}:
${{ if eq(x86TF, targetFramework) }}:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,23 @@ parameters:
- MSS

steps:
- task: DownloadSecureFile@1
displayName: 'Download Key Pair'
inputs:
secureFile: netfxKeypair.snk
retryCount: 5

- task: UseDotNet@2
displayName: 'Use .NET 10.x sdk'
inputs:
packageType: sdk
version: '10.x'

- task: UseDotNet@2
displayName: 'Use .NET 9.x runtime'
inputs:
packageType: runtime
version: '9.x'

- task: UseDotNet@2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need a .NET 8 runtime to build things. We would only need it to run tests, which doesn't happen as part of this pipeline tree.

displayName: 'Install .NET 8.x runtime'
inputs:
packageType: runtime
version: '8.x'
- task: DownloadSecureFile@1
displayName: 'Download Key Pair'
inputs:
secureFile: netfxKeypair.snk
retryCount: 5

- ${{ if eq(parameters.product, 'MDS') }}:
- task: MSBuild@1
displayName: 'BuildAllConfigurations using build.proj'
# Install whichever .NET SDKs are specified in our global.json.
- task: UseDotNet@2
displayName: Install .NET SDKs
inputs:
solution: '**/build.proj'
configuration: '${{parameters.buildConfiguration }}'
msbuildArguments: '-p:AssemblyFileVersion=${{parameters.AssemblyFileVersion }} -t:BuildAllConfigurations -p:GenerateNuget=false -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk'
packageType: sdk
useGlobalJson: true

- ${{ if eq(parameters.product, 'MDS') }}:
- task: MSBuild@1
displayName: 'BuildAllConfigurations using build.proj'
inputs:
solution: '**/build.proj'
configuration: '${{parameters.buildConfiguration }}'
msbuildArguments: '-p:AssemblyFileVersion=${{parameters.AssemblyFileVersion }} -t:BuildAllConfigurations -p:GenerateNuget=false -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk'
24 changes: 0 additions & 24 deletions eng/pipelines/common/templates/steps/ci-prebuild-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,6 @@ parameters:
- Package

steps:
- template: ensure-dotnet-version.yml
parameters:
packageType: sdk
usePreview: false
version: 10.0

- template: ensure-dotnet-version.yml
parameters:
packageType: runtime
usePreview: false
version: 9.0

- template: ensure-dotnet-version.yml
parameters:
packageType: runtime
usePreview: false
version: 8.0

- ${{if eq(parameters.debug, true)}}:
- powershell: |
Get-ChildItem env: | Sort-Object Name
Expand All @@ -61,9 +43,3 @@ steps:
parameters:
downloadedNugetPath: $(Pipeline.Workspace)\${{parameters.artifactName }}
debug: ${{ parameters.debug }}

- ${{ else }}: # project
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was weird for the pre-build step to run a build. This has been moved out to the calling template, along with the installation of the SDKs and Runtimes.

- template: ci-project-build-step.yml@self
parameters:
build: allNoDocs
buildConfiguration: ${{ parameters.buildConfiguration }}
15 changes: 0 additions & 15 deletions eng/pipelines/common/templates/steps/ci-project-build-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,6 @@ parameters:
- allNoDocs

steps:
- template: ./ensure-dotnet-version.yml@self
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now happens earlier in the template tree.

parameters:
packageType: 'sdk'
version: '10.0'

- template: ./ensure-dotnet-version.yml@self
parameters:
packageType: 'runtime'
version: '9.0'

- template: ./ensure-dotnet-version.yml@self
parameters:
packageType: 'runtime'
version: '8.0'

- ${{ if or(eq(parameters.operatingSystem, 'Windows'), eq(parameters.operatingSystem, 'deferedToRuntime')) }}:
- ${{ if or(eq(parameters.build, 'MDS'), eq(parameters.build, 'all'), eq(parameters.build, 'allNoDocs')) }}:
- task: MSBuild@1
Expand Down
Loading
Loading