-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
75 lines (69 loc) · 2.21 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
# 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:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
- name: TestResultsFile
value: $(Build.ArtifactStagingDirectory)/unittests.xml
- name: CodeCoverageFile
value: $(Build.ArtifactStagingDirectory)/codecoverage.xml
steps:
- task: DockerCompose@0
displayName: 'Start Concourse'
inputs:
containerregistrytype: 'Container Registry'
dockerComposeFile: 'docker-compose.yml'
action: 'Run a Docker Compose command'
dockerComposeCommand: 'up -d'
- task: PowerShell@2
displayName: 'Pester Tests'
inputs:
targetType: 'inline'
script: |
Install-Module Pester -Force
Import-Module Pester -Force
$ProgressPreference = "SilentlyContinue"
$verbosePreference = "Continue"
Invoke-Pester -Path test -Verbose -OutputFile $(TestResultsFile) -OutputFormat NUnitXML -CodeCoverage $(Build.SourcesDirectory)/concourse.psm1 -CodeCoverageOutputFile $(CodeCoverageFile) -Show All
failOnStderr: true
pwsh: true
- task: DockerCompose@0
displayName: 'Stop Concourse'
condition: always()
inputs:
containerregistrytype: 'Container Registry'
dockerComposeFile: 'docker-compose.yml'
action: 'Run a Docker Compose command'
dockerComposeCommand: 'down'
- task: PublishTestResults@2
name: TestResults
displayName: Publish Unit Test Results
condition: always()
inputs:
testResultsFormat: NUnit
testResultsFiles: $(TestResultsFile)
- task: PublishCodeCoverageResults@1
inputs:
summaryFileLocation: $(CodeCoverageFile)
pathToSources: $(Build.SourcesDirectory)
- task: PowerShell@2
displayName: 'Code Review'
inputs:
targetType: 'inline'
script: |
Install-Module PSScriptAnalyzer -Force
$codeReview = Invoke-ScriptAnalyzer -Path . -IncludeDefaultRules -RecurseCustomRulePath
write-output $codeReview
if(($codeReview | Where-Object{$_.Severity -eq "Error"}).Count -gt 0) {
Exit 1
}
failOnStderr: true
pwsh: true
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)'
artifact: 'concourse-artifacts'