forked from MicrosoftDocs/PowerShell-Docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci.yml
89 lines (80 loc) · 2.46 KB
/
ci.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr)
trigger:
branches:
include:
- live
- staging
paths:
include:
- reference/**/*
- build.ps1
- ci.yml
- .openpublishing.build.ps1
- .openpublishing.publish.config.json
- .openpublishing.redirection.json
- tests/**/*
- '**/docfx.json'
- '**/TOC.yml'
- '**/toc.yml'
- '**/*.md'
pr:
branches:
include:
- staging
- live
paths:
include:
- reference/**/*
- build.ps1
- ci.yml
- .openpublishing.build.ps1
- .openpublishing.publish.config.json
- .openpublishing.redirection.json
- tests/**/*
- '**/docfx.json'
- '**/TOC.yml'
- '**/toc.yml'
- '**/*.md'
resources:
- repo: self
clean: true
jobs:
- job:
displayName: Build PowerShell Docs
condition: succeeded()
pool: Hosted VS2017
steps:
- powershell: |
Get-ChildItem Env:\
displayName: Capture environment
- powershell: |
if ((Get-Command pwsh -CommandType Application) -eq $null)
{
$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
- pwsh: |
Install-Module -Name platyPS -Repository PSGallery -Force
displayName: Install tools
- pwsh: |
$(Build.SourcesDirectory)\build.ps1
displayName: Build
- pwsh: |
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: |
Install-Module -Name Pester -Repository PSGallery -Force
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)'