Skip to content

Commit 47bc3b7

Browse files
authored
Begin remove pspackageproject dependency from build (#207)
* Begin remove pspackageproject dependency from build * Complete remove pspackageproject dependency * Debug build 1 * Fix typo 1 * Fix typo 2 * Fix typo 3 * debug 2 * Fix out of date tools * Fix upload variable error * Remove unneeded powershell core install * Remove pspackageproject dependency from release CI
1 parent 3d279b1 commit 47bc3b7

File tree

10 files changed

+334
-187
lines changed

10 files changed

+334
-187
lines changed

.ci/ci.yml

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,7 @@ stages:
2727
vmImage: windows-latest
2828

2929
steps:
30-
- powershell: |
31-
$powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell'
32-
Invoke-WebRequest -Uri https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -outfile ./install-powershell.ps1
33-
./install-powershell.ps1 -Destination $powerShellPath
34-
$vstsCommandString = "vso[task.setvariable variable=PATH]$powerShellPath;$env:PATH"
35-
Write-Host "sending " + $vstsCommandString
36-
Write-Host "##$vstsCommandString"
37-
displayName: Install PowerShell Core
38-
39-
- task: UseDotNet@2
40-
displayName: 'Install .NET Core 3.1.401 SDK'
41-
inputs:
42-
packageType: sdk
43-
version: 3.1.401
44-
includePreviewVersions: false
45-
46-
- task: NuGetToolInstaller@1
47-
displayName: 'Install NuGet 5.6.0'
48-
inputs:
49-
checkLatest: false
50-
version: 5.6.0
51-
30+
5231
- pwsh: |
5332
Get-ChildItem -Path env:
5433
displayName: Capture environment for build
@@ -69,44 +48,38 @@ stages:
6948
- pwsh: |
7049
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
7150
Write-Verbose -Verbose "Install PowerShellGet V3 to temp module path"
72-
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.0-beta10 -AllowPrerelease -Force
73-
Write-Verbose -Verbose "Install PlatyPS to temp module path"
74-
Save-Module -Name "platyPS" -Path $modulePath -Force
75-
Write-Verbose -Verbose "Install PSScriptAnalyzer to temp module path"
76-
Save-Module -Name "PSScriptAnalyzer" -Path $modulePath -RequiredVersion 1.18.0 -Force
77-
Write-Verbose -Verbose "Install Pester 4.X to temp module path"
78-
Save-Module -Name "Pester" -MaximumVersion 4.99 -Path $modulePath -Force
79-
Write-Verbose -Verbose "Install PSPackageProject to temp module path"
80-
Save-Module -Name PSPackageProject -Path $modulePath -Force
81-
displayName: Install PSPackageProject and dependencies
51+
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.18-beta18 -AllowPrerelease -Force
52+
displayName: Install PowerShellGetV3
53+
54+
- pwsh: |
55+
Get-ChildItem -Path $(Build.SourcesDirectory)/src/code -Recurse
56+
displayName: Capture source code for build
57+
condition: succeededOrFailed()
8258
8359
- pwsh: |
8460
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
8561
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
86-
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
87-
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
88-
Import-Module -Name $modPath -Force
62+
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
63+
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
8964
#
9065
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release
91-
displayName: Build and publish artifact
66+
displayName: Build module
9267
9368
- pwsh: |
9469
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
9570
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
96-
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
97-
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
98-
Import-Module -Name $modPath -Force
71+
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
72+
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
9973
#
10074
$(Build.SourcesDirectory)/build.ps1 -Publish
101-
displayName: Create module artifact
75+
displayName: Publish module nuget package and upload package artifact
10276
10377
- pwsh: |
10478
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
10579
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
106-
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
107-
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
108-
Import-Module -Name $modPath -Force
109-
$config = Get-PSPackageProjectConfiguration
80+
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
81+
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
82+
$config = Get-BuildConfiguration
11083
#
11184
$srcModulePath = Resolve-Path -Path "$($config.BuildOutputPath)/$($config.ModuleName)"
11285
Get-ChildItem $srcModulePath
@@ -117,7 +90,7 @@ stages:
11790
# Get-ChildItem $refAssemblyNuGetPath
11891
# $artifactName = "RefAssemblyNuGet"
11992
# Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$refAssemblyNuGetPath"
120-
displayName: Upload module artifact for compliance, ref assembly build currently disabled
93+
displayName: Upload module artifact
12194

12295
- stage: Compliance
12396
displayName: Compliance

.ci/ci_auto.yml

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -52,41 +52,25 @@ stages:
5252
- pwsh: |
5353
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
5454
Write-Verbose -Verbose "Install PowerShellGet V3 to temp module path"
55-
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.0-beta10 -AllowPrerelease -Force
56-
Write-Verbose -Verbose "Install PlatyPS to temp module path"
57-
Save-Module -Name "platyPS" -Path $modulePath -Force
58-
Write-Verbose -Verbose "Install PSScriptAnalyzer to temp module path"
59-
Save-Module -Name "PSScriptAnalyzer" -Path $modulePath -RequiredVersion 1.18.0 -Force
60-
Write-Verbose -Verbose "Install Pester 4.X to temp module path"
61-
Save-Module -Name "Pester" -MaximumVersion 4.99 -Path $modulePath -Force
62-
Write-Verbose -Verbose "Install PSPackageProject to temp module path"
63-
Save-Module -Name PSPackageProject -Path $modulePath -Force
64-
displayName: Install PSPackageProject and dependencies
65-
66-
- pwsh: |
67-
Get-ChildItem -Path env:
68-
Get-ChildItem -Path . -Recurse -Directory
69-
displayName: Capture environment for build
70-
condition: succeededOrFailed()
55+
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.18-beta18 -AllowPrerelease -Force
56+
displayName: Install PowerShellGetV3
7157
7258
- pwsh: |
7359
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
7460
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
75-
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
76-
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
77-
Import-Module -Name $modPath -Force
61+
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
62+
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
7863
#
7964
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release
80-
displayName: Build and publish artifact
65+
displayName: Build module
8166
8267
- pwsh: |
8368
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
8469
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
85-
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
86-
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
87-
Import-Module -Name $modPath -Force
70+
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
71+
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
8872
#
89-
$config = Get-PSPackageProjectConfiguration
73+
$config = Get-BuildConfiguration
9074
$signSrcPath = "$($config.BuildOutputPath)\$($config.ModuleName)"
9175
$signOutPath = "$($config.SignedOutputPath)\$($config.ModuleName)"
9276
if (! (Test-Path -Path $signOutPath)) {
@@ -102,7 +86,7 @@ stages:
10286
$vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}"
10387
Write-Host "sending " + $vstsCommandString
10488
Write-Host "##$vstsCommandString"
105-
displayName: Set signing path variables for possible module code signing
89+
displayName: Set signing path variables for module code signing
10690
10791
- pwsh: |
10892
Get-ChildItem -Path env:
@@ -125,27 +109,32 @@ stages:
125109
- pwsh: |
126110
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
127111
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
128-
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
129-
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
130-
Import-Module -Name $modPath -Force
112+
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
113+
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
131114
#
132-
$(Build.SourcesDirectory)/build.ps1 -Publish -Signed
133-
displayName: Create module artifact
115+
if ($env:ShouldSign -ne 'True')
116+
{
117+
$(Build.SourcesDirectory)/build.ps1 -Publish
118+
}
119+
else
120+
{
121+
$(Build.SourcesDirectory)/build.ps1 -Publish -Signed
122+
}
123+
displayName: Publish module nuget package and upload package artifact
134124
condition: succeeded()
135125
136126
- pwsh: |
137127
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
138128
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
139-
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
140-
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
141-
Import-Module -Name $modPath -Force
129+
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
130+
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
142131
#
143-
$config = Get-PSPackageProjectConfiguration
132+
$config = Get-BuildConfiguration
144133
$srcModulePath = Resolve-Path -Path "$($config.SignedOutputPath)/$($config.ModuleName)"
145134
Get-ChildItem $srcModulePath
146135
$artifactName = "$($config.ModuleName)"
147136
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$srcModulePath"
148-
displayName: Create and upload the module artifacts
137+
displayName: Upload the module artifact
149138
condition: succeeded()
150139
151140
- stage: Compliance

.ci/ci_release.yml

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,35 +48,25 @@ stages:
4848
- pwsh: |
4949
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
5050
Write-Verbose -Verbose "Install PowerShellGet V3 to temp module path"
51-
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.0-beta10 -AllowPrerelease -Force
52-
Write-Verbose -Verbose "Install PlatyPS to temp module path"
53-
Save-Module -Name "platyPS" -Path $modulePath -Force
54-
Write-Verbose -Verbose "Install PSScriptAnalyzer to temp module path"
55-
Save-Module -Name "PSScriptAnalyzer" -Path $modulePath -RequiredVersion 1.18.0 -Force
56-
Write-Verbose -Verbose "Install Pester 4.X to temp module path"
57-
Save-Module -Name "Pester" -MaximumVersion 4.99 -Path $modulePath -Force
58-
Write-Verbose -Verbose "Install PSPackageProject to temp module path"
59-
Save-Module -Name PSPackageProject -Path $modulePath -Force
60-
displayName: Install PSPackageProject and dependencies
51+
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.18-beta18 -AllowPrerelease -Force
52+
displayName: Install PowerShellGetV3
6153
6254
- pwsh: |
6355
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
6456
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
65-
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
66-
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
67-
Import-Module -Name $modPath -Force
57+
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
58+
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
6859
#
6960
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release
70-
displayName: Build and publish artifact
61+
displayName: Build module
7162
7263
- pwsh: |
7364
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
7465
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
75-
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
76-
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
77-
Import-Module -Name $modPath -Force
66+
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
67+
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
7868
#
79-
$config = Get-PSPackageProjectConfiguration
69+
$config = Get-BuildConfiguration
8070
$signSrcPath = "$($config.BuildOutputPath)\$($config.ModuleName)"
8171
$signOutPath = "$($config.SignedOutputPath)\$($config.ModuleName)"
8272
if (! (Test-Path -Path $signOutPath)) {
@@ -92,7 +82,7 @@ stages:
9282
$vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}"
9383
Write-Host "sending " + $vstsCommandString
9484
Write-Host "##$vstsCommandString"
95-
displayName: Set signing path variables for possible module code signing
85+
displayName: Set signing path variables for module code signing
9686
9787
- pwsh: |
9888
Get-ChildItem -Path env:
@@ -122,9 +112,8 @@ stages:
122112
- pwsh: |
123113
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
124114
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
125-
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
126-
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
127-
Import-Module -Name $modPath -Force
115+
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
116+
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
128117
#
129118
if ($env:SkipSigning -eq 'True')
130119
{
@@ -134,16 +123,16 @@ stages:
134123
{
135124
$(Build.SourcesDirectory)/build.ps1 -Publish -Signed
136125
}
137-
displayName: Create module artifact
126+
displayName: Publish module nuget package and upload package artifact
127+
condition: succeeded()
138128
139129
- pwsh: |
140130
# $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
141131
# $env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
142-
# $modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
143-
# Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
144-
# Import-Module -Name $modPath -Force
132+
# Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
133+
# Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
145134
# #
146-
# $config = Get-PSPackageProjectConfiguration
135+
# $config = Get-BuildConfiguration
147136
# $signSrcPath = Resolve-Path -Path "$($config.BuildOutputPath)"
148137
# $signOutPath = "$($config.SignedOutputPath)\RefAssemblyNuGet"
149138
# if (! (Test-Path -Path $signOutPath)) {
@@ -176,11 +165,10 @@ stages:
176165
- pwsh: |
177166
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
178167
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
179-
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
180-
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
181-
Import-Module -Name $modPath -Force
168+
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
169+
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
182170
#
183-
$config = Get-PSPackageProjectConfiguration
171+
$config = Get-BuildConfiguration
184172
if ($env:SkipSigning -eq 'True')
185173
{
186174
$srcModulePath = Resolve-Path -Path "$($config.BuildOutputPath)/$($config.ModuleName)"

0 commit comments

Comments
 (0)