From 42ff45ec9521cbe854fe9f6ad33981bb75846d9d Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 1 Apr 2019 14:00:53 -0700 Subject: [PATCH 1/4] Move xunit verify to template --- .vsts-ci/linux.yml | 31 ++++----------------------- .vsts-ci/mac.yml | 31 ++++----------------------- .vsts-ci/templates/verify-xunit.yml | 33 +++++++++++++++++++++++++++++ .vsts-ci/windows.yml | 33 +++++------------------------ 4 files changed, 46 insertions(+), 82 deletions(-) create mode 100644 .vsts-ci/templates/verify-xunit.yml diff --git a/.vsts-ci/linux.yml b/.vsts-ci/linux.yml index a4fef528f28..615b1e25e2f 100644 --- a/.vsts-ci/linux.yml +++ b/.vsts-ci/linux.yml @@ -77,30 +77,7 @@ jobs: parentJobs: - linux_build -- job: verify_xunit - displayName: Verify xUnit Results - pool: - name: Hosted Ubuntu 1604 - dependsOn: - - linux_build - steps: - - task: DownloadBuildArtifacts@0 - displayName: 'Download build artifacts' - inputs: - downloadType: specific - itemPattern: | - xunit/**/* - downloadPath: '$(System.ArtifactsDirectory)' - - - pwsh: | - Get-ChildItem "$(System.ArtifactsDirectory)\*" -Recurse - displayName: 'Capture artifacts directory' - continueOnError: true - - - pwsh: | - Import-Module .\tools\ci.psm1 - $xUnitTestResultsFile = "$(System.ArtifactsDirectory)\xunit\xUnitTestResults.xml" - - Test-XUnitTestResults -TestResultsFile $xUnitTestResultsFile - displayName: Test - condition: succeeded() +- template: templates/verify-xunit.yml + parameters: + pool: Hosted Ubuntu 1604 + dependsOn: linux_build diff --git a/.vsts-ci/mac.yml b/.vsts-ci/mac.yml index 1ae0ef4d143..59e0c1f4451 100644 --- a/.vsts-ci/mac.yml +++ b/.vsts-ci/mac.yml @@ -71,30 +71,7 @@ jobs: parentJobs: - mac_build -- job: verify_xunit - displayName: Verify xUnit Results - pool: - name: 'Hosted macOS' - dependsOn: - - mac_build - steps: - - task: DownloadBuildArtifacts@0 - displayName: 'Download build artifacts' - inputs: - downloadType: specific - itemPattern: | - xunit/**/* - downloadPath: '$(System.ArtifactsDirectory)' - - - pwsh: | - Get-ChildItem "$(System.ArtifactsDirectory)\*" -Recurse - displayName: 'Capture artifacts directory' - continueOnError: true - - - pwsh: | - Import-Module .\tools\ci.psm1 - $xUnitTestResultsFile = "$(System.ArtifactsDirectory)\xunit\xUnitTestResults.xml" - - Test-XUnitTestResults -TestResultsFile $xUnitTestResultsFile - displayName: Test - condition: succeeded() +- template: templates/verify-xunit.yml + parameters: + pool: 'Hosted macOS' + dependsOn: mac_build diff --git a/.vsts-ci/templates/verify-xunit.yml b/.vsts-ci/templates/verify-xunit.yml new file mode 100644 index 00000000000..b6bf2748ab7 --- /dev/null +++ b/.vsts-ci/templates/verify-xunit.yml @@ -0,0 +1,33 @@ +parameters: + dependsOn: 'win_build' + pool: 'Hosted VS2017' + jobName: 'xunit_verify' + +jobs: +- job: verify_xunit + displayName: Verify xUnit Results + pool: + name: ${{ parameters.pool }} + dependsOn: + - ${{ parameters.dependsOn }} + steps: + - task: DownloadBuildArtifacts@0 + displayName: 'Download build artifacts' + inputs: + downloadType: specific + itemPattern: | + xunit/**/* + downloadPath: '$(System.ArtifactsDirectory)' + + - powershell: | + dir "$(System.ArtifactsDirectory)\*" -Recurse + displayName: 'Capture artifacts directory' + continueOnError: true + + - powershell: | + Import-Module .\tools\ci.psm1 + $xUnitTestResultsFile = "$(System.ArtifactsDirectory)\xunit\xUnitTestResults.xml" + + Test-XUnitTestResults -TestResultsFile $xUnitTestResultsFile + displayName: Test + condition: succeeded() diff --git a/.vsts-ci/windows.yml b/.vsts-ci/windows.yml index dd3c612c6d0..ad6e969c2c7 100644 --- a/.vsts-ci/windows.yml +++ b/.vsts-ci/windows.yml @@ -25,7 +25,7 @@ pr: - /tools/releaseBuild/**/* - /.vsts-ci/misc-analysis.yml - /.github/ISSUE_TEMPLATE/* - + variables: GIT_CONFIG_PARAMETERS: "'core.autocrlf=false'" DOTNET_CLI_TELEMETRY_OPTOUT: 1 @@ -70,30 +70,7 @@ jobs: - template: templates/windows-packaging.yml -- job: verify_xunit - displayName: Verify xUnit Results - pool: - name: 'Hosted VS2017' - dependsOn: - - win_build - steps: - - task: DownloadBuildArtifacts@0 - displayName: 'Download build artifacts' - inputs: - downloadType: specific - itemPattern: | - xunit/**/* - downloadPath: '$(System.ArtifactsDirectory)' - - - powershell: | - dir "$(System.ArtifactsDirectory)\*" -Recurse - displayName: 'Capture artifacts directory' - continueOnError: true - - - powershell: | - Import-Module .\tools\ci.psm1 - $xUnitTestResultsFile = "$(System.ArtifactsDirectory)\xunit\xUnitTestResults.xml" - - Test-XUnitTestResults -TestResultsFile $xUnitTestResultsFile - displayName: Test - condition: succeeded() +- template: templates/verify-xunit.yml + parameters: + pool: 'Hosted VS2017' + dependsOn: win_build From eebcb5fc38ae297b9e59628ccc01e2c6973887d0 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 1 Apr 2019 15:15:54 -0700 Subject: [PATCH 2/4] Make windows packaging wait for tests to complete for daily builds --- .vsts-ci/templates/windows-packaging.yml | 3 +- .vsts-ci/windows-daily.yml | 83 ++++++++++++++++++++++++ tools/ci.psm1 | 2 +- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 .vsts-ci/windows-daily.yml diff --git a/.vsts-ci/templates/windows-packaging.yml b/.vsts-ci/templates/windows-packaging.yml index 3f03323cc3b..bf2ff5a02b3 100644 --- a/.vsts-ci/templates/windows-packaging.yml +++ b/.vsts-ci/templates/windows-packaging.yml @@ -1,6 +1,7 @@ parameters: pool: 'Hosted VS2017' jobName: 'win_packaging' + parentJobs: [] jobs: - job: ${{ parameters.jobName }} @@ -27,5 +28,5 @@ jobs: - powershell: | Import-Module .\tools\ci.psm1 Invoke-CIAfterTest - Invoke-CIFinish -NuGetKey $(NUGET_KEY) + Invoke-CIFinish displayName: Build and Test Package diff --git a/.vsts-ci/windows-daily.yml b/.vsts-ci/windows-daily.yml new file mode 100644 index 00000000000..0e159bf8a3b --- /dev/null +++ b/.vsts-ci/windows-daily.yml @@ -0,0 +1,83 @@ +name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr) +trigger: + # Batch merge builds together while a merge build is running + batch: true + branches: + include: + - master + - release* + paths: + include: + - '*' + exclude: + - /tools/releaseBuild/**/* + - /.vsts-ci/misc-analysis.yml + - /.github/ISSUE_TEMPLATE/* +pr: + branches: + include: + - master + - release* + paths: + include: + - '*' + exclude: + - /tools/releaseBuild/**/* + - /.vsts-ci/misc-analysis.yml + - /.github/ISSUE_TEMPLATE/* + +variables: + GIT_CONFIG_PARAMETERS: "'core.autocrlf=false'" + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + POWERSHELL_TELEMETRY_OPTOUT: 1 + # Avoid expensive initialization of dotnet cli, see: https://donovanbrown.com/post/Stop-wasting-time-during-NET-Core-builds + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + +resources: +- repo: self + clean: true + +jobs: +- template: templates/ci-build.yml + +- template: templates/windows-test.yml + parameters: + purpose: UnelevatedPesterTests + tagSet: CI + parentJobs: + - win_build + +- template: templates/windows-test.yml + parameters: + purpose: ElevatedPesterTests + tagSet: CI + parentJobs: + - win_build + +- template: templates/windows-test.yml + parameters: + purpose: UnelevatedPesterTests + tagSet: Others + parentJobs: + - win_build + +- template: templates/windows-test.yml + parameters: + purpose: ElevatedPesterTests + tagSet: Others + parentJobs: + - win_build + +- template: templates/windows-packaging.yml + parameters: + dependsOn: + - win_test_UnelevatedPesterTests_CI + - win_test_ElevatedPesterTests_CI + - win_test_UnelevatedPesterTests_Others + - win_test_ElevatedPesterTests_Others + - verify_xunit + +- template: templates/verify-xunit.yml + parameters: + pool: 'Hosted VS2017' + dependsOn: win_build diff --git a/tools/ci.psm1 b/tools/ci.psm1 index aab5d14f6e3..e8884443738 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -490,7 +490,7 @@ function Invoke-CIFinish } # only publish assembly nuget packages if it is a daily build and tests passed - if((Test-DailyBuild) -and $env:TestPassed -eq 'True') + if(Test-DailyBuild) { Publish-NuGetFeed -OutputPath .\nuget-artifacts -ReleaseTag $preReleaseVersion $nugetArtifacts = Get-ChildItem .\nuget-artifacts -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName } From 658f4bdda4268cb4c0b78e6e10f51bd9c4b493a8 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 1 Apr 2019 15:18:24 -0700 Subject: [PATCH 3/4] Add back passing nuget key --- .vsts-ci/templates/windows-packaging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vsts-ci/templates/windows-packaging.yml b/.vsts-ci/templates/windows-packaging.yml index bf2ff5a02b3..30f89fc5b8f 100644 --- a/.vsts-ci/templates/windows-packaging.yml +++ b/.vsts-ci/templates/windows-packaging.yml @@ -28,5 +28,5 @@ jobs: - powershell: | Import-Module .\tools\ci.psm1 Invoke-CIAfterTest - Invoke-CIFinish + Invoke-CIFinish -NuGetKey $(NUGET_KEY) displayName: Build and Test Package From 5ccda0448e65cbd16e1ec662c29788e9463c4c08 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 1 Apr 2019 15:27:57 -0700 Subject: [PATCH 4/4] Add comments --- .vsts-ci/windows-daily.yml | 2 ++ .vsts-ci/windows.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/.vsts-ci/windows-daily.yml b/.vsts-ci/windows-daily.yml index 0e159bf8a3b..026190c132d 100644 --- a/.vsts-ci/windows-daily.yml +++ b/.vsts-ci/windows-daily.yml @@ -70,6 +70,8 @@ jobs: - template: templates/windows-packaging.yml parameters: + # we wait for all tests to finish as this phase uploads the daily nuget package to MyGet. + # we want to upload only if tests have passed. dependsOn: - win_test_UnelevatedPesterTests_CI - win_test_ElevatedPesterTests_CI diff --git a/.vsts-ci/windows.yml b/.vsts-ci/windows.yml index ad6e969c2c7..76e727b4895 100644 --- a/.vsts-ci/windows.yml +++ b/.vsts-ci/windows.yml @@ -68,6 +68,7 @@ jobs: parentJobs: - win_build +# Unlike daily builds, we do not upload nuget package to MyGet so we do not wait on tests to finish. - template: templates/windows-packaging.yml - template: templates/verify-xunit.yml