diff --git a/.github/linters/.powershell-psscriptanalyzer.psd1 b/.github/linters/.powershell-psscriptanalyzer.psd1 index 6779d06f..40d11d60 100644 --- a/.github/linters/.powershell-psscriptanalyzer.psd1 +++ b/.github/linters/.powershell-psscriptanalyzer.psd1 @@ -8,6 +8,7 @@ #) #IncludeDefaultRules=${true} ExcludeRules = @( + 'PSMissingModuleManifestField' 'PSAvoidUsingWriteHost' ) #IncludeRules = @( diff --git a/.github/workflows/Auto-Release.yml b/.github/workflows/Auto-Release.yml index a8f1413e..ec157c9d 100644 --- a/.github/workflows/Auto-Release.yml +++ b/.github/workflows/Auto-Release.yml @@ -1,6 +1,6 @@ name: Auto-Release -run-name: "${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }} by @${{ github.actor }}" +run-name: "Auto-Release - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}" on: pull_request_target: diff --git a/.github/workflows/Linter.yml b/.github/workflows/Linter.yml index 02f8fbac..5c9f300c 100644 --- a/.github/workflows/Linter.yml +++ b/.github/workflows/Linter.yml @@ -1,6 +1,6 @@ name: Linter -run-name: "${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }} by @${{ github.actor }}" +run-name: "Linter - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}" on: [pull_request] diff --git a/.github/workflows/Workflow-Test-Default.yml b/.github/workflows/Workflow-Test-Default.yml index 4c86d5d7..037a2f17 100644 --- a/.github/workflows/Workflow-Test-Default.yml +++ b/.github/workflows/Workflow-Test-Default.yml @@ -1,6 +1,6 @@ name: Workflow-Test [Default] -run-name: "${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }} by @${{ github.actor }}" +run-name: "Workflow-Test [Default] - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}" on: [pull_request] diff --git a/.github/workflows/Workflow-Test-Unnamed.yml b/.github/workflows/Workflow-Test-WithManifest.yml similarity index 62% rename from .github/workflows/Workflow-Test-Unnamed.yml rename to .github/workflows/Workflow-Test-WithManifest.yml index 9653a732..b49af774 100644 --- a/.github/workflows/Workflow-Test-Unnamed.yml +++ b/.github/workflows/Workflow-Test-WithManifest.yml @@ -1,6 +1,6 @@ -name: Workflow-Test [UnnamedFolder] +name: Workflow-Test [WithManifest] -run-name: "${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }} by @${{ github.actor }}" +run-name: "Workflow-Test [WithManifest] - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}" on: [pull_request] @@ -14,12 +14,12 @@ permissions: statuses: write jobs: - WorkflowTestUnnamedFolder: + WorkflowTestWithManifest: uses: ./.github/workflows/workflow.yml secrets: inherit with: Name: PSModuleTest - Path: tests/srcNo + Path: tests/srcWithManifest ModulesOutputPath: tests/outputs/modules DocsOutputPath: tests/outputs/docs TestProcess: true diff --git a/tests/src/PSModuleTest/PSModuleTest.psd1 b/tests/src/PSModuleTest/PSModuleTest.psd1 deleted file mode 100644 index 0af4dc5d..00000000 --- a/tests/src/PSModuleTest/PSModuleTest.psd1 +++ /dev/null @@ -1,5 +0,0 @@ -@{ - ModuleVersion = '0.0.0' - RootModule = 'PSModuleTest.psm1' - PowerShellHostName = '' -} diff --git a/tests/src/PSModuleTest/PSModuleTest.psm1 b/tests/src/PSModuleTest/PSModuleTest.psm1 deleted file mode 100644 index ab67c5ef..00000000 --- a/tests/src/PSModuleTest/PSModuleTest.psm1 +++ /dev/null @@ -1,73 +0,0 @@ -[Cmdletbinding()] -param() - -Write-Verbose 'Importing subcomponents' -$Folders = 'init', 'classes', 'private', 'public' -# Import everything in these folders -Foreach ($Folder in $Folders) { - $Root = Join-Path -Path $PSScriptRoot -ChildPath $Folder - Write-Verbose "Processing folder: $Root" - if (Test-Path -Path $Root) { - Write-Verbose "Getting all files in $Root" - $Files = $null - $Files = Get-ChildItem -Path $Root -Include '*.ps1', '*.psm1' -Recurse - # dot source each file - foreach ($File in $Files) { - Write-Verbose "Importing $($File)" - Import-Module $File - Write-Verbose "Importing $($File): Done" - } - } -} - -. "$PSScriptRoot\finally.ps1" - -# Define the types to export with type accelerators. -$ExportableTypes = @( - [Book] - [BookList] -) - -# Get the internal TypeAccelerators class to use its static methods. -$TypeAcceleratorsClass = [psobject].Assembly.GetType( - 'System.Management.Automation.TypeAccelerators' -) -# Ensure none of the types would clobber an existing type accelerator. -# If a type accelerator with the same name exists, throw an exception. -$ExistingTypeAccelerators = $TypeAcceleratorsClass::Get -foreach ($Type in $ExportableTypes) { - if ($Type.FullName -in $ExistingTypeAccelerators.Keys) { - $Message = @( - "Unable to register type accelerator '$($Type.FullName)'" - 'Accelerator already exists.' - ) -join ' - ' - - throw [System.Management.Automation.ErrorRecord]::new( - [System.InvalidOperationException]::new($Message), - 'TypeAcceleratorAlreadyExists', - [System.Management.Automation.ErrorCategory]::InvalidOperation, - $Type.FullName - ) - } -} -# Add type accelerators for every exportable type. -foreach ($Type in $ExportableTypes) { - $TypeAcceleratorsClass::Add($Type.FullName, $Type) -} -# Remove type accelerators when the module is removed. -$MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = { - foreach ($Type in $ExportableTypes) { - $TypeAcceleratorsClass::Remove($Type.FullName) - } -}.GetNewClosure() - -$Param = @{ - Function = (Get-ChildItem -Path "$PSScriptRoot\public" -Include '*.ps1' -Recurse).BaseName - Variable = '*' - Cmdlet = '*' - Alias = '*' -} - -Write-Verbose 'Exporting module members' - -Export-ModuleMember @Param diff --git a/tests/src/PSModuleTest/assemblies/LsonLib.dll b/tests/src/assemblies/LsonLib.dll similarity index 100% rename from tests/src/PSModuleTest/assemblies/LsonLib.dll rename to tests/src/assemblies/LsonLib.dll diff --git a/tests/src/PSModuleTest/classes/Book.ps1 b/tests/src/classes/Book.ps1 similarity index 100% rename from tests/src/PSModuleTest/classes/Book.ps1 rename to tests/src/classes/Book.ps1 diff --git a/tests/src/PSModuleTest/data/Config.psd1 b/tests/src/data/Config.psd1 similarity index 100% rename from tests/src/PSModuleTest/data/Config.psd1 rename to tests/src/data/Config.psd1 diff --git a/tests/src/PSModuleTest/data/Settings.psd1 b/tests/src/data/Settings.psd1 similarity index 100% rename from tests/src/PSModuleTest/data/Settings.psd1 rename to tests/src/data/Settings.psd1 diff --git a/tests/src/PSModuleTest/finally.ps1 b/tests/src/finally.ps1 similarity index 100% rename from tests/src/PSModuleTest/finally.ps1 rename to tests/src/finally.ps1 diff --git a/tests/src/PSModuleTest/formats/CultureInfo.Format.ps1xml b/tests/src/formats/CultureInfo.Format.ps1xml similarity index 100% rename from tests/src/PSModuleTest/formats/CultureInfo.Format.ps1xml rename to tests/src/formats/CultureInfo.Format.ps1xml diff --git a/tests/src/PSModuleTest/formats/Mygciview.Format.ps1xml b/tests/src/formats/Mygciview.Format.ps1xml similarity index 100% rename from tests/src/PSModuleTest/formats/Mygciview.Format.ps1xml rename to tests/src/formats/Mygciview.Format.ps1xml diff --git a/tests/src/PSModuleTest/header.ps1 b/tests/src/header.ps1 similarity index 100% rename from tests/src/PSModuleTest/header.ps1 rename to tests/src/header.ps1 diff --git a/tests/src/PSModuleTest/init/initializer.ps1 b/tests/src/init/initializer.ps1 similarity index 100% rename from tests/src/PSModuleTest/init/initializer.ps1 rename to tests/src/init/initializer.ps1 diff --git a/tests/src/PSModuleTest/modules/OtherPSModule.psm1 b/tests/src/modules/OtherPSModule.psm1 similarity index 100% rename from tests/src/PSModuleTest/modules/OtherPSModule.psm1 rename to tests/src/modules/OtherPSModule.psm1 diff --git a/tests/src/PSModuleTest/private/Get-InternalPSModule.ps1 b/tests/src/private/Get-InternalPSModule.ps1 similarity index 100% rename from tests/src/PSModuleTest/private/Get-InternalPSModule.ps1 rename to tests/src/private/Get-InternalPSModule.ps1 diff --git a/tests/src/PSModuleTest/private/Set-InternalPSModule.ps1 b/tests/src/private/Set-InternalPSModule.ps1 similarity index 100% rename from tests/src/PSModuleTest/private/Set-InternalPSModule.ps1 rename to tests/src/private/Set-InternalPSModule.ps1 diff --git a/tests/src/PSModuleTest/public/Get-PSModuleTest.ps1 b/tests/src/public/Get-PSModuleTest.ps1 similarity index 100% rename from tests/src/PSModuleTest/public/Get-PSModuleTest.ps1 rename to tests/src/public/Get-PSModuleTest.ps1 diff --git a/tests/srcNo/public/New-PSModuleTest.ps1 b/tests/src/public/New-PSModuleTest.ps1 similarity index 76% rename from tests/srcNo/public/New-PSModuleTest.ps1 rename to tests/src/public/New-PSModuleTest.ps1 index 7f26215f..d97e8f33 100644 --- a/tests/srcNo/public/New-PSModuleTest.ps1 +++ b/tests/src/public/New-PSModuleTest.ps1 @@ -9,6 +9,11 @@ function New-PSModuleTest { Test-PSModule -Name 'World' "Hello, World!" + + .NOTES + Testing if a module can have a [Markdown based link](https://example.com). + !"#¤%&/()=?`´^¨*'-_+§½{[]}<>|@£$€¥¢:;.," + \[This is a test\] #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSUseShouldProcessForStateChangingFunctions', '', Scope = 'Function', diff --git a/tests/src/PSModuleTest/public/Set-PSModuleTest.ps1 b/tests/src/public/Set-PSModuleTest.ps1 similarity index 100% rename from tests/src/PSModuleTest/public/Set-PSModuleTest.ps1 rename to tests/src/public/Set-PSModuleTest.ps1 diff --git a/tests/src/PSModuleTest/public/Test-PSModuleTest.ps1 b/tests/src/public/Test-PSModuleTest.ps1 similarity index 100% rename from tests/src/PSModuleTest/public/Test-PSModuleTest.ps1 rename to tests/src/public/Test-PSModuleTest.ps1 diff --git a/tests/src/PSModuleTest/scripts/loader.ps1 b/tests/src/scripts/loader.ps1 similarity index 100% rename from tests/src/PSModuleTest/scripts/loader.ps1 rename to tests/src/scripts/loader.ps1 diff --git a/tests/src/PSModuleTest/types/DirectoryInfo.Types.ps1xml b/tests/src/types/DirectoryInfo.Types.ps1xml similarity index 100% rename from tests/src/PSModuleTest/types/DirectoryInfo.Types.ps1xml rename to tests/src/types/DirectoryInfo.Types.ps1xml diff --git a/tests/src/PSModuleTest/types/FileInfo.Types.ps1xml b/tests/src/types/FileInfo.Types.ps1xml similarity index 100% rename from tests/src/PSModuleTest/types/FileInfo.Types.ps1xml rename to tests/src/types/FileInfo.Types.ps1xml diff --git a/tests/srcNo/assemblies/LsonLib.dll b/tests/srcWithManifest/assemblies/LsonLib.dll similarity index 100% rename from tests/srcNo/assemblies/LsonLib.dll rename to tests/srcWithManifest/assemblies/LsonLib.dll diff --git a/tests/srcNo/classes/Book.ps1 b/tests/srcWithManifest/classes/Book.ps1 similarity index 100% rename from tests/srcNo/classes/Book.ps1 rename to tests/srcWithManifest/classes/Book.ps1 diff --git a/tests/srcNo/data/Config.psd1 b/tests/srcWithManifest/data/Config.psd1 similarity index 100% rename from tests/srcNo/data/Config.psd1 rename to tests/srcWithManifest/data/Config.psd1 diff --git a/tests/srcNo/data/Settings.psd1 b/tests/srcWithManifest/data/Settings.psd1 similarity index 100% rename from tests/srcNo/data/Settings.psd1 rename to tests/srcWithManifest/data/Settings.psd1 diff --git a/tests/srcNo/finally.ps1 b/tests/srcWithManifest/finally.ps1 similarity index 100% rename from tests/srcNo/finally.ps1 rename to tests/srcWithManifest/finally.ps1 diff --git a/tests/srcNo/formats/CultureInfo.Format.ps1xml b/tests/srcWithManifest/formats/CultureInfo.Format.ps1xml similarity index 100% rename from tests/srcNo/formats/CultureInfo.Format.ps1xml rename to tests/srcWithManifest/formats/CultureInfo.Format.ps1xml diff --git a/tests/srcNo/formats/Mygciview.Format.ps1xml b/tests/srcWithManifest/formats/Mygciview.Format.ps1xml similarity index 100% rename from tests/srcNo/formats/Mygciview.Format.ps1xml rename to tests/srcWithManifest/formats/Mygciview.Format.ps1xml diff --git a/tests/srcNo/header.ps1 b/tests/srcWithManifest/header.ps1 similarity index 100% rename from tests/srcNo/header.ps1 rename to tests/srcWithManifest/header.ps1 diff --git a/tests/srcNo/init/initializer.ps1 b/tests/srcWithManifest/init/initializer.ps1 similarity index 100% rename from tests/srcNo/init/initializer.ps1 rename to tests/srcWithManifest/init/initializer.ps1 diff --git a/tests/srcWithManifest/manifest.psd1 b/tests/srcWithManifest/manifest.psd1 new file mode 100644 index 00000000..77348f13 --- /dev/null +++ b/tests/srcWithManifest/manifest.psd1 @@ -0,0 +1,3 @@ +@{ + Author = 'Author' +} diff --git a/tests/srcNo/modules/OtherPSModule.psm1 b/tests/srcWithManifest/modules/OtherPSModule.psm1 similarity index 100% rename from tests/srcNo/modules/OtherPSModule.psm1 rename to tests/srcWithManifest/modules/OtherPSModule.psm1 diff --git a/tests/srcNo/private/Get-InternalPSModule.ps1 b/tests/srcWithManifest/private/Get-InternalPSModule.ps1 similarity index 100% rename from tests/srcNo/private/Get-InternalPSModule.ps1 rename to tests/srcWithManifest/private/Get-InternalPSModule.ps1 diff --git a/tests/srcNo/private/Set-InternalPSModule.ps1 b/tests/srcWithManifest/private/Set-InternalPSModule.ps1 similarity index 100% rename from tests/srcNo/private/Set-InternalPSModule.ps1 rename to tests/srcWithManifest/private/Set-InternalPSModule.ps1 diff --git a/tests/srcNo/public/Get-PSModuleTest.ps1 b/tests/srcWithManifest/public/Get-PSModuleTest.ps1 similarity index 100% rename from tests/srcNo/public/Get-PSModuleTest.ps1 rename to tests/srcWithManifest/public/Get-PSModuleTest.ps1 diff --git a/tests/src/PSModuleTest/public/New-PSModuleTest.ps1 b/tests/srcWithManifest/public/New-PSModuleTest.ps1 similarity index 76% rename from tests/src/PSModuleTest/public/New-PSModuleTest.ps1 rename to tests/srcWithManifest/public/New-PSModuleTest.ps1 index 7f26215f..d97e8f33 100644 --- a/tests/src/PSModuleTest/public/New-PSModuleTest.ps1 +++ b/tests/srcWithManifest/public/New-PSModuleTest.ps1 @@ -9,6 +9,11 @@ function New-PSModuleTest { Test-PSModule -Name 'World' "Hello, World!" + + .NOTES + Testing if a module can have a [Markdown based link](https://example.com). + !"#¤%&/()=?`´^¨*'-_+§½{[]}<>|@£$€¥¢:;.," + \[This is a test\] #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSUseShouldProcessForStateChangingFunctions', '', Scope = 'Function', diff --git a/tests/srcNo/public/Set-PSModuleTest.ps1 b/tests/srcWithManifest/public/Set-PSModuleTest.ps1 similarity index 100% rename from tests/srcNo/public/Set-PSModuleTest.ps1 rename to tests/srcWithManifest/public/Set-PSModuleTest.ps1 diff --git a/tests/srcNo/public/Test-PSModuleTest.ps1 b/tests/srcWithManifest/public/Test-PSModuleTest.ps1 similarity index 100% rename from tests/srcNo/public/Test-PSModuleTest.ps1 rename to tests/srcWithManifest/public/Test-PSModuleTest.ps1 diff --git a/tests/srcNo/scripts/loader.ps1 b/tests/srcWithManifest/scripts/loader.ps1 similarity index 100% rename from tests/srcNo/scripts/loader.ps1 rename to tests/srcWithManifest/scripts/loader.ps1 diff --git a/tests/srcNo/types/DirectoryInfo.Types.ps1xml b/tests/srcWithManifest/types/DirectoryInfo.Types.ps1xml similarity index 100% rename from tests/srcNo/types/DirectoryInfo.Types.ps1xml rename to tests/srcWithManifest/types/DirectoryInfo.Types.ps1xml diff --git a/tests/srcNo/types/FileInfo.Types.ps1xml b/tests/srcWithManifest/types/FileInfo.Types.ps1xml similarity index 100% rename from tests/srcNo/types/FileInfo.Types.ps1xml rename to tests/srcWithManifest/types/FileInfo.Types.ps1xml