From 8eb2e11bc83fef5518159d67be8327c12ab4b730 Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Fri, 4 Feb 2022 14:05:12 -0800 Subject: [PATCH 1/2] Use `-noBuild` in second build steps of test jobs - building again in Publish target adds nothing in most cases - use `-noBuildRepoTasks` more consistently - again, building the repo tasks wastefully repeated work done in previous build step - use `-noBuildJava` more consistently in quarantined pipelines - Java tests aren't worth testing _or building_ in these pipelines because they cannot be quarantined - remove `-noRestore` and `-noBuildDeps` when `-noBuild` specified; redundant - work around https://github.com/dotnet/sdk/issues/23777 - do not publish .cshtml files of most test asset projects when `$(NoBuild)` is set - update FunctionalTestWithAssets.targets to help Publish succeed when `$(NoBuild)` is set - fixes build jobs in quarantined-pr pipeline where `--no-build` was already specified - for IIS test assets, perform all builds needed for their profiles within Build target - move `ReferenceTestTasks=false` and comments about it to where property matters - merge separate targets in FunctionalTest.props to make items available during (now separate) Publish nits: - touch up RunHelix.ps1 console output - reorder command line arguments for consistency in changed parts of the YAML files - move `NoBuild=true` setting out of FunctionalTestWithAssets.props - use `BeforeTargets` in FunctionalTest.props to improve determinism --- .azure/pipelines/ci.yml | 3 +-- .azure/pipelines/helix-matrix.yml | 2 +- .azure/pipelines/quarantined-pr.yml | 19 +++++++++++-------- .azure/pipelines/quarantined-tests.yml | 4 ++-- eng/scripts/RunHelix.ps1 | 3 ++- eng/targets/FunctionalTestWithAssets.props | 1 - eng/targets/FunctionalTestWithAssets.targets | 17 +++++++++++++++-- src/Mvc/samples/MvcSandbox/MvcSandbox.csproj | 9 ++++++++- ...soft.AspNetCore.Mvc.FunctionalTests.csproj | 3 ++- src/Mvc/test/WebSites/Directory.Build.props | 4 ++-- src/Mvc/test/WebSites/Directory.Build.targets | 14 ++++++++++++++ .../IIS/test/Common.LongTests/StartupTests.cs | 1 - src/Servers/IIS/IIS/test/FunctionalTest.props | 19 +++++++++---------- .../test/testassets/Directory.Build.targets | 2 +- .../InProcessNewShimWebSite.csproj | 15 ++++++++++++++- .../InProcessWebSite/InProcessWebSite.csproj | 15 +++++++++++++-- 16 files changed, 95 insertions(+), 36 deletions(-) create mode 100644 src/Mvc/test/WebSites/Directory.Build.targets diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index 5df483b991d8..2861bceeccd7 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -228,7 +228,6 @@ stages: -noBuildRepoTasks -noBuildNative -noBuild - -noRestore -sign /p:DotNetSignType=$(_SignType) $(_BuildArgs) @@ -685,7 +684,7 @@ stages: - script: ./eng/build.cmd -ci -nobl -all -pack -arch x64 /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs) displayName: Build shared fx - - script: ./eng/build.cmd -ci -nobl -noBuildRepoTasks -noRestore -test -all -noBuildNative + - script: ./eng/build.cmd -ci -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -test -projects eng\helix\helix.proj /p:IsHelixPRCheck=true /p:IsHelixJob=true /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs) displayName: Run build.cmd helix target diff --git a/.azure/pipelines/helix-matrix.yml b/.azure/pipelines/helix-matrix.yml index a11aa5e04012..4bf42e605556 100644 --- a/.azure/pipelines/helix-matrix.yml +++ b/.azure/pipelines/helix-matrix.yml @@ -33,7 +33,7 @@ jobs: - script: ./eng/build.cmd -ci -nobl -all -pack -arch x64 /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log displayName: Build shared fx - - script: .\eng\build.cmd -ci -nobl -noBuildRepoTasks -noRestore -test -all -noBuildNative + - script: .\eng\build.cmd -ci -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -test -projects eng\helix\helix.proj /p:IsHelixJob=true /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log displayName: Run build.cmd helix target diff --git a/.azure/pipelines/quarantined-pr.yml b/.azure/pipelines/quarantined-pr.yml index 4b32ae944062..569e511da97f 100644 --- a/.azure/pipelines/quarantined-pr.yml +++ b/.azure/pipelines/quarantined-pr.yml @@ -54,10 +54,10 @@ jobs: timeoutInMinutes: 120 steps: # Build the shared framework - - script: ./eng/build.cmd -ci -nobl -all -pack -arch x64 + - script: ./eng/build.cmd -ci -nobl -all -noBuildJava -pack -arch x64 /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log displayName: Build shared fx - - script: ./eng/build.cmd -ci -nobl -noBuildRepoTasks -noRestore -test -all -noBuildJava -noBuildNative + - script: ./eng/build.cmd -ci -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -noBuildJava -test -projects eng\helix\helix.proj /p:IsHelixPRCheck=true /p:RunQuarantinedTests=true /p:IsHelixJob=true /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log displayName: Run build.cmd helix target @@ -79,9 +79,10 @@ jobs: isAzDOTestingJob: true enablePublishTestResults: false steps: - - powershell: "& ./eng/build.ps1 -CI -nobl -all -pack -NoBuildJava" + - script: ./eng/build.cmd -ci -nobl -all -noBuildJava -pack displayName: Build - - script: ./eng/build.cmd -ci -nobl -test -NoRestore -NoBuild -NoBuilddeps "/p:RunQuarantinedTests=true /p:SkipHelixReadyTests=true" + - script: ./eng/build.cmd -ci -nobl -all -noBuildRepoTasks -noBuildNative -NoBuild -noBuildJava -test + /p:RunQuarantinedTests=true /p:SkipHelixReadyTests=true displayName: Run Quarantined Tests continueOnError: true - task: PublishTestResults@2 @@ -112,9 +113,10 @@ jobs: isAzDOTestingJob: true enablePublishTestResults: false steps: - - bash: ./eng/build.sh --all --pack --ci --nobl --no-build-java + - bash: ./eng/build.sh --ci --nobl --all --no-build-java --pack displayName: Build - - bash: ./eng/build.sh --no-build --ci --nobl --test -p:RunQuarantinedTests=true -p:SkipHelixReadyTests=true + - bash: ./eng/build.sh --ci --nobl --all --no-build-repo-tasks --no-build --no-build-java --test + -p:RunQuarantinedTests=true -p:SkipHelixReadyTests=true displayName: Run Quarantined Tests continueOnError: true - task: PublishTestResults@2 @@ -146,9 +148,10 @@ jobs: enablePublishTestResults: false useHostedUbuntu: false steps: - - bash: ./eng/build.sh --all --pack --ci --nobl --no-build-java + - bash: ./eng/build.sh --ci --nobl --all --no-build-java --pack displayName: Build - - bash: ./eng/build.sh --no-build --ci --nobl --test -p:RunQuarantinedTests=true -p:SkipHelixReadyTests=true + - bash: ./eng/build.sh --ci --nobl --all --no-build-repo-tasks --no-build --no-build-java --test + -p:RunQuarantinedTests=true -p:SkipHelixReadyTests=true displayName: Run Quarantined Tests continueOnError: true - task: PublishTestResults@2 diff --git a/.azure/pipelines/quarantined-tests.yml b/.azure/pipelines/quarantined-tests.yml index c97f007ea5da..f1a0ae81ddb7 100644 --- a/.azure/pipelines/quarantined-tests.yml +++ b/.azure/pipelines/quarantined-tests.yml @@ -25,10 +25,10 @@ jobs: timeoutInMinutes: 480 steps: # Build the shared framework - - script: ./eng/build.cmd -ci -nobl -all -pack -arch x64 + - script: ./eng/build.cmd -ci -nobl -all -noBuildJava -pack -arch x64 /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log displayName: Build shared fx - - script: ./eng/build.cmd -ci -nobl -noBuildRepoTasks -noRestore -test -all -noBuildJava -noBuildNative + - script: ./eng/build.cmd -ci -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -noBuildJava -test -projects eng\helix\helix.proj /p:RunQuarantinedTests=true /p:IsHelixJob=true /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log displayName: Run build.cmd helix target diff --git a/eng/scripts/RunHelix.ps1 b/eng/scripts/RunHelix.ps1 index eee981c7e37f..d0099e017382 100644 --- a/eng/scripts/RunHelix.ps1 +++ b/eng/scripts/RunHelix.ps1 @@ -52,7 +52,8 @@ $env:BUILD_REPOSITORY_NAME="aspnetcore" $env:SYSTEM_TEAMPROJECT="aspnetcore" Write-Host -ForegroundColor Yellow "If running tests that need the shared Fx, run './build -pack -all' before this." -Write-Host -ForegroundColor Yellow "And if packing for a different platform, add '/p:CrossgenOutput=false'." +Write-Host -ForegroundColor Yellow "If everything is up-to-date, add '/p:NoBuild=true' to this command." +Write-Host -ForegroundColor Yellow "Or, if only the test project is out-of-date, add '/p:BuildProjectReferences=false'." $HelixQueues = $HelixQueues -replace ";", "%3B" dotnet msbuild $Project /t:Helix /p:TargetArchitecture="$TargetArchitecture" ` diff --git a/eng/targets/FunctionalTestWithAssets.props b/eng/targets/FunctionalTestWithAssets.props index 126b2ca6288b..2a8d04a3583c 100644 --- a/eng/targets/FunctionalTestWithAssets.props +++ b/eng/targets/FunctionalTestWithAssets.props @@ -14,7 +14,6 @@ %(Filename) false - NoBuild=true diff --git a/eng/targets/FunctionalTestWithAssets.targets b/eng/targets/FunctionalTestWithAssets.targets index 2dca09ec9e2c..29ecd437e30e 100644 --- a/eng/targets/FunctionalTestWithAssets.targets +++ b/eng/targets/FunctionalTestWithAssets.targets @@ -7,12 +7,25 @@ - <_ProjectsToPublish Include="@(TestAssetProjectReference)" /> + + <_ProjectsToPublish AdditionalProperties="%(_ProjectsToPublish.AdditionalProperties); - OutputPath=$(OutputPath)%(RelativeFolder); PublishDir=$(PublishDir)%(RelativeFolder)" /> + + + <_ProjectsToPublish Condition=" '%(SkipBuild)' == 'true' " + AdditionalProperties="%(_ProjectsToPublish.AdditionalProperties);NoBuild=true" /> + + + <_ProjectsToPublish Condition=" '%(SkipBuild)' != 'true' " + AdditionalProperties="%(_ProjectsToPublish.AdditionalProperties); + NoBuild=false; + OutputPath=$(OutputPath)%(RelativeFolder)" /> + + + + None + + + diff --git a/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj b/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj index 9729f62231ee..ef1661548dab 100644 --- a/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj +++ b/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj @@ -19,7 +19,8 @@ + ..\WebSites\RazorBuildWebSite.*\RazorBuildWebSite.*.csproj; + ..\WebSites\RazorPagesClassLibrary\RazorPagesClassLibrary.csproj" /> diff --git a/src/Mvc/test/WebSites/Directory.Build.props b/src/Mvc/test/WebSites/Directory.Build.props index 7a0c61b8c7c3..110e00b967ed 100644 --- a/src/Mvc/test/WebSites/Directory.Build.props +++ b/src/Mvc/test/WebSites/Directory.Build.props @@ -7,6 +7,6 @@ --> false - - + + diff --git a/src/Mvc/test/WebSites/Directory.Build.targets b/src/Mvc/test/WebSites/Directory.Build.targets new file mode 100644 index 000000000000..c1fd69c7f57c --- /dev/null +++ b/src/Mvc/test/WebSites/Directory.Build.targets @@ -0,0 +1,14 @@ + + + + + + + + None + + + + diff --git a/src/Servers/IIS/IIS/test/Common.LongTests/StartupTests.cs b/src/Servers/IIS/IIS/test/Common.LongTests/StartupTests.cs index b0597655a085..0ceb00304400 100644 --- a/src/Servers/IIS/IIS/test/Common.LongTests/StartupTests.cs +++ b/src/Servers/IIS/IIS/test/Common.LongTests/StartupTests.cs @@ -217,7 +217,6 @@ public async Task StartsWithPortableAndBootstraperExe() // We need the right dotnet on the path in IIS deploymentParameters.EnvironmentVariables["PATH"] = Path.GetDirectoryName(DotNetCommands.GetDotNetExecutable(deploymentParameters.RuntimeArchitecture)); - // ReferenceTestTasks is workaround for https://github.com/dotnet/sdk/issues/2482 var deploymentResult = await DeployAsync(deploymentParameters); Assert.True(File.Exists(Path.Combine(deploymentResult.ContentRoot, "InProcessWebSite.exe"))); diff --git a/src/Servers/IIS/IIS/test/FunctionalTest.props b/src/Servers/IIS/IIS/test/FunctionalTest.props index 3c059a6ef63e..7396b3e8b639 100644 --- a/src/Servers/IIS/IIS/test/FunctionalTest.props +++ b/src/Servers/IIS/IIS/test/FunctionalTest.props @@ -1,25 +1,24 @@ - - - + + - - - - + <_FilesToCopy Include="%(PublishedTestAsset.Path)\**\*"> $(PublishDir)\%(PublishedTestAsset.Identity)\ - - + - diff --git a/src/Servers/IIS/IIS/test/testassets/Directory.Build.targets b/src/Servers/IIS/IIS/test/testassets/Directory.Build.targets index d1c86dc48f4b..045983437fdf 100644 --- a/src/Servers/IIS/IIS/test/testassets/Directory.Build.targets +++ b/src/Servers/IIS/IIS/test/testassets/Directory.Build.targets @@ -41,7 +41,7 @@ + Properties="PublishDir=$(PublishDir);TestAssetProfile=%(TestAssetPublishProfile.Identity);%(TestAssetPublishProfile.Properties)"> diff --git a/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj b/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj index 267860b5d1da..fc765d46f863 100644 --- a/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj +++ b/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj @@ -11,7 +11,11 @@ - + + + @@ -59,4 +63,13 @@ + + + + + diff --git a/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/InProcessWebSite.csproj b/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/InProcessWebSite.csproj index cb6d6071a056..2f207433c596 100644 --- a/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/InProcessWebSite.csproj +++ b/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/InProcessWebSite.csproj @@ -1,5 +1,4 @@ - @@ -9,7 +8,11 @@ - + + + @@ -32,4 +35,12 @@ + + + + From 898347f0ea2ac3b978581bc328d81b338c093af0 Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Mon, 7 Feb 2022 16:25:58 -0800 Subject: [PATCH 2/2] Add comments per review feedback --- .azure/pipelines/ci.yml | 1 + .azure/pipelines/helix-matrix.yml | 1 + .azure/pipelines/quarantined-pr.yml | 1 + .azure/pipelines/quarantined-tests.yml | 1 + 4 files changed, 4 insertions(+) diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index 2861bceeccd7..55b35f32cee7 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -684,6 +684,7 @@ stages: - script: ./eng/build.cmd -ci -nobl -all -pack -arch x64 /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs) displayName: Build shared fx + # -noBuildRepoTasks -noBuildNative -noBuild to avoid repeating work done in the previous step. - script: ./eng/build.cmd -ci -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -test -projects eng\helix\helix.proj /p:IsHelixPRCheck=true /p:IsHelixJob=true /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs) diff --git a/.azure/pipelines/helix-matrix.yml b/.azure/pipelines/helix-matrix.yml index 4bf42e605556..0684583d13b5 100644 --- a/.azure/pipelines/helix-matrix.yml +++ b/.azure/pipelines/helix-matrix.yml @@ -33,6 +33,7 @@ jobs: - script: ./eng/build.cmd -ci -nobl -all -pack -arch x64 /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log displayName: Build shared fx + # -noBuildRepoTasks -noBuildNative -noBuild to avoid repeating work done in the previous step. - script: .\eng\build.cmd -ci -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -test -projects eng\helix\helix.proj /p:IsHelixJob=true /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log diff --git a/.azure/pipelines/quarantined-pr.yml b/.azure/pipelines/quarantined-pr.yml index 569e511da97f..203e9f3fdba5 100644 --- a/.azure/pipelines/quarantined-pr.yml +++ b/.azure/pipelines/quarantined-pr.yml @@ -57,6 +57,7 @@ jobs: - script: ./eng/build.cmd -ci -nobl -all -noBuildJava -pack -arch x64 /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log displayName: Build shared fx + # -noBuildRepoTasks -noBuildNative -noBuild to avoid repeating work done in the previous step. - script: ./eng/build.cmd -ci -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -noBuildJava -test -projects eng\helix\helix.proj /p:IsHelixPRCheck=true /p:RunQuarantinedTests=true /p:IsHelixJob=true /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log diff --git a/.azure/pipelines/quarantined-tests.yml b/.azure/pipelines/quarantined-tests.yml index f1a0ae81ddb7..ae481b7cbb41 100644 --- a/.azure/pipelines/quarantined-tests.yml +++ b/.azure/pipelines/quarantined-tests.yml @@ -28,6 +28,7 @@ jobs: - script: ./eng/build.cmd -ci -nobl -all -noBuildJava -pack -arch x64 /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log displayName: Build shared fx + # -noBuildRepoTasks -noBuildNative -noBuild to avoid repeating work done in the previous step. - script: ./eng/build.cmd -ci -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -noBuildJava -test -projects eng\helix\helix.proj /p:RunQuarantinedTests=true /p:IsHelixJob=true /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log