-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
ci-steps.yml
48 lines (41 loc) · 1.94 KB
/
ci-steps.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
steps:
- powershell: |
Get-ChildItem Env:\
displayName: Capture environment
#- powershell: |
# if ((Get-Command pwsh -CommandType Application -ErrorAction Ignore) -eq $null)
# {
# Write-Verbose -Verbose "Installing pwsh"
# $destPath = "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}/install-powershell.ps1"
# Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1' -OutFile $destPath
# Unblock-File $destPath
# & $destPath -UseMSI -Quiet
# }
# displayName: Install pwsh if not available
- powershell: |
Install-Module -Name platyPS -Repository PSGallery -Force
displayName: Install tools
- powershell: |
$(Build.SourcesDirectory)\build.ps1
displayName: Build
- powershell: |
Compress-Archive -Path "$(Build.SourcesDirectory)\updatablehelp\*" -DestinationPath "$(Build.ArtifactStagingDirectory)\updatablehelp-$(Build.BuildId).zip"
Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$(Build.ArtifactStagingDirectory)\updatablehelp-$(Build.BuildId).zip"
displayName: Compress and upload updatable help content
# We run tests on Windows PowerShell. Changing to PowerShell core would need changes to the tests
- powershell: |
$pester5 = Get-Module -Name Pester -ListAvailable | Where-Object { $_.Version.Major -ge 5 }
if ($pester5) {
Write-Verbose -Message "Pester version 5+ found. Uninstalling it." -Verbose
Uninstall-Module -Name Pester -MinimumVersion 5.0.0 -Verbose
}
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -RequiredVersion 4.10.1 -Verbose
Import-Module "$(Build.SourcesDirectory)/tests/PowerShellDocsTests.psm1" -Force
Invoke-Test
displayName: Test
# Publish Test Results to Azure Pipelines/TFS
- task: PublishTestResults@2
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: '**/TestResults.xml'
searchFolder: '$(Build.SourcesDirectory)'