-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
122 lines (120 loc) · 4.33 KB
/
azure-pipelines.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
jobs:
- job: 'tests'
strategy:
matrix:
linux:
imageName: 'ubuntu-latest'
mac:
imageName: 'macOS-latest'
windows:
imageName: 'windows-latest'
pool:
vmImage: $(imageName)
steps:
- task: PowerShell@2
displayName: "Run pester tests"
inputs:
targetType: 'inline'
script: |
Install-Module -Scope CurrentUser -Force -AllowClobber -SkipPublisherCheck Pester;
Import-Module Pester;
$configuration = [PesterConfiguration]::Default;
$configuration.CodeCoverage.Enabled = $true;
$configuration.CodeCoverage.Path = (Get-ChildItem src/*.ps1 | ForEach-Object{$_.FullName});
$configuration.CodeCoverage.OutputFormat = "JaCoCo";
$configuration.CodeCoverage.OutputPath = '$(imageName)-coverage.xml'
$configuration.TestResult.Enabled = $true;
$configuration.TestResult.OutputPath = '$(imageName)-testResults.xml'
$configuration.Run.Exit = $true;
$configuration.Run.Path = (Get-ChildItem tests/*ps1 | ForEach-Object{$_.FullName});
Invoke-Pester -Configuration $configuration;
showWarnings: true
pwsh: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Coverage'
condition: always()
inputs:
PathtoPublish: '$(imageName)-coverage.xml'
ArtifactName: 'coverage'
publishLocation: Container
- task: PublishBuildArtifacts@1
displayName: 'Publish Tests'
condition: always()
inputs:
PathtoPublish: '$(imageName)-testResults.xml'
ArtifactName: 'tests'
publishLocation: Container
- job: 'build_package'
pool:
vmImage: windows-latest
dependsOn:
- 'tests'
steps:
- task: PowerShell@2
displayName: "Build the powershell package"
inputs:
filePath: 'build/build.ps1'
showWarnings: true
pwsh: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'src/bin/'
ArtifactName: 'drop'
publishLocation: 'Container'
- job: 'publish_coverage_and_tests'
pool:
vmImage: windows-latest
dependsOn:
- 'tests'
steps:
# - task: DownloadBuildArtifacts@0
# displayName: 'Download Coverage Windows Artifacts'
# inputs:
# artifactName: windows-coverage
# downloadPath: $(System.DefaultWorkingDirectory)/
# - task: DownloadBuildArtifacts@0
# displayName: 'Download Coverage Linux Artifacts'
# inputs:
# artifactName: linux-coverage
# downloadPath: $(System.DefaultWorkingDirectory)/
# - task: DownloadBuildArtifacts@0
# displayName: 'Download Tests Windows Artifacts'
# inputs:
# artifactName: windows-tests
# downloadPath: $(System.DefaultWorkingDirectory)/
# - task: DownloadBuildArtifacts@0
# displayName: 'Download Tests Linux Artifacts'
# inputs:
# artifactName: linux-tests
# downloadPath: $(System.DefaultWorkingDirectory)/
- task: DownloadBuildArtifacts@1
displayName: 'Download All Tests Artifacts'
inputs:
artifactName: 'tests'
downloadPath: $(System.DefaultWorkingDirectory)/
- task: DownloadBuildArtifacts@1
displayName: 'Download All Coverage Artifacts'
inputs:
artifactName: 'coverage'
downloadPath: $(System.DefaultWorkingDirectory)/
- task: PublishCodeCoverageResults@1
condition: always()
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage/*coverage.xml'
pathToSources: 'src/'
failIfCoverageEmpty: true
- task: PublishTestResults@2
condition: always()
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: '$(System.DefaultWorkingDirectory)/tests/*testResults.xml'
failTaskOnFailedTests: true
testRunTitle: 'CZ.PowerShell.NetworkTools'
mergeTestResults: true