Fix drone build pipeline #1

Merged
OCram85 merged 9 commits from DroneTest into master 2022-07-13 16:19:34 +02:00
2 changed files with 80 additions and 0 deletions
Showing only changes of commit 68b1e61b69 - Show all commits

View File

@ -17,6 +17,8 @@ steps:
commands: commands:
- | - |
pwsh -NonInteractive -c "& { pwsh -NonInteractive -c "& {
Import-Module './tools/DevDependency.psm1' -ErrorAction 'Stop';
Invoke-FixDevDependency;
Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop'; Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop';
Invoke-FileLinter Invoke-FileLinter
}" }"
@ -27,6 +29,8 @@ steps:
commands: commands:
- | - |
pwsh -NonInteractive -c "& { pwsh -NonInteractive -c "& {
Import-Module './tools/DevDependency.psm1' -ErrorAction 'Stop';
Invoke-FixDevDependency;
Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop'; Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop';
Invoke-Linter Invoke-Linter
}" }"
@ -37,6 +41,8 @@ steps:
commands: commands:
- | - |
pwsh -NonInteractive -c "& { pwsh -NonInteractive -c "& {
Import-Module './tools/DevDependency.psm1' -ErrorAction 'Stop';
Invoke-FixDevDependency;
Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop'; Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop';
Invoke-UnitTest -ExcludeTag 'Integration' Invoke-UnitTest -ExcludeTag 'Integration'
}" }"
@ -52,6 +58,8 @@ steps:
commands: commands:
- | - |
pwsh -NonInteractive -c "& { pwsh -NonInteractive -c "& {
Import-Module './tools/DevDependency.psm1' -ErrorAction 'Stop';
Invoke-FixDevDependency;
Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop'; Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop';
Send-PRComment Send-PRComment
}" }"
@ -65,6 +73,8 @@ steps:
commands: commands:
- | - |
pwsh -NonInteractive -c "& { pwsh -NonInteractive -c "& {
Import-Module './tools/DevDependency.psm1' -ErrorAction 'Stop';
Invoke-FixDevDependency;
Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop'; Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop';
Invoke-BuildState Invoke-BuildState
}" }"
@ -88,11 +98,15 @@ steps:
commands: commands:
- | - |
pwsh -NonInteractive -c "& { pwsh -NonInteractive -c "& {
Import-Module './tools/DevDependency.psm1' -ErrorAction 'Stop';
Invoke-FixDevDependency;
Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop'; Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop';
Update-ModuleMeta -Verbose Update-ModuleMeta -Verbose
}" }"
- | - |
pwsh -NonInteractive -c "& { pwsh -NonInteractive -c "& {
Import-Module './tools/DevDependency.psm1' -ErrorAction 'Stop';
Invoke-FixDevDependency;
Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop'; Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop';
New-BuildPackage -AdditionalPath './src/Rules' -Verbose New-BuildPackage -AdditionalPath './src/Rules' -Verbose
}" }"
@ -117,6 +131,8 @@ steps:
commands: commands:
- | - |
pwsh -NonInteractive -c "& { pwsh -NonInteractive -c "& {
Import-Module './tools/DevDependency.psm1' -ErrorAction 'Stop';
Invoke-FixDevDependency;
Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop'; Import-Module './src/DroneHelper.psd1' -ErrorAction 'Stop';
Invoke-Publish -Verbose Invoke-Publish -Verbose
}" }"

64
tools/DevDependency.psm1 Normal file
View File

@ -0,0 +1,64 @@
function Invoke-FixDevDependency {
<#
.SYNOPSIS
Installs dev dependencies.
.DESCRIPTION
Invoke-FixDevDependency acts as workaround to load the dependencies needed to load the pwsh module.
This is just standalone version of the embedded `Invoke-InstallDependency` which can't be called
by the DroneHelper build pipeline itself.
#>
[CmdletBinding()]
param ()
process {
try {
$PSScriptParams = @{
Name = 'PSScriptAnalyzer'
Scope = 'CurrentUser'
RequiredVersion = '1.20.0'
Force = $true
SkipPublisherCheck = $true
AllowClobber = $true
Verbose = $VerbosePreference
ErrorAction = 'Stop'
}
Install-Module @PSScriptParams
$PesterParams = @{
Name = 'Pester'
Scope = 'CurrentUser'
RequiredVersion = '5.3.1'
Force = $true
SkipPublisherCheck = $true
AllowClobber = $true
Verbose = $VerbosePreference
ErrorAction = 'Stop'
}
Install-Module @PesterParams
$PoshParams = @{
Name = 'posh-git'
Scope = 'CurrentUser'
RequiredVersion = '1.1.0'
Force = $true
SkipPublisherCheck = $true
AllowClobber = $true
Verbose = $VerbosePreference
ErrorAction = 'Stop'
}
Install-Module @PoshParams
}
catch {
$ExecParams = @{
Exception = [System.Exception]::new(
'Could not install required build dependencies!',
$PSItem.Exception
)
ErrorAction = 'Stop'
}
Write-Error @ExecParams
}
}
}