Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
43 changes: 43 additions & 0 deletions .vsts-ci/templates/windows-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
parameters:
pool: 'Hosted VS2017'
jobName: 'win_build'

jobs:
- job: ${{ parameters.jobName }}
pool:
name: ${{ parameters.pool }}

displayName: Windows Build

steps:
- powershell: |
Get-ChildItem -Path env:
displayName: Capture environment
condition: succeededOrFailed()

- powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
displayName: Set Build Name for Non-PR
condition: ne(variables['Build.Reason'], 'PullRequest')

- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml

- powershell: |
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Import-Module .\tools\ci.psm1
Invoke-AppveyorInstall
displayName: Bootstrap
condition: succeededOrFailed()

- powershell: |
Import-Module .\tools\ci.psm1
Invoke-AppveyorBuild
displayName: Build
condition: succeeded()

- powershell: |
Import-Module .\tools\ci.psm1
Restore-PSOptions
Invoke-CIxUnit -SkipFailing
displayName: xUnit Tests
condition: succeeded()

30 changes: 30 additions & 0 deletions .vsts-ci/templates/windows-packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
parameters:
pool: 'Hosted VS2017'
jobName: 'win_packaging'

jobs:
- job: ${{ parameters.jobName }}
pool:
name: ${{ parameters.pool }}

displayName: Windows Packaging

steps:
- powershell: |
Get-ChildItem -Path env:
displayName: Capture environment
condition: succeededOrFailed()

- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml

- powershell: |
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Import-Module .\tools\ci.psm1
Invoke-AppveyorInstall
displayName: Bootstrap
condition: succeededOrFailed()

- powershell: |
Import-Module .\tools\ci.psm1
Invoke-AppveyorFinish -NuGetKey $(NUGET_KEY)
displayName: Build and Test Package
51 changes: 51 additions & 0 deletions .vsts-ci/templates/windows-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
parameters:
pool: 'Hosted VS2017'
parentJobs: []
purpose: ''
tagSet: 'CI'

jobs:
- job: win_test_${{ parameters.purpose }}_${{ parameters.tagSet }}
dependsOn:
${{ parameters.parentJobs }}
pool:
name: ${{ parameters.pool }}

displayName: Windows Test - ${{ parameters.purpose }} - ${{ parameters.tagSet }}

steps:
- powershell: |
Get-ChildItem -Path env:
displayName: Capture environment
condition: succeededOrFailed()

- task: DownloadBuildArtifacts@0
displayName: 'Download build artifacts'
inputs:
downloadType: specific
itemPattern: |
build/**/*
downloadPath: '$(System.ArtifactsDirectory)'

- powershell: |
dir "$(System.ArtifactsDirectory)\*" -Recurse
displayName: 'Capture artifacts directory'
continueOnError: true

- powershell: |
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Import-Module .\tools\ci.psm1
Invoke-AppveyorInstall
displayName: Bootstrap
condition: succeededOrFailed()

- powershell: |
Import-Module .\tools\ci.psm1
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
$options = (Get-PSOptions)
$path = split-path -path $options.Output
$rootPath = split-Path -path $path
Expand-Archive -Path '$(System.ArtifactsDirectory)\build\build.zip' -DestinationPath $rootPath -Force
Invoke-AppveyorTest -Purpose '${{ parameters.purpose }}' -TagSet '${{ parameters.tagSet }}'
displayName: Test
condition: succeeded()
95 changes: 50 additions & 45 deletions .vsts-ci/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ pr:
exclude:
- /tools/releaseBuild/**/*
- /.vsts-ci/misc-analysis.yml
queue:
name: Hosted VS2017
parallel: 2 # Limit to two agents at a time
matrix:
UnelevatedPesterTests:
Purpose: UnelevatedPesterTests
ElevatedPesterTests_xUnit_Packaging:
Purpose: ElevatedPesterTests_xUnit_Packaging
timeoutInMinutes: 120

variables:
GIT_CONFIG_PARAMETERS: "'core.autocrlf=false'"
Expand All @@ -44,49 +35,63 @@ resources:
- repo: self
clean: true

steps:
- powershell: |
Get-ChildItem -Path env:
displayName: Capture environment
condition: succeededOrFailed()
jobs:
- template: templates/windows-build.yml

- powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
displayName: Set Build Name for Non-PR
condition: ne(variables['Build.Reason'], 'PullRequest')
- template: templates/windows-test.yml
parameters:
purpose: UnelevatedPesterTests
tagSet: CI
parentJobs:
- win_build

- template: ../tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
- template: templates/windows-test.yml
parameters:
purpose: ElevatedPesterTests
tagSet: CI
parentJobs:
- win_build

- powershell: |
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Import-Module .\tools\ci.psm1
Invoke-AppveyorInstall
displayName: Bootstrap
condition: succeededOrFailed()
- template: templates/windows-test.yml
parameters:
purpose: UnelevatedPesterTests
tagSet: Others
parentJobs:
- win_build

- powershell: |
Import-Module .\tools\ci.psm1
Invoke-AppveyorBuild
Save-PSOptions
displayName: Build
condition: succeeded()
- template: templates/windows-test.yml
parameters:
purpose: ElevatedPesterTests
tagSet: Others
parentJobs:
- win_build

- powershell: |
Import-Module .\tools\ci.psm1
Restore-PSOptions
Invoke-AppveyorTest -Purpose '$(Purpose)'
displayName: Test
condition: succeeded()
- 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: |
Import-Module .\tools\ci.psm1
Restore-PSOptions
Invoke-AppveyorAfterTest
displayName: AfterTest
condition: succeededOrFailed()
dir "$(System.ArtifactsDirectory)\*" -Recurse
displayName: 'Capture artifacts directory'
continueOnError: true

- powershell: |
Import-Module .\tools\ci.psm1
Restore-PSOptions
Invoke-AppveyorFinish -NuGetKey $(NUGET_KEY)
displayName: Finish
condition: eq(variables['Purpose'], 'ElevatedPesterTests_xUnit_Packaging')
$ParallelXUnitTestResultsFile = "$(System.ArtifactsDirectory)\xunit\ParallelXUnitTestResults.xml"

Test-XUnitTestResults -TestResultsFile $ParallelXUnitTestResultsFile
displayName: Test
condition: succeeded()
39 changes: 0 additions & 39 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2744,45 +2744,6 @@ function Save-PSOptions {
$Options | ConvertTo-Json -Depth 3 | Out-File -Encoding utf8 -FilePath $PSOptionsPath
}

# Restore PSOptions
# Optionally remove the PSOptions file
function Restore-PSOptions {
param(
[ValidateScript({Test-Path $_})]
[string]
$PSOptionsPath = (Join-Path -Path $PSScriptRoot -ChildPath 'psoptions.json'),
[switch]
$Remove
)

$options = Get-Content -Path $PSOptionsPath | ConvertFrom-Json

if($Remove)
{
# Remove PSOptions.
# The file is only used to set the PSOptions.
Remove-Item -Path $psOptionsPath
}

Set-PSOptions -Options $options
}

# Save PSOptions to be restored by Restore-PSOptions
function Save-PSOptions {
param(
[ValidateScript({$parent = Split-Path $_;if($parent){Test-Path $parent}else{return $true}})]
[ValidateNotNullOrEmpty()]
[string]
$PSOptionsPath = (Join-Path -Path $PSScriptRoot -ChildPath 'psoptions.json'),

[ValidateNotNullOrEmpty()]
[object]
$Options = (Get-PSOptions -DefaultToNew)
)

$Options | ConvertTo-Json -Depth 3 | Out-File -Encoding utf8 -FilePath $PSOptionsPath
}

# Restore PSOptions
# Optionally remove the PSOptions file
function Restore-PSOptions {
Expand Down
Loading