forked from OCram85/PSCredentialStore
adds DroneHelper (#61)
#### 📖 Summary - adds DroneHelper for build pipeline #### 📑 Test Plan > 💡 Select your test plan for the code changes. - [x] Tested via Drone.io pipeline - [ ] Custom test - [ ] No test plan ##### Details / Justification <!-- Add your test details or justification for missing tests here. --> #### 📚 Additional Notes - FileLint / Lint & Pester issues will be fixed in next PR Co-authored-by: OCram85 <marco.blessing@googlemail.com> Reviewed-on: OCram85/PSCredentialStore#61
This commit is contained in:
parent
d4b00a5308
commit
d0b7e53c80
159
.drone.yml
159
.drone.yml
@ -1,64 +1,151 @@
|
|||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: PWSH_LTS_7.2_Ubuntu-focal
|
name: "Build Pipeline"
|
||||||
|
|
||||||
platform:
|
trigger:
|
||||||
os: linux
|
branch:
|
||||||
arch: amd64
|
exclude:
|
||||||
|
- droneDocs/*
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Environments
|
- name: "Pwsh FileLinter"
|
||||||
image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal
|
image: mcr.microsoft.com/dotnet/sdk:6.0-focal
|
||||||
|
failure: ignore
|
||||||
|
environment:
|
||||||
|
EXCLUDE: "(.exe|.dll|.ico|.gitkeep|Vendor|.Tests.ps1)"
|
||||||
commands:
|
commands:
|
||||||
|
- |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y file
|
||||||
|
|
||||||
- |
|
- |
|
||||||
pwsh -NonInteractive -c "& {
|
pwsh -NonInteractive -c "& {
|
||||||
Import-Module './tools/DroneIO.psm1' -Verbose;
|
Install-Module -Name 'DroneHelper' -Repository 'PSGallery' -ErrorAction 'Stop' -AllowPrerelease -Force;
|
||||||
Invoke-ShowEnv -Verbose
|
Import-Module 'DroneHelper' -ErrorAction 'Stop';
|
||||||
|
Invoke-FileLinter -Verbose -Debug
|
||||||
}"
|
}"
|
||||||
|
|
||||||
- name: LintTests
|
- name: "ScriptAnalyzer"
|
||||||
image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal
|
image: mcr.microsoft.com/dotnet/sdk:6.0-focal
|
||||||
failure: ignore
|
failure: ignore
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
pwsh -NonInteractive -c "& {
|
pwsh -NonInteractive -c "& {
|
||||||
Import-Module './tools/DroneIO.psm1';
|
Install-Module -Name 'DroneHelper' -Repository 'PSGallery' -ErrorAction 'Stop' -AllowPrerelease -Force;
|
||||||
Invoke-InstallDependencies;
|
Import-Module -Name 'DroneHelper' -ErrorAction 'Stop';
|
||||||
Invoke-Linter -ErrorAction 'Stop'
|
Install-ModuleDependency;
|
||||||
|
Invoke-Linter
|
||||||
}"
|
}"
|
||||||
|
|
||||||
- name: UnitTests
|
- name: "Pester"
|
||||||
image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal
|
image: mcr.microsoft.com/dotnet/sdk:6.0-focal
|
||||||
failure: ignore
|
failure: ignore
|
||||||
commands:
|
commands:
|
||||||
|
- |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y file
|
||||||
|
|
||||||
- |
|
- |
|
||||||
pwsh -NonInteractive -c "& {
|
pwsh -NonInteractive -c "& {
|
||||||
Import-Module './tools/DroneIO.psm1';
|
Install-Module -Name 'DroneHelper' -Repository 'PSGallery' -ErrorAction 'Stop' -AllowPrerelease -Force;
|
||||||
Invoke-InstallDependencies;
|
Import-Module -Name 'DroneHelper' -ErrorAction 'Stop';
|
||||||
Invoke-UnitTest -Verbosity 'Normal' -ExcludeTag @( 'Integration', 'Disabled') -ErrorAction 'Stop'
|
Install-ModuleDependency;
|
||||||
|
Invoke-UnitTest -Verbosity 'Detailed' -ExcludeTag 'Integration'
|
||||||
}"
|
}"
|
||||||
|
|
||||||
# Disable Codecov for self hosted git
|
- name: "PRComment"
|
||||||
#- name: Coverage
|
image: mcr.microsoft.com/dotnet/sdk:6.0-focal
|
||||||
# image: plugins/codecov
|
failure: ignore
|
||||||
# settings:
|
environment:
|
||||||
# token:
|
GITEA_TOKEN:
|
||||||
# from_secret: CodeCovToken
|
from_secret: GITEA_TOKEN
|
||||||
# files:
|
CUSTOM_PIPELINE_STATE: true
|
||||||
# - coverage.xml
|
LOG_FILES: "build/*.log"
|
||||||
# depends_on:
|
|
||||||
# - UnitTests
|
|
||||||
|
|
||||||
- name: SetPipelineState
|
|
||||||
image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal
|
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
pwsh -NonInteractive -c "& {
|
pwsh -NonInteractive -c "& {
|
||||||
Import-Module './tools/DroneIO.psm1';
|
Install-Module -Name 'DroneHelper' -Repository 'PSGallery' -ErrorAction 'Stop' -AllowPrerelease -Force;
|
||||||
Invoke-BuildState -ErrorAction 'Stop'
|
Import-Module -Name 'DroneHelper' -ErrorAction 'Stop';
|
||||||
|
Send-PRComment
|
||||||
|
}"
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
include:
|
||||||
|
- pull_request
|
||||||
|
depends_on:
|
||||||
|
- "Pwsh FileLinter"
|
||||||
|
- "ScriptAnalyzer"
|
||||||
|
- "Pester"
|
||||||
|
|
||||||
|
- name: "buildState"
|
||||||
|
image: mcr.microsoft.com/dotnet/sdk:6.0-focal
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
pwsh -NonInteractive -c "& {
|
||||||
|
Install-Module -Name 'DroneHelper' -Repository 'PSGallery' -ErrorAction 'Stop' -AllowPrerelease -Force;
|
||||||
|
Import-Module -Name 'DroneHelper' -ErrorAction 'Stop';
|
||||||
|
Install-ModuleDependency;
|
||||||
|
Invoke-BuildState
|
||||||
}"
|
}"
|
||||||
depends_on:
|
depends_on:
|
||||||
- LintTests
|
- "PRComment"
|
||||||
- UnitTests
|
|
||||||
#- Coverage
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: "Publish Pipeline"
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- "Build Pipeline"
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: BuildArtifacts
|
||||||
|
image: mcr.microsoft.com/dotnet/sdk:6.0-focal
|
||||||
|
#failure: ignore
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
pwsh -NonInteractive -c "& {
|
||||||
|
Install-Module -Name 'DroneHelper' -Repository 'PSGallery' -ErrorAction 'Stop' -AllowPrerelease -Force;
|
||||||
|
Import-Module -Name 'DroneHelper' -ErrorAction 'Stop';
|
||||||
|
Install-ModuleDependency;
|
||||||
|
Update-ModuleMeta -Verbose
|
||||||
|
}"
|
||||||
|
- |
|
||||||
|
pwsh -NonInteractive -c "& {
|
||||||
|
Install-Module -Name 'DroneHelper' -Repository 'PSGallery' -ErrorAction 'Stop' -AllowPrerelease -Force;
|
||||||
|
Import-Module -Name 'DroneHelper' -ErrorAction 'Stop';
|
||||||
|
Install-ModuleDependency;
|
||||||
|
New-BuildPackage -Verbose
|
||||||
|
}"
|
||||||
|
|
||||||
|
- name: GiteaRelease
|
||||||
|
image: plugins/gitea-release
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: GITEA_TOKEN
|
||||||
|
base_url: https://gitea.ocram85.com
|
||||||
|
files:
|
||||||
|
- "bin/${DRONE_REPO_NAME}.zip"
|
||||||
|
- "bin/PSModule.zip"
|
||||||
|
title: "${DRONE_TAG}"
|
||||||
|
note: CHANGELOG.md
|
||||||
|
|
||||||
|
- name: "PublishModule"
|
||||||
|
image: mcr.microsoft.com/dotnet/sdk:6.0-focal
|
||||||
|
#failure: ignore
|
||||||
|
environment:
|
||||||
|
NuGetToken:
|
||||||
|
from_secret: PSGallery
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
pwsh -NonInteractive -c "& {
|
||||||
|
Install-Module -Name 'DroneHelper' -Repository 'PSGallery' -ErrorAction 'Stop' -AllowPrerelease -Force;
|
||||||
|
Import-Module -Name 'DroneHelper' -ErrorAction 'Stop';
|
||||||
|
Install-ModuleDependency;
|
||||||
|
Invoke-Publish -Verbose
|
||||||
|
}"
|
||||||
|
0
build/.gitkeep
Normal file
0
build/.gitkeep
Normal file
139
resources/PSScriptAnalyzerSettings.psd1
Normal file
139
resources/PSScriptAnalyzerSettings.psd1
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
@{
|
||||||
|
Severity = 'Error', 'Warning', 'Information'
|
||||||
|
|
||||||
|
IncludeRules = @(
|
||||||
|
'PSAlignAssignmentStatement',
|
||||||
|
'PSAvoidAssignmentToAutomaticVariable',
|
||||||
|
'AvoidDefaultValueForMandatoryParameter',
|
||||||
|
'PSAvoidDefaultValueSwitchParameter',
|
||||||
|
'PSAvoidGlobalAliases',
|
||||||
|
'ÜSAvoidGlobalFunctions',
|
||||||
|
'PSAvoidGlobalVars',
|
||||||
|
'PSAvoidInvokingEmptyMembers',
|
||||||
|
'PSAvoidLongLines',
|
||||||
|
'PSAvoidNullOrEmptyHelpMessageAttribute',
|
||||||
|
'PSAvoidOverwritingBuiltInCmdlets',
|
||||||
|
'PSAvoidShouldContinueWithoutForce',
|
||||||
|
'PSAvoidTrailingWhitespace',
|
||||||
|
'PSAvoidUsingCmdletAliases',
|
||||||
|
'PSAvoidUsingComputerNameHardcoded',
|
||||||
|
'PSAvoidUsingConvertToSecureStringWithPlainText',
|
||||||
|
'PSAvoidUsingDeprecatedManifestFields',
|
||||||
|
'PSAvoidUsingDoubleQuotesForConstantString',
|
||||||
|
'PSAvoidUsingEmptyCatchBlock',
|
||||||
|
'PSAvoidUsingInvokeExpression',
|
||||||
|
'PSAvoidUsingPlainTextForPassword',
|
||||||
|
'PSAvoidUsingPositionalParameters',
|
||||||
|
'PSAvoidUsingUsernameAndPasswordParams',
|
||||||
|
'PSAvoidUsingWMICmdlet',
|
||||||
|
'PSAvoidUsingWriteHost',
|
||||||
|
'PSMisleadingBacktick',
|
||||||
|
'PSMissingModuleManifestField',
|
||||||
|
'PSPlaceCloseBrace',
|
||||||
|
'PSPlaceOpenBrace',
|
||||||
|
'PSPossibleIncorrectComparisonWithNull',
|
||||||
|
'PSPossibleIncorrectUsageOfAssignmentOperator',
|
||||||
|
'PSPossibleIncorrectUsageOfRedirectionOperator',
|
||||||
|
'PSProvideCommentHelp',
|
||||||
|
'PSReservedCmdletChar',
|
||||||
|
'PSReservedParams',
|
||||||
|
'PSReviewUnusedParameter',
|
||||||
|
'PSShouldProcess',
|
||||||
|
'PSUseApprovedVerbs',
|
||||||
|
'PSUseBOMForUnicodeEncodedFile',
|
||||||
|
'PSUseCmdletCorrectly',
|
||||||
|
'PSUseCompatibleCmdlets',
|
||||||
|
#'PSUseCompatibleCommands',
|
||||||
|
'PSUseCompatibleSyntax',
|
||||||
|
#'PSUseCompatibleTypes',
|
||||||
|
'PSUseConsistentIndentation',
|
||||||
|
'PSUseConsistentWhitespace',
|
||||||
|
'PSUseCorrectCasing',
|
||||||
|
'PSUseDeclaredVarsMoreThanAssignments',
|
||||||
|
'PSUseLiteralInitializerForHashtable',
|
||||||
|
'PSUseOutputTypeCorrectly',
|
||||||
|
'PSUsePSCredentialType',
|
||||||
|
'PSUseProcessBlockForPipelineCommand',
|
||||||
|
'PSUseShouldProcessForStateChangingFunctions',
|
||||||
|
'PSUseSingularNouns',
|
||||||
|
'PSUseSupportsShouldProcess',
|
||||||
|
'PSUseToExportFieldsInManifest',
|
||||||
|
'PSUseUTF8EncodingForHelpFile',
|
||||||
|
'PSUseUsingScopeModifierInNewRunspaces'
|
||||||
|
)
|
||||||
|
|
||||||
|
Rules = @{
|
||||||
|
|
||||||
|
PSAvoidLongLines = @{
|
||||||
|
Enable = $true
|
||||||
|
MaximumLineLength = 116
|
||||||
|
}
|
||||||
|
|
||||||
|
PSPlaceOpenBrace = @{
|
||||||
|
Enable = $true
|
||||||
|
OnSameLine = $true
|
||||||
|
NewLineAfter = $true
|
||||||
|
IgnoreOneLineBlock = $true
|
||||||
|
}
|
||||||
|
|
||||||
|
PSPlaceCloseBrace = @{
|
||||||
|
Enable = $true
|
||||||
|
NewLineAfter = $true
|
||||||
|
IgnoreOneLineBlock = $true
|
||||||
|
NoEmptyLineBefore = $false
|
||||||
|
}
|
||||||
|
|
||||||
|
PSProvideCommentHelp = @{
|
||||||
|
Enable = $true
|
||||||
|
ExportedOnly = $false
|
||||||
|
BlockComment = $true
|
||||||
|
VSCodeSnippetCorrection = $false
|
||||||
|
Placement = "begin"
|
||||||
|
}
|
||||||
|
|
||||||
|
PSUseCompatibleCmdlets = @{
|
||||||
|
compatibility = @(
|
||||||
|
"desktop-5.1.14393.206-windows",
|
||||||
|
"core-6.1.0-windows"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
PSUseCompatibleSyntax = @{
|
||||||
|
Enable = $true
|
||||||
|
TargetVersions = @(
|
||||||
|
"7.0",
|
||||||
|
"5.1"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
PSUseConsistentIndentation = @{
|
||||||
|
Enable = $true
|
||||||
|
Kind = 'space'
|
||||||
|
PipelineIndentation = 'IncreaseIndentationForFirstPipeline'
|
||||||
|
IndentationSize = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
PSUseConsistentWhitespace = @{
|
||||||
|
Enable = $true
|
||||||
|
CheckInnerBrace = $true
|
||||||
|
CheckOpenBrace = $true
|
||||||
|
CheckOpenParen = $true
|
||||||
|
CheckOperator = $true
|
||||||
|
CheckPipe = $true
|
||||||
|
CheckPipeForRedundantWhitespace = $false
|
||||||
|
CheckSeparator = $true
|
||||||
|
CheckParameter = $false
|
||||||
|
IgnoreAssignmentOperatorInsideHashTable = $true
|
||||||
|
}
|
||||||
|
|
||||||
|
PSAlignAssignmentStatement = @{
|
||||||
|
Enable = $true
|
||||||
|
CheckHashtable = $false
|
||||||
|
}
|
||||||
|
|
||||||
|
PSUseCorrectCasing = @{
|
||||||
|
Enable = $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -142,5 +142,4 @@ Describe "New-CredentialStoreItem" {
|
|||||||
$writtenItem.GetNetworkCredential().Password | Should -Be 'mypasswd'
|
$writtenItem.GetNetworkCredential().Password | Should -Be 'mypasswd'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user