-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathci.yml
More file actions
150 lines (132 loc) · 4.82 KB
/
ci.yml
File metadata and controls
150 lines (132 loc) · 4.82 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: $(BuildDefinitionName)-$(date:yyMM).$(date:dd)$(rev:rrr)
trigger:
# Batch merge builds together while a merge build is running
batch: true
branches:
include:
- master
pr:
branches:
include:
- master
resources:
repositories:
- repository: ComplianceRepo
type: github
endpoint: ComplianceGHRepo
name: PowerShell/compliance
variables:
- group: GithubTestingFeedCreds
stages:
- stage: Build
displayName: Build PSResourceGet Module Package
jobs:
- job: BuildPkg
displayName: Build Package
pool:
vmImage: windows-latest
steps:
- task: UseDotNet@2
inputs:
useGlobalJson: true
- pwsh: |
Get-ChildItem -Path env:
displayName: Capture environment for build
condition: succeededOrFailed()
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
if (Test-Path -Path $modulePath) {
Write-Verbose -Verbose "Deleting existing temp module path: $modulePath"
Remove-Item -Path $modulePath -Recurse -Force -ErrorAction Ignore
}
if (! (Test-Path -Path $modulePath)) {
Write-Verbose -Verbose "Creating new temp module path: $modulePath"
$null = New-Item -Path $modulePath -ItemType Directory
}
displayName: Create temporary module path
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
Write-Verbose -Verbose "Install PSResourceGet to temp module path"
Save-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0-rc1 -Path $modulePath -AllowPrerelease -Force
displayName: Install Microsoft.PowerShell.PSResourceGet v3
- pwsh: |
Get-ChildItem -Path $(Build.SourcesDirectory)/src/code -Recurse
displayName: Capture source code for build
condition: succeededOrFailed()
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release -BuildFramework 'net8.0'
displayName: Build Module
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$(Build.SourcesDirectory)/build.ps1 -Publish
displayName: Publish module nuget package and upload package artifact
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
$config = Get-BuildConfiguration
#
$srcModulePath = Resolve-Path -Path "$($config.BuildOutputPath)/$($config.ModuleName)"
Get-ChildItem $srcModulePath
$artifactName = "$($config.ModuleName)"
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$srcModulePath"
displayName: Upload module artifact
- stage: Compliance
displayName: Compliance
dependsOn: Build
jobs:
- job: ComplianceJob
pool:
vmImage: windows-latest
steps:
- checkout: self
clean: true
- checkout: ComplianceRepo
clean: true
- download: current
artifact: 'Microsoft.PowerShell.PSResourceGet'
- template: ci-compliance.yml@ComplianceRepo
parameters:
# credscan
suppressionsFile: ''
- stage: Test
displayName: Test Package
dependsOn: Build
jobs:
- template: test.yml
parameters:
jobName: TestPkgWin
displayName: PowerShell Core on Windows
imageName: windows-latest
- template: test.yml
parameters:
jobName: TestPkgWinPS
displayName: Windows PowerShell on Windows
imageName: windows-latest
powershellExecutable: powershell
- template: test.yml
parameters:
jobName: TestPkgUbuntu
displayName: PowerShell Core on Ubuntu
imageName: ubuntu-latest
- template: test.yml
parameters:
jobName: TestPkgWinMacOS
displayName: PowerShell Core on macOS
imageName: macOS-latest
- template: test.yml
parameters:
jobName: TestPkgWinAzAuth
displayName: AzAuth PowerShell Core on Windows
imageName: windows-latest
useAzAuth: true