Skip to content

Commit

Permalink
Merged PR 30352: arcade into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nohwnd committed Mar 31, 2023
1 parent d187201 commit 681849f
Show file tree
Hide file tree
Showing 225 changed files with 1,539 additions and 61,808 deletions.
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<Version Condition="'$(Version)' == ''">$(TPVersionPrefix)-dev</Version>
<!-- Override the AssemblyVersion as 15.0.0 since protocol depends on this version for serialization. This is also defined in build script. -->
<AssemblyVersion Condition="'$(AssemblyVersion)' == ''">15.0.0</AssemblyVersion>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup>

<!-- Language configuration -->
Expand Down Expand Up @@ -85,6 +86,8 @@
<!-- Test config -->
<PropertyGroup>
<TestRunnerName>MSTest</TestRunnerName>
<!-- Skip windows only tests on non-windows systems. -->
<TestRunnerAdditionalArguments Condition=" '$(OS)' != 'Windows_NT' ">$(TestRunnerAdditionalArguments) --filter "TestCategory!=Windows&amp;TestCategory!=Windows-Review"</TestRunnerAdditionalArguments>
</PropertyGroup>

</Project>
11 changes: 9 additions & 2 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
</packageRestore>
<packageSources>
<clear />
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<!-- When building TestAssets we read the keys from here and provide them directly to dotnet restore together with path to artifacts/packages/<configuration>/Shipping,
because the path to packages contains configuration and we don't want to modify a checked-in file in our repo to be able to build. -->
<add key="vs-impl" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="test-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
<add key="dotnet3.1" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json" />
Expand All @@ -15,10 +17,15 @@
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="vs-impl" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json" />
<!-- When building isolated test projects we copy this file into temp, and insert localy-built-packages source here, that points to artifacts/packages/<configuration>/Shipping. -->
</packageSources>
<fallbackPackageFolders>
<clear />
</fallbackPackageFolders>
<config>
<!-- Location of .packages is forced by Arcade in their scripts, but we also want this to be respected by VS, so we want to keep this setting here. -->
<!-- When building isolated test projects we copy this file into temp and replace ".packages" with full path to that folder. -->
<add key="globalPackagesFolder" value=".packages" />
</config>
<disabledPackageSources />
</configuration>
73 changes: 14 additions & 59 deletions TestPlatform.sln

Large diffs are not rendered by default.

160 changes: 131 additions & 29 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ trigger:
- main
- rel/*
- arcade
- arcade-test-onboarding
- arcade-tests-on-non-windows

# Branch(es) that trigger(s) build(s) on PR
pr:
Expand Down Expand Up @@ -47,6 +49,11 @@ variables:
value: False
- name: _InternalBuildArgs
value: ' '
# Arcade is using global cache of nugets in non-windows build
# under some circumstances, but we don't respect that in our code and try to find them
# in .packages. Force the location of packages to that folder.
- name: NUGET_PACKAGES
value: '$(Build.SourcesDirectory)/.packages'

# Produce real signed binaries for Internal builds
- ${{ if eq(variables._RunAsInternal, True) }}:
Expand Down Expand Up @@ -103,9 +110,9 @@ stages:
matrix:
Release:
_BuildConfig: Release
${{ if eq(variables._RunAsPublic, True) }}:
Debug:
_BuildConfig: Debug
# ${{ if eq(variables._RunAsPublic, True) }}:
# Debug:
# _BuildConfig: Debug
steps:
# This steps help to understand versions of .NET runtime installed on the machine,
# which is useful to diagnose some governance issues.
Expand All @@ -115,21 +122,23 @@ stages:
command: custom
custom: '--info'

- script: eng\common\CIBuild.cmd
- powershell: eng\try-ci-build.ps1
-configuration $(_BuildConfig)
-prepareMachine
$(_InternalBuildArgs)
/p:Test=false
name: Build
displayName: Build
continueOnError: true

# TODO: Re-enable test step when tests are ready
# -ci is allowing to import some environment variables and some required configurations
# - script: Test.cmd
# -configuration $(_BuildConfig)
# -ci
# name: Test
# displayName: Test
- script: Test.cmd
-configuration $(_BuildConfig)
-ci
-integrationTest
-performanceTest
name: Test
displayName: Test

# This step is only helpful for diagnosing some issues with vstest/test host that would not appear
# through the console or trx
Expand All @@ -140,25 +149,118 @@ stages:
ArtifactName: TestResults
condition: failed()

# TODO: Publishing to the feeds is making non-arcade CI acceptance tests fail so we disable these steps for now.
# They will need to be re-enabled once this is merged to main.
- ${{ if eq(variables._RunAsInternal, True) }}:
# - task: NuGetAuthenticate@0
# displayName: 'NuGet Authenticate to dotnet-tools and test-tools feeds'

# - task: NuGetCommand@2
# displayName: 'Publish NuGet packages to dotnet-tools feed'
# inputs:
# command: push
# packagesToPush: 'artifacts/packages/$(_BuildConfig)/**/*.nupkg;!artifacts/packages/$(_BuildConfig)/**/*.symbols.nupkg'
# publishVstsFeed: 'public/dotnet-tools'

# - task: NuGetCommand@2
# displayName: 'Publish NuGet packages to test-tools feed'
# inputs:
# command: push
# packagesToPush: 'artifacts/packages/$(_BuildConfig)/**/*.nupkg;!artifacts/packages/$(_BuildConfig)/**/*.symbols.nupkg'
# publishVstsFeed: 'public/test-tools'
- task: PublishBuildArtifacts@1
displayName: 'Publish VSSetup'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/VSSetup/$(_BuildConfig)'
ArtifactName: VSSetupArtifacts

- job: OtherOSes
dependsOn: Windows
workspace:
clean: all
variables:
# Publish Logs seems to depend on this name of variable, so we define it
# even when we don't use matrix.
- name: _BuildConfig
value: Release
strategy:
matrix:
Ubuntu_22_04:
vmImage: ubuntu-22.04
pwsh: true
macOS_11:
vmImage: macOS-11
pwsh: true
pool:
vmImage: $[ variables['vmImage'] ]
steps:
- checkout: self
fetchDepth: 1
clean: true

# Build but don't pack, packing does not work on non-windows and we want to test what we built on Windows
# anyway. Because that is what we will publish.
- script: ./build.sh
--configuration $(_BuildConfig)
--ci
name: Build
displayName: Build
continueOnError: true

# Download the built packages into local package source, as if we built them on this machine.
- task: DownloadPipelineArtifact@2
displayName: Download Package Artifacts
inputs:
artifactName: PackageArtifacts
targetPath: '$(Build.SourcesDirectory)/artifacts/packages/$(_BuildConfig)/Shipping'

- script: ./test.sh
--configuration $(_BuildConfig)
--ci
--integrationTest
--performanceTest
name: Test
displayName: Test

# This step is only helpful for diagnosing some issues with vstest/test host that would not appear
# through the console or trx
- task: PublishBuildArtifacts@1
displayName: 'Publish Test Results folders'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
ArtifactName: TestResults
condition: failed()

- job: Publish
dependsOn: OtherOSes
pool:
${{ if eq(variables._RunAsPublic, True) }}:
name: NetCore-Public
demands: ImageOverride -equals windows.vs2022.amd64.open
${{ if eq(variables._RunAsInternal, True) }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals 1es-windows-2022
strategy:
matrix:
Release:
_BuildConfig: Release
# ${{ if eq(variables._RunAsPublic, True) }}:
# Debug:
# _BuildConfig: Debug
steps:
# Download the built packages into local package source, as if we built them on this machine.
- task: DownloadPipelineArtifact@2
displayName: Download Package Artifacts
inputs:
artifactName: PackageArtifacts
targetPath: '$(Build.SourcesDirectory)/artifacts/packages/$(_BuildConfig)/Shipping'

- task: DownloadPipelineArtifact@2
displayName: Download VSSetup Artifacts
inputs:
artifactName: VSSetupArtifacts
targetPath: '$(Build.SourcesDirectory)/artifacts/VSSetup/$(_BuildConfig)'

# TODO: Publishing to the feeds is making non-arcade CI acceptance tests fail so we disable these steps for now.
# They will need to be re-enabled once this is merged to main.
- ${{ if eq(variables._RunAsInternal, True) }}:
- task: NuGetAuthenticate@0
displayName: 'NuGet Authenticate to dotnet-tools and test-tools feeds'

# - task: NuGetCommand@2
# displayName: 'Publish NuGet packages to dotnet-tools feed'
# inputs:
# command: push
# packagesToPush: 'artifacts/packages/$(_BuildConfig)/**/*.nupkg;!artifacts/packages/$(_BuildConfig)/**/*.symbols.nupkg'
# publishVstsFeed: 'public/dotnet-tools'

# - task: NuGetCommand@2
# displayName: 'Publish NuGet packages to test-tools feed'
# inputs:
# command: push
# packagesToPush: 'artifacts/packages/$(_BuildConfig)/**/*.nupkg;!artifacts/packages/$(_BuildConfig)/**/*.symbols.nupkg'
# publishVstsFeed: 'public/test-tools'

# Publishes setup VSIXes to a drop.
# Note: The insertion tool looks for the display name of this task in the logs.
Expand Down
2 changes: 1 addition & 1 deletion docs/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ To build the repository, run the following command:
This command will fetch the latest `dotnet-cli` into `/src/vstest/tools/dotnet`
directory. It will use the `dotnet` executable present there to build the source
code. All the nuget required for build will be downloaded to
`/src/vstest/packages` directory.
`/src/vstest/.packages` directory.

Build will produce following assets:

Expand Down
11 changes: 10 additions & 1 deletion eng/AfterSolutionBuild.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<Project>

<Target Name="_VerifyNuGetPackages" AfterTargets="Pack" Condition=" '$(OS)' == 'Windows_NT' ">
<Exec Command="powershell -NoProfile -NoLogo -ExecutionPolicy Bypass $(RepositoryEngineeringDir)\verify-nupkgs.ps1 -configuration $(Configuration)" />
<Exec Command="powershell -NoProfile -NoLogo -ExecutionPolicy Bypass $(RepositoryEngineeringDir)\verify-nupkgs.ps1 -configuration $(Configuration) -versionPrefix $(versionPrefix)" />
</Target>

<!--
This is tricky. When you run tests in part of Build, this target won't run after you've run your tests,
if you run as separate step you have no way of saying that you will run tests later. If you'd move this into
Directory.Build.targets you would run it for every single integration tests project. So running it after
pack is probably the best.
-->
<Target Name="_InstallAdditionalDotnetSdk" AfterTargets="Pack" Condition=" '$(OS)' == 'Windows_NT' ">
<Exec Command="powershell -NoProfile -NoLogo -ExecutionPolicy Bypass $(RepositoryEngineeringDir)\install-additional-dotnet-sdks.ps1 -dotnetInstallDir $(DOTNET_INSTALL_DIR) -RepoRoot $(RepoRoot)" />
</Target>
</Project>
9 changes: 0 additions & 9 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@
<FluentAssertionsVersion>6.7.0</FluentAssertionsVersion>
<MoqVersion>4.16.1</MoqVersion>

<!-- this version needs to be the same as in TestPlatform.Settings.targets, we might want to unify this into
a single .props file, but the other version is used by multiple build scripts, so I just query it and validate that
they are both the same during build -->
<!-- this version also needs to be "statically" readable because the test fixture will inspect this file for the version
and because during the test `dotnet test` will run and re-build some of the test projects and at that time the version
from a build parameter would not be available, so I am writing this version from the build.ps1 script to keep it in sync -->
<!-- Note that before bumping this version, you need to have one NuGet package available -->
<NETTestSdkVersion>17.6.0-dev</NETTestSdkVersion>

<!-- For coverage use our own package on latest stable -->
<MicrosoftCodeCoverageVersion>17.4.1</MicrosoftCodeCoverageVersion>

Expand Down
Empty file modified eng/common/dotnet-install.sh
100644 → 100755
Empty file.
29 changes: 29 additions & 0 deletions eng/install-additional-dotnet-sdks.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
param (
[Parameter(Mandatory)]
[string] $DotnetInstallDir,
[Parameter(Mandatory)]
[string] $RepoRoot
)

Write-Host "Installing additional dotnet SDKs for integration tests."

$eng = $PSScriptRoot
. $eng/common/tools.ps1

$globalJson = Get-Content $RepoRoot/global.json | ConvertFrom-Json
$sdkVersions = @("x86")

foreach ($architecture in $sdkVersions) {
$version = $globalJson.sdk.version
$dotnetRoot = "$DotnetInstallDir/dotnet-sdk-$architecture"

InstallDotNetSdk -dotnetRoot $dotnetRoot -version $version -architecture $architecture -noPath

$runtimeVersions = @($globalJson.tools.runtimes."dotnet/$($architecture)")
foreach ($runtimeVersion in $runtimeVersions) {
if ($runtimeVersion -like "8.*") {
$stop= $true
}
InstallDotNet -runtime "dotnet" -dotnetRoot $dotnetRoot -version $runtimeVersion -architecture $architecture -noPath
}
}
70 changes: 70 additions & 0 deletions eng/try-ci-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[CmdletBinding(PositionalBinding=$false)]
Param(
[string][Alias('c')]$configuration = "Debug",
[string]$platform = $null,
[string] $projects,
[string][Alias('v')]$verbosity = "minimal",
[string] $msbuildEngine = $null,
[bool] $warnAsError = $true,
[bool] $nodeReuse = $true,
[switch][Alias('r')]$restore,
[switch] $deployDeps,
[switch][Alias('b')]$build,
[switch] $rebuild,
[switch] $deploy,
[switch][Alias('t')]$test,
[switch] $integrationTest,
[switch] $performanceTest,
[switch] $sign,
[switch] $pack,
[switch] $publish,
[switch] $clean,
[switch][Alias('bl')]$binaryLog,
[switch][Alias('nobl')]$excludeCIBinarylog,
[switch] $ci,
[switch] $prepareMachine,
[string] $runtimeSourceFeed = '',
[string] $runtimeSourceFeedKey = '',
[switch] $excludePrereleaseVS,
[switch] $nativeToolsOnMachine,
[switch] $help,
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
)

$count = 0
$err = $null
$path = "$PSScriptRoot/common/build.ps1"
# CIBuild.cmd script specifies restore -build -test -sign -pack -publish -ci $args
$PSBoundParameters["restore"] = $true
$PSBoundParameters["build"] = $true
$PSBoundParameters["test"] = $true
$PSBoundParameters["sign"] = $true
$PSBoundParameters["pack"] = $true
$PSBoundParameters["publish"] = $true
$PSBoundParameters["ci"] = $true

$cmd = "$path $(foreach($pair in $PSBoundParameters.GetEnumerator()) { "-$($pair.Key)=$($pair.Value)"})"
while (3 -gt $count) {
$err = $null
$count++
try {
& $path @PSBoundParameters
if (0 -ne $LASTEXITCODE) {
Write-Host ">>> Try ${count}: Command '$cmd' failed, with exit code $LASTEXITCODE."
continue
}
}
catch {
$err = $_
Write-Host ">>> Try ${count}: Command '$cmd' failed, with $_."
continue
}

Write-Host ">>> Try ${count}: Command '$cmd' succeeded."
break
}

if ($null -ne $err) {
throw $err
}

Loading

0 comments on commit 681849f

Please sign in to comment.