-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪲 [Fix]: No longer check missing module manifest fields on source code (
#46) ## Description - No longer check missing module manifest fields on source code - Adds tests for source code without module named folder, and without manifest. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [x] 🪲 [Fix] - [ ] 🩹 [Patch] - [ ]⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
- Loading branch information
1 parent
276b770
commit 1c06436
Showing
68 changed files
with
1,135 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Action-Test [Src-Default] | ||
|
||
run-name: "Action-Test [Src-Default] - ${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }} by @${{ github.actor }}" | ||
|
||
on: [pull_request] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
ActionTest: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
shell: [pwsh] | ||
include: | ||
- os: windows-latest | ||
shell: powershell | ||
name: Action-Test [Src-Default] - [${{ matrix.os }}@${{ matrix.shell }}] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Initialize environment | ||
uses: PSModule/Initialize-PSModule@main | ||
with: | ||
Shell: ${{ matrix.shell }} | ||
|
||
- name: Action-Test | ||
uses: ./ | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
Name: PSModuleTest | ||
Path: tests/src | ||
Shell: ${{ matrix.shell }} | ||
TestType: SourceCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Action-Test [Src-UnnamedFolder] | ||
|
||
run-name: "Action-Test [Src-UnnamedFolder] - ${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }} by @${{ github.actor }}" | ||
|
||
on: [pull_request] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
ActionTest: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
shell: [pwsh] | ||
include: | ||
- os: windows-latest | ||
shell: powershell | ||
name: Action-Test [Src-UnnamedFolder] - [${{ matrix.os }}@${{ matrix.shell }}] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Initialize environment | ||
uses: PSModule/Initialize-PSModule@main | ||
with: | ||
Shell: ${{ matrix.shell }} | ||
|
||
- name: Action-Test | ||
uses: ./ | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
Name: PSModuleTest | ||
Path: tests/srcNo | ||
Shell: ${{ matrix.shell }} | ||
TestType: SourceCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Action-Test [Src-UnnamedWithManifest] | ||
|
||
run-name: "Action-Test [Src-UnnamedWithManifest] - ${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }} by @${{ github.actor }}" | ||
|
||
on: [pull_request] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
ActionTest: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
shell: [pwsh] | ||
include: | ||
- os: windows-latest | ||
shell: powershell | ||
name: Action-Test [Src-UnnamedWithManifest] - [${{ matrix.os }}@${{ matrix.shell }}] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Initialize environment | ||
uses: PSModule/Initialize-PSModule@main | ||
with: | ||
Shell: ${{ matrix.shell }} | ||
|
||
- name: Action-Test | ||
uses: ./ | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
Name: PSModuleTest | ||
Path: tests/srcNoWithManifest | ||
Shell: ${{ matrix.shell }} | ||
TestType: SourceCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Action-Test [outputs] | ||
|
||
run-name: "Action-Test [outputs] - ${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }} by @${{ github.actor }}" | ||
|
||
on: [pull_request] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
ActionTest: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
shell: [pwsh] | ||
include: | ||
- os: windows-latest | ||
shell: powershell | ||
name: Action-Test [outputs] - [${{ matrix.os }}@${{ matrix.shell }}] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Initialize environment | ||
uses: PSModule/Initialize-PSModule@main | ||
with: | ||
Shell: ${{ matrix.shell }} | ||
|
||
- name: Action-Test | ||
uses: ./ | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
Name: PSModuleTest | ||
Path: tests/outputs/modules | ||
Shell: ${{ matrix.shell }} | ||
TestType: Module |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@{ | ||
ModuleVersion = '0.0.0' | ||
RootModule = 'PSModuleTest.psm1' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
[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 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Write-Verbose '------------------------------' -Verbose | ||
Write-Verbose '--- THIS IS A LAST LOADER ---' -Verbose | ||
Write-Verbose '------------------------------' -Verbose | ||
|
||
$MyInvocation | ConvertTo-Json |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Write-Verbose '-------------------------------' -Verbose | ||
Write-Verbose '--- THIS IS AN INITIALIZER ---' -Verbose | ||
Write-Verbose '-------------------------------' -Verbose | ||
|
||
$MyInvocation | ConvertTo-Json |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#Requires -Modules @{ModuleName='PSSemVer'; ModuleVersion='1.0'} | ||
|
||
function New-PSModuleTest { | ||
<# | ||
.SYNOPSIS | ||
Performs tests on a module. | ||
.EXAMPLE | ||
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', | ||
Justification = 'Reason for suppressing' | ||
)] | ||
[CmdletBinding()] | ||
param ( | ||
# Name of the person to greet. | ||
[Parameter(Mandatory)] | ||
[string] $Name | ||
) | ||
Write-Output "Hello, $Name!" | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Write-Verbose '-------------------------' -Verbose | ||
Write-Verbose '--- THIS IS A LOADER ---' -Verbose | ||
Write-Verbose '-------------------------' -Verbose | ||
|
||
$MyInvocation | ConvertTo-Json |
File renamed without changes.
File renamed without changes.
Binary file not shown.
Oops, something went wrong.