Skip to content
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

Run libraries package testing on build agent #53905

Merged
merged 8 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion eng/pipelines/libraries/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ jobs:
- ${{ if eq(parameters.framework, 'allConfigurations') }}:
- _finalFrameworkArg: -allConfigurations
- _testModeArg: /p:TestAssemblies=false /p:TestPackages=true
- _extraHelixArguments: /p:TestPackages=true

- ${{ if eq(parameters.isOfficialAllConfigurations, true) }}:
- librariesBuildArtifactName: 'libraries_bin_official_allconfigurations'
Expand Down
2 changes: 0 additions & 2 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -758,11 +758,9 @@ jobs:
buildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
platforms:
- windows_x64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isFullMatrix: ${{ variables.isFullMatrix }}
framework: allConfigurations
runTests: true
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
Expand Down
4 changes: 0 additions & 4 deletions src/libraries/pkg/test/Directory.Build.targets

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)Versions.props" />
<Import Project="Versions.props" />
<Import Project="netfxreference.props" />
</Project>
4 changes: 4 additions & 0 deletions src/libraries/pkg/test/build/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<Project>
<Import Project="targetingpacks.targets" />
<Import Project="packageTest.targets" />
</Project>
15 changes: 15 additions & 0 deletions src/libraries/pkg/test/build/dirs.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project>
<PropertyGroup>
<ImportDirectoryBuildProps>false</ImportDirectoryBuildProps>
<ImportDirectoryBuildTargets>false</ImportDirectoryBuildTargets>
<RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.Build.Traversal" />

<ItemGroup>
<ProjectReference Include="projects\**\*.csproj" />
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.Build.Traversal" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
</PropertyGroup>

<PropertyGroup>
<RestoreSources>
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json;
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json;
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6-transport/nuget/v3/index.json;
$(LocalPackagesPath)
</RestoreSources>

<!-- Make sure the SDK raises the runtime items so that they are passed to conflict resolution -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<!-- Suppress any SYSLIB9000 errors, as in these cases restore/build would succeed, the failure would be at run-time -->
Expand All @@ -38,7 +30,8 @@
</ItemGroup>


<Target Name="LogBeginTest">
<Target Name="LogBeginTest"
Condition="'$(TargetFramework)' != ''">
<Message Importance="High" Text="Testing $(TestPackageID) TFM=$(TargetFramework)" />
</Target>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<Project>
<Import Project="$(SupportFilesDir)netfxreference.props" />

<PropertyGroup>
<ShouldVerifyClosure>true</ShouldVerifyClosure>
<ShouldVerifyTypes>true</ShouldVerifyTypes>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<Project>
<Import Project="$(SupportFilesDir)netfxreference.props" />

<PropertyGroup>
<ShouldVerifyClosure>true</ShouldVerifyClosure>
<ShouldVerifyTypes>true</ShouldVerifyTypes>
Expand Down
11 changes: 3 additions & 8 deletions src/libraries/pkg/test/project.csproj.template
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<Project>
<PropertyGroup>
<DirectoryBuildPropsPath>$(SupportFilesDir)Directory.Build.props</DirectoryBuildPropsPath>
<DirectoryBuildTargetsPath>$(SupportFilesDir)Directory.Build.targets</DirectoryBuildTargetsPath>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>{TargetFrameworks}</TargetFrameworks>
<TestPackageId>{PackageId}</TestPackageId>
<RestoreAdditionalProjectSources>{RestoreAdditionalProjectSources}</RestoreAdditionalProjectSources>

<!-- Used in targetingpacks.targets -->
<NetCoreAppCurrentVersion>{NetCoreAppCurrentVersion}</NetCoreAppCurrentVersion>
<NetCoreAppCurrent>{NetCoreAppCurrent}</NetCoreAppCurrent>
<MicrosoftNetCoreAppFrameworkName>{MicrosoftNetCoreAppFrameworkName}</MicrosoftNetCoreAppFrameworkName>
<MicrosoftNetCoreAppRefPackDir>{MicrosoftNetCoreAppRefPackDir}</MicrosoftNetCoreAppRefPackDir>

<!-- Turn off end of life target framework checks as we intentionally build older .NETCoreApp configurations. -->
<CheckEolTargetFramework>false</CheckEolTargetFramework>
Expand All @@ -24,5 +20,4 @@
<PackageReference Include="{PackageId}" Version="{PackageVersion}" />
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
32 changes: 0 additions & 32 deletions src/libraries/pkg/test/test.msbuild

This file was deleted.

141 changes: 35 additions & 106 deletions src/libraries/pkg/test/testPackages.proj
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<Project DefaultTargets="Build">
<Import Project="..\Directory.Build.props" />
<Project Sdk="Microsoft.Build.NoTargets">

<UsingTask TaskName="GetCompatiblePackageTargetFrameworks" AssemblyFile="$(DotNetPackageTestingAssembly)"/>

<PropertyGroup>
<PackageNamePattern>[a-zA-z\.]*\.</PackageNamePattern>

<TestDir>$(ArtifactsBinDir)testPackages\</TestDir>
<TestProjectDir>$(TestDir)projects\</TestProjectDir>
<TestPackageDir>$(TestDir)cache\</TestPackageDir>
<TestProjectName>dirs.proj</TestProjectName>
<ProjectTemplate>project.csproj.template</ProjectTemplate>
</PropertyGroup>

<ItemGroup>
Expand All @@ -28,44 +35,28 @@
<TargetFrameworksToExclude Include="netcoreapp2.2" />
</ItemGroup>

<PropertyGroup>
<TestDir>$(ArtifactsBinDir)testPkg\</TestDir>
<TestSupportDir>$(TestDir)support\</TestSupportDir>
<TestProjectName>test.msbuild</TestProjectName>
<TestProject>$(TestSupportDir)$(TestProjectName)</TestProject>
<TestProjectDir>$(TestDir)projects\</TestProjectDir>
<TestPackageDir>$(ArtifactsBinDir)testPackages</TestPackageDir>
<TestDotNetPath>$(DotNetRoot)dotnet</TestDotNetPath>

<ProjectTemplate>project.csproj.template</ProjectTemplate>
</PropertyGroup>

<ItemGroup>
<!-- The main entry point file: test.msbuild -->
<TestSupportFile Include="$(TestProjectName)"
DestinationFolder="$(TestSupportDir)" />
<!-- The main entry point file. -->
<TestSupportFile Include="build\$(TestProjectName)"
DestinationFolder="$(TestDir)" />
<!-- msbuild support files and the packaging VerifyClosure assembly. -->
<TestSupportFile Include="$(RepositoryEngineeringDir)Versions.props;
<TestSupportFile Include="$(RepoRoot)global.json;
$(RepoRoot)NuGet.config;
$(RepositoryEngineeringDir)Versions.props;
$(RepositoryEngineeringDir)targetingpacks.targets;
$(LibrariesProjectRoot)shims\netfxreference.props;
packageTest.targets;
Directory.Build.props;
Directory.Build.targets"
DestinationFolder="$(TestSupportDir)" />
build\packageTest.targets;
build\Directory.Build.props;
build\Directory.Build.targets"
DestinationFolder="$(TestDir)" />
<TestSupportFile Include="$(PackagingTaskDir)..\..\**\*.*"
Exclude="$(PackagingTaskDir)..\..\*.*"
DestinationFolder="$(TestSupportDir)%(RecursiveDir)" />
DestinationFolder="$(TestDir)%(RecursiveDir)" />
<!-- frameworksettings and packagesettings -->
<TestSupportFile Include="frameworkSettings\**\*"
DestinationFolder="$(TestSupportDir)frameworkSettings\%(RecursiveDir)" />
DestinationFolder="$(TestDir)frameworkSettings\%(RecursiveDir)" />
<TestSupportFile Include="packageSettings\**\*"
DestinationFolder="$(TestSupportDir)packageSettings\%(RecursiveDir)" />
</ItemGroup>

<ItemGroup>
<CliEnvironment Include="DOTNET_CLI_TELEMETRY_OPTOUT=1" />
<CliEnvironment Include="DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1" />
<CliEnvironment Include="DOTNET_MULTILEVEL_LOOKUP=0" />
DestinationFolder="$(TestDir)packageSettings\%(RecursiveDir)" />
</ItemGroup>

<Target Name="CreateTestDir"
Expand All @@ -75,8 +66,6 @@
<Copy SourceFiles="@(TestSupportFile)" DestinationFolder="%(TestSupportFile.DestinationFolder)" />
</Target>

<UsingTask TaskName="GetCompatiblePackageTargetFrameworks" AssemblyFile="$(DotNetPackageTestingAssembly)"/>

<Target Name="GetSupportedPackages">
<GetCompatiblePackageTargetFrameworks PackagePaths="@(TestPackagesPath)">
<Output TaskParameter="TestProjects" ItemName="SupportedPackage" />
Expand Down Expand Up @@ -112,94 +101,34 @@
Inputs="@(TestPackagesPath);$(ProjectTemplate)"
Outputs="%(SupportedPackage.ProjectFile)">
<PropertyGroup>
<_projectDir>%(SupportedPackage.ProjectDir)/</_projectDir>
<_projectDir>%(SupportedPackage.ProjectDir)</_projectDir>
<_projectFile>%(SupportedPackage.ProjectFile)</_projectFile>
<_packageId>%(SupportedPackage.Identity)</_packageId>
<_packageVersion>%(SupportedPackage.Version)</_packageVersion>
<_projectTFMs>@(SupportedPackage->'%(TargetFrameworkShort)')</_projectTFMs>
</PropertyGroup>

<!-- Generate project.csproj from template. -->
<MakeDir Directories="$(_projectDir)" />
<!-- Update project.csproj template -->
<WriteLinesToFile
File="$(_projectFile)"
Lines="$([System.IO.File]::ReadAllText('$(ProjectTemplate)').Replace('{PackageId}', $(_packageId)).Replace('{PackageVersion}', $(_packageVersion)).Replace('{TargetFrameworks}', $(_projectTFMs)).Replace('{NetCoreAppCurrent}', $(NetCoreAppCurrent)).Replace('{NetCoreAppCurrentVersion}', $(NetCoreAppCurrentVersion)).Replace('{MicrosoftNetCoreAppFrameworkName}', $(MicrosoftNetCoreAppFrameworkName)))"
Lines="$([System.IO.File]::ReadAllText('$(ProjectTemplate)').Replace('{PackageId}', $(_packageId)).Replace('{PackageVersion}', $(_packageVersion)).Replace('{TargetFrameworks}', $(_projectTFMs)).Replace('{NetCoreAppCurrent}', $(NetCoreAppCurrent)).Replace('{NetCoreAppCurrentVersion}', $(NetCoreAppCurrentVersion)).Replace('{MicrosoftNetCoreAppFrameworkName}', $(MicrosoftNetCoreAppFrameworkName)).Replace('{MicrosoftNetCoreAppRefPackDir}', $(MicrosoftNetCoreAppRefPackDir)).Replace('{RestoreAdditionalProjectSources}', $(ArtifactsPackagesDir)))"
Overwrite="true" />
<Message Text="Generated $(_projectFile)" />
</Target>

<Target Name="CopyProducedPackages">
<!-- Copy over package local cache to our helix runtime path -->
<Target Name="GenerateAndInvokeProjects"
DependsOnTargets="GenerateProjects"
AfterTargets="Build;Test">
<ItemGroup>
<_localPackages Include="$(ArtifactsShippingPackagesDir)*.nupkg"/>
<_localPackages Include="$(ArtifactsNonShippingPackagesDir)*.nupkg"/>
<TestProject Include="$(TestDir)$(TestProjectName)" />
ViktorHofer marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>

<MSBuild Projects="@(TestProject)"
Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid());RestorePackagesPath=$(TestPackageDir)"
Targets="Restore" />

<Copy SourceFiles="@(_localPackages)"
UseHardlinksIfPossible="true"
DestinationFolder="$(TestSupportDir)packages" />
</Target>

<Target Name="ArchiveHelixItems"
DependsOnTargets="GenerateProjects;CopyProducedPackages"
Condition="'$(ArchiveTests)' == 'true'">

<MakeDir Directories="$(TestArchiveTestsRoot)" />
<ZipDirectory
SourceDirectory="$(TestProjectDir)%(SupportedPackage.Identity)"
DestinationFile="$(TestArchiveTestsRoot)%(SupportedPackage.Identity).zip"
Overwrite="true" />

<MakeDir Directories="$(TestArchiveRuntimeRoot)" />
<ZipDirectory
SourceDirectory="$(TestSupportDir)"
DestinationFile="$(TestArchiveRuntimeRoot)packages-testPayload-$(Configuration).zip"
Overwrite="true" />

</Target>

<Target Name="RestoreProjects"
DependsOnTargets="GenerateProjects"
Condition="'$(ArchiveTests)' != 'true'">

<PropertyGroup>
<TestRestoreCommand>"$(TestDotNetPath)"</TestRestoreCommand>
<TestRestoreCommand>$(TestRestoreCommand) restore</TestRestoreCommand>
<TestRestoreCommand>$(TestRestoreCommand) --packages "$(TestPackageDir)"</TestRestoreCommand>
<TestRestoreCommand>$(TestRestoreCommand) /p:LocalPackagesPath=$(ArtifactsPackagesDir)</TestRestoreCommand>
<TestRestoreCommand>$(TestRestoreCommand) /p:MicrosoftNetCoreAppRefPackDir=$(MicrosoftNetCoreAppRefPackDir)</TestRestoreCommand>
<TestRestoreCommand>$(TestRestoreCommand) /nr:false</TestRestoreCommand>
<TestRestoreCommand>$(TestRestoreCommand) /warnaserror</TestRestoreCommand>
<TestRestoreCommand Condition="'$(PackagesToTest)' != ''">$(TestRestoreCommand) /p:PackagesToTest=$(PackagesToTest)</TestRestoreCommand>
</PropertyGroup>

<Message Importance="High" Text="*** Restoring ***" />
<Exec Command="$(TestRestoreCommand) &quot;$(TestProject)&quot;" EnvironmentVariables="@(CliEnvironment)" StandardOutputImportance="High" />
</Target>

<Target Name="BuildProjects"
DependsOnTargets="RestoreProjects"
Condition="'$(ArchiveTests)' != 'true'">

<PropertyGroup>
<TestBuildCommand>"$(TestDotNetPath)"</TestBuildCommand>
<TestBuildCommand>$(TestBuildCommand) msbuild</TestBuildCommand>
<TestBuildCommand>$(TestBuildCommand) /t:Test</TestBuildCommand>
<TestBuildCommand>$(TestBuildCommand) /nr:false</TestBuildCommand>
<TestBuildCommand>$(TestBuildCommand) /warnaserror</TestBuildCommand>
<TestBuildCommand>$(TestBuildCommand) /p:MicrosoftNetCoreAppRefPackDir=$(MicrosoftNetCoreAppRefPackDir)</TestBuildCommand>
<TestBuildCommand Condition="'$(PackagesToTest)' != ''">$(TestBuildCommand) /p:PackagesToTest=$(PackagesToTest)</TestBuildCommand>
</PropertyGroup>

<Message Importance="High" Text="*** Testing *** %(SupportedPackage.Identity)" />
<Message Importance="High" Text="$(TestBuildCommand) &quot;$(TestProject)&quot;" />
<Exec Command="$(TestBuildCommand) &quot;$(TestProject)&quot;" EnvironmentVariables="@(CliEnvironment)" StandardOutputImportance="High" />
<MSBuild Projects="@(TestProject)"
Targets="Test" />
</Target>

<Target Name="Build" DependsOnTargets="BuildProjects;ArchiveHelixItems" />

<!-- define test to do nothing, for this project Build does all the testing -->
<Target Name="Test" />

<Import Project="..\Directory.Build.targets" />
</Project>
9 changes: 3 additions & 6 deletions src/libraries/sendtohelix.proj
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@

<PropertyGroup>
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
<BuildTargetFramework Condition="'$(TestPackages)' != 'true'">$([MSBuild]::ValueOrDefault('$(BuildTargetFramework)', '$(NetCoreAppCurrent)'))</BuildTargetFramework>
<BuildTargetFramework>$([MSBuild]::ValueOrDefault('$(BuildTargetFramework)', '$(NetCoreAppCurrent)'))</BuildTargetFramework>
<TargetsWindows Condition="'$(TargetOS)' == 'windows'">true</TargetsWindows>

<!-- The Helix correlation payload file -->
<TestArchiveRuntimeFile Condition="'$(TestPackages)' != 'true' and
'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)'">$(TestArchiveRuntimeRoot)test-runtime-$(NetCoreAppCurrentBuildSettings).zip</TestArchiveRuntimeFile>
<TestArchiveRuntimeFile Condition="'$(TestPackages)' == 'true'">$(TestArchiveRuntimeRoot)packages-testPayload-$(Configuration).zip</TestArchiveRuntimeFile>
<TestArchiveRuntimeFile Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)'">$(TestArchiveRuntimeRoot)test-runtime-$(NetCoreAppCurrentBuildSettings).zip</TestArchiveRuntimeFile>

<!-- Set the name of the scenario file. Note that this is only used in invocations where $(Scenario) is set
(which is when this project is invoked to call the "CreateOneScenarioTestEnvFile" target). -->
Expand Down Expand Up @@ -157,8 +155,7 @@
DependsOnTargets="IncludeDumpDocsInTesthost;_CollectRuntimeInputs"
Inputs="@(_RuntimeInput);@(TestArchiveRuntimeDependency)"
Outputs="$(TestArchiveRuntimeFile)"
Condition="'$(TestPackages)' != 'true' and
'$(TargetsMobile)' != 'true' and
Condition="'$(TargetsMobile)' != 'true' and
'$(TestArchiveRuntimeFile)' != ''">

<!-- Compress the test files, testhost, and per-scenario scripts into a single ZIP file for sending to the Helix machines. -->
Expand Down
Loading