Update pwsh style to latest community standards #52

Merged
OCram85 merged 19 commits from rework2022 into master 2022-06-28 08:56:33 +02:00
2 changed files with 54 additions and 36 deletions
Showing only changes of commit 10679ecd23 - Show all commits

View File

@ -11,18 +11,32 @@ steps:
- name: Environments - name: Environments
image: mcr.microsoft.com/powershell:latest image: mcr.microsoft.com/powershell:latest
commands: commands:
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1' -Verbose; Invoke-ShowEnv -Verbose}" - |
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1' -Verbose; Invoke-InstallDependencies -Verbose}" pwsh -NonInteractive -c "& {
Import-Module './tools/DroneIO.psm1' -Verbose;
Invoke-ShowEnv -Verbose
}"
- name: LintTests - name: LintTests
image: mcr.microsoft.com/powershell:latest image: mcr.microsoft.com/powershell:latest
commands: commands:
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1'; Invoke-InstallDependencies}" - |
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1'; Invoke-Linter}" pwsh -NonInteractive -c "& {
Import-Module './tools/DroneIO.psm1';
Invoke-InstallDependencies;
Invoke-Linter
}"
- name: UnitTests - name: UnitTests
image: mcr.microsoft.com/powershell:latest image: mcr.microsoft.com/powershell:latest
commands: commands:
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1'; Invoke-InstallDependencies}" - |
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1'; Invoke-UnitTests}" pwsh -NonInteractive -c "& {
Import-Module './tools/DroneIO.psm1';
Invoke-InstallDependencies;
Invoke-UnitTest
}"
- name: coverage - name: coverage
image: plugins/codecov image: plugins/codecov
settings: settings:
@ -30,29 +44,3 @@ steps:
from_secret: CodeCovToken from_secret: CodeCovToken
files: files:
- coverage.xml - coverage.xml
---
kind: pipeline
type: docker
name: WINDOWS_PWSH7_Build
platform:
os: linux
arch: amd64
steps:
- name: Environments
image: mcr.microsoft.com/powershell:lts-windowsservercore-ltsc2022
commands:
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1' -Verbose; Invoke-ShowEnv -Verbose}"
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1' -Verbose; Invoke-InstallDependencies -Verbose}"
- name: LintTests
image: mcr.microsoft.com/powershell:lts-windowsservercore-ltsc2022
commands:
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1'; Invoke-InstallDependencies}"
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1'; Invoke-Linter}"
- name: UnitTests
image: mcr.microsoft.com/powershell:lts-windowsservercore-ltsc2022
commands:
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1'; Invoke-InstallDependencies}"
- pwsh -NonInteractive -c "& {Import-Module './tools/DroneIO.psm1'; Invoke-UnitTests}"

View File

@ -30,11 +30,41 @@ function Invoke-InstallDependencies {
param () param ()
process { process {
$ErrorActionPreference = 'Stop'
try { try {
Install-Module -Name 'PSScriptAnalyzer' -Scope CurrentUser -RequiredVersion '1.19.1' -Force -SkipPublisherCheck -AllowClobber -Verbose:$VerbosePreference -ErrorAction 'Stop' $ParamsPSScript = @{
Install-Module -Name 'Pester' -Scope CurrentUser -RequiredVersion '4.10.1' -Force -SkipPublisherCheck -AllowClobber -Verbose:$VerbosePreference -ErrorAction 'Stop' Name = 'PSScriptAnalyzer'
Install-Module -Name 'posh-git' -Scope CurrentUser -RequiredVersion '0.7.3' -Force -SkipPublisherCheck -AllowClobber -Verbose:$VerbosePreference -ErrorAction 'Stop' Scope = 'CurrentUser'
Install-Module -Name 'PSCoverage' -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber -RequiredVersion '1.2.108' -Verbose:$VerbosePreference -ErrorAction 'Stop' RequiredVersion = '1.20.0'
Force = $true
SkipPublisherCheck = $true
AllowClobber = $true
Verbose = $VerbosePreference
}
Install-Module @ParamsPSScript
$ParamsPester = @{
Name = 'Pester'
Scope = 'CurrentUser'
RequiredVersion = '5.3.3'
Force = $true
SkipPublisherCheck = $true
AllowClobber = $true
Verbose = $VerbosePreference
}
Install-Module @ParamsPester
$ParamsPosh = @{
Name = 'posh-git'
Scope = 'CurrentUser'
RequiredVersion = '1.1.0'
Force = $true
SkipPublisherCheck = $true
AllowClobber = $true
Verbose = $VerbosePreference
#ErrorAction = 'Stop'
}
Install-Module @ParamsPosh
} }
catch { catch {
$ExceParams = @{ $ExceParams = @{