From b80375f4979b554d6ad56b1f125ae2ad2efce80e Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Fri, 29 May 2020 10:01:29 -0700 Subject: [PATCH] Update the CI builds (#12830) Include the following changes: - Use stages for Linux & macOS CI - Change windows-daily to run tests in one agent --- .vsts-ci/linux.yml | 101 +++++++++++++++++++------------------ .vsts-ci/mac.yml | 85 ++++++++++++++++--------------- .vsts-ci/windows-daily.yml | 89 +++++++++++++++++++++++++------- 3 files changed, 167 insertions(+), 108 deletions(-) diff --git a/.vsts-ci/linux.yml b/.vsts-ci/linux.yml index 6c7a94e02..8b9bccb36 100644 --- a/.vsts-ci/linux.yml +++ b/.vsts-ci/linux.yml @@ -40,59 +40,62 @@ variables: resources: - repo: self clean: true -jobs: -- template: templates/ci-build.yml - parameters: - pool: ubuntu-16.04 - jobName: linux_build - displayName: linux Build -- template: templates/nix-test.yml - parameters: - name: Linux - pool: ubuntu-16.04 - purpose: UnelevatedPesterTests - tagSet: CI - parentJobs: - - linux_build +stages: +- stage: BuildLinux + displayName: Build for Linux + jobs: + - template: templates/ci-build.yml + parameters: + pool: ubuntu-16.04 + jobName: linux_build + displayName: linux Build -- template: templates/nix-test.yml - parameters: - name: Linux - pool: ubuntu-16.04 - purpose: ElevatedPesterTests - tagSet: CI - parentJobs: - - linux_build +- stage: TestLinux + displayName: Test for Linux + jobs: + - template: templates/nix-test.yml + parameters: + name: Linux + pool: ubuntu-16.04 + purpose: UnelevatedPesterTests + tagSet: CI -- template: templates/nix-test.yml - parameters: - name: Linux - pool: ubuntu-16.04 - purpose: UnelevatedPesterTests - tagSet: Others - parentJobs: - - linux_build + - template: templates/nix-test.yml + parameters: + name: Linux + pool: ubuntu-16.04 + purpose: ElevatedPesterTests + tagSet: CI -- template: templates/nix-test.yml - parameters: - name: Linux - pool: ubuntu-16.04 - purpose: ElevatedPesterTests - tagSet: Others - parentJobs: - - linux_build + - template: templates/nix-test.yml + parameters: + name: Linux + pool: ubuntu-16.04 + purpose: UnelevatedPesterTests + tagSet: Others -- template: templates/verify-xunit.yml - parameters: - pool: ubuntu-16.04 - parentJobs: - - linux_build + - template: templates/nix-test.yml + parameters: + name: Linux + pool: ubuntu-16.04 + purpose: ElevatedPesterTests + tagSet: Others -- job: CodeCovTestPackage + - template: templates/verify-xunit.yml + parameters: + pool: ubuntu-16.04 + +- stage: CodeCovTestPackage displayName: CodeCoverage and Test Packages - steps: - - powershell: | - Import-Module .\tools\ci.psm1 - New-CodeCoverageAndTestPackage - displayName: CodeCoverage and Test Package + dependsOn: [] # by specifying an empty array, this stage doesn't depend on the stage before it + jobs: + - job: CodeCovTestPackage + displayName: CodeCoverage and Test Packages + pool: + vmImage: ubuntu-16.04 + steps: + - pwsh: | + Import-Module .\tools\ci.psm1 + New-CodeCoverageAndTestPackage + displayName: CodeCoverage and Test Package diff --git a/.vsts-ci/mac.yml b/.vsts-ci/mac.yml index ca4a66fc7..f41f4863d 100644 --- a/.vsts-ci/mac.yml +++ b/.vsts-ci/mac.yml @@ -42,51 +42,54 @@ variables: resources: - repo: self clean: true -jobs: -- template: templates/ci-build.yml - parameters: - pool: macOS-latest - jobName: mac_build - displayName: macOS Build -- template: templates/nix-test.yml - parameters: - purpose: UnelevatedPesterTests - tagSet: CI - parentJobs: - - mac_build +stages: +- stage: BuildMac + displayName: Build for macOS + jobs: + - template: templates/ci-build.yml + parameters: + pool: macOS-latest + jobName: mac_build + displayName: macOS Build -- template: templates/nix-test.yml - parameters: - purpose: ElevatedPesterTests - tagSet: CI - parentJobs: - - mac_build +- stage: TestMac + displayName: Test for macOS + jobs: + - template: templates/nix-test.yml + parameters: + purpose: UnelevatedPesterTests + tagSet: CI -- template: templates/nix-test.yml - parameters: - purpose: UnelevatedPesterTests - tagSet: Others - parentJobs: - - mac_build + - template: templates/nix-test.yml + parameters: + purpose: ElevatedPesterTests + tagSet: CI -- template: templates/nix-test.yml - parameters: - purpose: ElevatedPesterTests - tagSet: Others - parentJobs: - - mac_build + - template: templates/nix-test.yml + parameters: + purpose: UnelevatedPesterTests + tagSet: Others -- template: templates/verify-xunit.yml - parameters: - pool: macOS-latest - parentJobs: - - mac_build + - template: templates/nix-test.yml + parameters: + purpose: ElevatedPesterTests + tagSet: Others -- job: CodeCovTestPackage + - template: templates/verify-xunit.yml + parameters: + pool: macOS-latest + +- stage: CodeCovTestPackage displayName: CodeCoverage and Test Packages - steps: - - powershell: | - Import-Module .\tools\ci.psm1 - New-CodeCoverageAndTestPackage - displayName: CodeCoverage and Test Package + dependsOn: [] # by specifying an empty array, this stage doesn't depend on the stage before it + jobs: + - job: CodeCovTestPackage + displayName: CodeCoverage and Test Packages + pool: + vmImage: macOS-latest + steps: + - pwsh: | + Import-Module .\tools\ci.psm1 + New-CodeCoverageAndTestPackage + displayName: CodeCoverage and Test Package diff --git a/.vsts-ci/windows-daily.yml b/.vsts-ci/windows-daily.yml index c05b5735c..80a8723f9 100644 --- a/.vsts-ci/windows-daily.yml +++ b/.vsts-ci/windows-daily.yml @@ -49,31 +49,84 @@ stages: - stage: TestWin displayName: Test for Windows jobs: - - template: templates/windows-test.yml - parameters: - purpose: UnelevatedPesterTests - tagSet: CI + - job: win_test + pool: + vmImage: vs2017-win2016 + displayName: Windows Test - - template: templates/windows-test.yml - parameters: - purpose: ElevatedPesterTests - tagSet: CI + steps: + - pwsh: | + Get-ChildItem -Path env: + displayName: 'Capture Environment' + condition: succeededOrFailed() - - template: templates/windows-test.yml - parameters: - purpose: UnelevatedPesterTests - tagSet: Others + - task: DownloadBuildArtifacts@0 + displayName: 'Download Build Artifacts' + inputs: + downloadType: specific + itemPattern: | + build/**/* + xunit/**/* + downloadPath: '$(System.ArtifactsDirectory)' - - template: templates/windows-test.yml - parameters: - purpose: ElevatedPesterTests - tagSet: Others + - pwsh: | + Get-ChildItem "$(System.ArtifactsDirectory)\*" -Recurse + displayName: 'Capture Artifacts Directory' + continueOnError: true - - template: templates/verify-xunit.yml + # must be run frow Windows PowerShell + - powershell: | + Import-Module .\tools\ci.psm1 + Invoke-CIInstall + displayName: Bootstrap + condition: succeededOrFailed() + + - pwsh: | + Import-Module .\build.psm1 + Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json' + $path = Split-Path -Parent (Get-PSOutput -Options (Get-PSOptions)) + $rootPath = Split-Path -Path $path + Expand-Archive -Path '$(System.ArtifactsDirectory)\build\build.zip' -DestinationPath $rootPath -Force + displayName: 'Unzip Build' + condition: succeeded() + + - pwsh: | + Import-Module .\tools\ci.psm1 + Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json' + Invoke-CITest -Purpose UnelevatedPesterTests -TagSet CI + displayName: Test - UnelevatedPesterTests - CI + condition: succeeded() + + - pwsh: | + Import-Module .\tools\ci.psm1 + Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json' + Invoke-CITest -Purpose ElevatedPesterTests -TagSet CI + displayName: Test - ElevatedPesterTests - CI + condition: succeededOrFailed() + + - pwsh: | + Import-Module .\tools\ci.psm1 + Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json' + Invoke-CITest -Purpose UnelevatedPesterTests -TagSet Others + displayName: Test - UnelevatedPesterTests - Others + condition: succeededOrFailed() + + - pwsh: | + Import-Module .\tools\ci.psm1 + Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json' + Invoke-CITest -Purpose ElevatedPesterTests -TagSet Others + displayName: Test - ElevatedPesterTests - Others + condition: succeededOrFailed() + + - pwsh: | + Import-Module .\build.psm1 + $xUnitTestResultsFile = "$(System.ArtifactsDirectory)\xunit\xUnitTestResults.xml" + Test-XUnitTestResults -TestResultsFile $xUnitTestResultsFile + displayName: Verify xUnit Test Results + condition: succeededOrFailed() - stage: PackagingWin displayName: Packaging for Windows jobs: # 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 -