Skip to content

Commit

Permalink
Begin remove pspackageproject dependency from build (#207)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
PaulHigin committed Jan 12, 2023
1 parent 3d279b1 commit 47bc3b7
Show file tree
Hide file tree
Showing 10 changed files with 334 additions and 187 deletions.
63 changes: 18 additions & 45 deletions .ci/ci.yml
Expand Up @@ -27,28 +27,7 @@ stages:
vmImage: windows-latest

steps:
- powershell: |
$powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell'
Invoke-WebRequest -Uri https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -outfile ./install-powershell.ps1
./install-powershell.ps1 -Destination $powerShellPath
$vstsCommandString = "vso[task.setvariable variable=PATH]$powerShellPath;$env:PATH"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: Install PowerShell Core
- task: UseDotNet@2
displayName: 'Install .NET Core 3.1.401 SDK'
inputs:
packageType: sdk
version: 3.1.401
includePreviewVersions: false

- task: NuGetToolInstaller@1
displayName: 'Install NuGet 5.6.0'
inputs:
checkLatest: false
version: 5.6.0


- pwsh: |
Get-ChildItem -Path env:
displayName: Capture environment for build
Expand All @@ -69,44 +48,38 @@ stages:
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
Write-Verbose -Verbose "Install PowerShellGet V3 to temp module path"
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.0-beta10 -AllowPrerelease -Force
Write-Verbose -Verbose "Install PlatyPS to temp module path"
Save-Module -Name "platyPS" -Path $modulePath -Force
Write-Verbose -Verbose "Install PSScriptAnalyzer to temp module path"
Save-Module -Name "PSScriptAnalyzer" -Path $modulePath -RequiredVersion 1.18.0 -Force
Write-Verbose -Verbose "Install Pester 4.X to temp module path"
Save-Module -Name "Pester" -MaximumVersion 4.99 -Path $modulePath -Force
Write-Verbose -Verbose "Install PSPackageProject to temp module path"
Save-Module -Name PSPackageProject -Path $modulePath -Force
displayName: Install PSPackageProject and dependencies
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.18-beta18 -AllowPrerelease -Force
displayName: Install PowerShellGetV3
- 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
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
Import-Module -Name $modPath -Force
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release
displayName: Build and publish artifact
displayName: Build module
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
Import-Module -Name $modPath -Force
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$(Build.SourcesDirectory)/build.ps1 -Publish
displayName: Create module artifact
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
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
Import-Module -Name $modPath -Force
$config = Get-PSPackageProjectConfiguration
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
Expand All @@ -117,7 +90,7 @@ stages:
# Get-ChildItem $refAssemblyNuGetPath
# $artifactName = "RefAssemblyNuGet"
# Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$refAssemblyNuGetPath"
displayName: Upload module artifact for compliance, ref assembly build currently disabled
displayName: Upload module artifact

- stage: Compliance
displayName: Compliance
Expand Down
59 changes: 24 additions & 35 deletions .ci/ci_auto.yml
Expand Up @@ -52,41 +52,25 @@ stages:
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
Write-Verbose -Verbose "Install PowerShellGet V3 to temp module path"
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.0-beta10 -AllowPrerelease -Force
Write-Verbose -Verbose "Install PlatyPS to temp module path"
Save-Module -Name "platyPS" -Path $modulePath -Force
Write-Verbose -Verbose "Install PSScriptAnalyzer to temp module path"
Save-Module -Name "PSScriptAnalyzer" -Path $modulePath -RequiredVersion 1.18.0 -Force
Write-Verbose -Verbose "Install Pester 4.X to temp module path"
Save-Module -Name "Pester" -MaximumVersion 4.99 -Path $modulePath -Force
Write-Verbose -Verbose "Install PSPackageProject to temp module path"
Save-Module -Name PSPackageProject -Path $modulePath -Force
displayName: Install PSPackageProject and dependencies
- pwsh: |
Get-ChildItem -Path env:
Get-ChildItem -Path . -Recurse -Directory
displayName: Capture environment for build
condition: succeededOrFailed()
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.18-beta18 -AllowPrerelease -Force
displayName: Install PowerShellGetV3
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
Import-Module -Name $modPath -Force
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release
displayName: Build and publish artifact
displayName: Build module
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
Import-Module -Name $modPath -Force
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$config = Get-PSPackageProjectConfiguration
$config = Get-BuildConfiguration
$signSrcPath = "$($config.BuildOutputPath)\$($config.ModuleName)"
$signOutPath = "$($config.SignedOutputPath)\$($config.ModuleName)"
if (! (Test-Path -Path $signOutPath)) {
Expand All @@ -102,7 +86,7 @@ stages:
$vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: Set signing path variables for possible module code signing
displayName: Set signing path variables for module code signing
- pwsh: |
Get-ChildItem -Path env:
Expand All @@ -125,27 +109,32 @@ stages:
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
Import-Module -Name $modPath -Force
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$(Build.SourcesDirectory)/build.ps1 -Publish -Signed
displayName: Create module artifact
if ($env:ShouldSign -ne 'True')
{
$(Build.SourcesDirectory)/build.ps1 -Publish
}
else
{
$(Build.SourcesDirectory)/build.ps1 -Publish -Signed
}
displayName: Publish module nuget package and upload package artifact
condition: succeeded()
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
Import-Module -Name $modPath -Force
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$config = Get-PSPackageProjectConfiguration
$config = Get-BuildConfiguration
$srcModulePath = Resolve-Path -Path "$($config.SignedOutputPath)/$($config.ModuleName)"
Get-ChildItem $srcModulePath
$artifactName = "$($config.ModuleName)"
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$srcModulePath"
displayName: Create and upload the module artifacts
displayName: Upload the module artifact
condition: succeeded()
- stage: Compliance
Expand Down
50 changes: 19 additions & 31 deletions .ci/ci_release.yml
Expand Up @@ -48,35 +48,25 @@ stages:
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
Write-Verbose -Verbose "Install PowerShellGet V3 to temp module path"
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.0-beta10 -AllowPrerelease -Force
Write-Verbose -Verbose "Install PlatyPS to temp module path"
Save-Module -Name "platyPS" -Path $modulePath -Force
Write-Verbose -Verbose "Install PSScriptAnalyzer to temp module path"
Save-Module -Name "PSScriptAnalyzer" -Path $modulePath -RequiredVersion 1.18.0 -Force
Write-Verbose -Verbose "Install Pester 4.X to temp module path"
Save-Module -Name "Pester" -MaximumVersion 4.99 -Path $modulePath -Force
Write-Verbose -Verbose "Install PSPackageProject to temp module path"
Save-Module -Name PSPackageProject -Path $modulePath -Force
displayName: Install PSPackageProject and dependencies
Save-Module -Name PowerShellGet -Path $modulePath -MinimumVersion 3.0.18-beta18 -AllowPrerelease -Force
displayName: Install PowerShellGetV3
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
Import-Module -Name $modPath -Force
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release
displayName: Build and publish artifact
displayName: Build module
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
Import-Module -Name $modPath -Force
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$config = Get-PSPackageProjectConfiguration
$config = Get-BuildConfiguration
$signSrcPath = "$($config.BuildOutputPath)\$($config.ModuleName)"
$signOutPath = "$($config.SignedOutputPath)\$($config.ModuleName)"
if (! (Test-Path -Path $signOutPath)) {
Expand All @@ -92,7 +82,7 @@ stages:
$vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: Set signing path variables for possible module code signing
displayName: Set signing path variables for module code signing
- pwsh: |
Get-ChildItem -Path env:
Expand Down Expand Up @@ -122,9 +112,8 @@ stages:
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
Import-Module -Name $modPath -Force
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
if ($env:SkipSigning -eq 'True')
{
Expand All @@ -134,16 +123,16 @@ stages:
{
$(Build.SourcesDirectory)/build.ps1 -Publish -Signed
}
displayName: Create module artifact
displayName: Publish module nuget package and upload package artifact
condition: succeeded()
- pwsh: |
# $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
# $env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
# $modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
# Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
# Import-Module -Name $modPath -Force
# Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
# Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
# #
# $config = Get-PSPackageProjectConfiguration
# $config = Get-BuildConfiguration
# $signSrcPath = Resolve-Path -Path "$($config.BuildOutputPath)"
# $signOutPath = "$($config.SignedOutputPath)\RefAssemblyNuGet"
# if (! (Test-Path -Path $signOutPath)) {
Expand Down Expand Up @@ -176,11 +165,10 @@ stages:
- pwsh: |
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
Import-Module -Name $modPath -Force
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$config = Get-PSPackageProjectConfiguration
$config = Get-BuildConfiguration
if ($env:SkipSigning -eq 'True')
{
$srcModulePath = Resolve-Path -Path "$($config.BuildOutputPath)/$($config.ModuleName)"
Expand Down

0 comments on commit 47bc3b7

Please sign in to comment.