From fa46000f4c7cb7f7176e7af629605d0962a17fd3 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 20:38:11 +0100 Subject: [PATCH 01/14] Move test data to PSModuleTest --- .github/workflows/Action-Test.yml | 30 ++++++++++++++++--------- outputs/module/PSModule/PSModule.psd1 | 27 ---------------------- outputs/module/PSModule/PSModule.psm1 | 18 --------------- src/PSModule/PSModule.psd1 | 6 ----- src/PSModule/PSModule.psm1 | 32 --------------------------- src/PSModule/public/Test-PSModule.ps1 | 18 --------------- tests/PSModule.Tests.ps1.ps1 | 11 --------- 7 files changed, 20 insertions(+), 122 deletions(-) delete mode 100644 outputs/module/PSModule/PSModule.psd1 delete mode 100644 outputs/module/PSModule/PSModule.psm1 delete mode 100644 src/PSModule/PSModule.psd1 delete mode 100644 src/PSModule/PSModule.psm1 delete mode 100644 src/PSModule/public/Test-PSModule.ps1 delete mode 100644 tests/PSModule.Tests.ps1.ps1 diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index c0310a6f..19e73e85 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -8,20 +8,30 @@ jobs: ActionTestSrc: strategy: matrix: - path: [src, outputs/module] + path: [tests/src, tests/outputs/modules] name: Action-Test - [${{ matrix.path }}] runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v4 - - name: Initialize environment - uses: PSModule/Initialize-PSModule@main - - - name: Action-Test - uses: ./ - env: - GITHUB_TOKEN: ${{ github.token }} + - name: Checkout test repo + uses: actions/checkout@v4 with: - Name: PSModule - Path: ${{ matrix.path }} + repository: PSModule/PSModuleTest + + - name: Copy test data + shell: pwsh + run: | + Get-ChildItem -Path ${{ matrix.path }} | Select-Object -ExpandProperty FullName + + # - name: Initialize environment + # uses: PSModule/Initialize-PSModule@main + + # - name: Action-Test + # uses: ./ + # env: + # GITHUB_TOKEN: ${{ github.token }} + # with: + # Name: PSModule + # Path: ${{ matrix.path }} diff --git a/outputs/module/PSModule/PSModule.psd1 b/outputs/module/PSModule/PSModule.psd1 deleted file mode 100644 index 87f983b3..00000000 --- a/outputs/module/PSModule/PSModule.psd1 +++ /dev/null @@ -1,27 +0,0 @@ -@{ - RootModule = 'PSModule.psm1' - ModuleVersion = '0.0.1' - CompatiblePSEditions = 'Core', 'Desktop' - GUID = '567bd93a-a0d5-4715-8cdf-6b5089d73065' - Author = 'PSModule' - CompanyName = 'PSModule' - Copyright = '(c) 2024 PSModule. All rights reserved.' - Description = 'PSModule Framework Test Module' - PowerShellVersion = '7.0' - ProcessorArchitecture = 'None' - RequiredAssemblies = @() - ScriptsToProcess = @() - TypesToProcess = @() - FormatsToProcess = @() - NestedModules = @() - FunctionsToExport = 'Test-PSModule' - CmdletsToExport = @() - AliasesToExport = @() - ModuleList = @() - FileList = 'PSModule.psd1', 'PSModule.psm1' - PrivateData = @{ - PSData = @{ - Tags = 'PSEdition_Desktop', 'PSEdition_Core' - } - } -} diff --git a/outputs/module/PSModule/PSModule.psm1 b/outputs/module/PSModule/PSModule.psm1 deleted file mode 100644 index 131dcffb..00000000 --- a/outputs/module/PSModule/PSModule.psm1 +++ /dev/null @@ -1,18 +0,0 @@ -Function Test-PSModule { - <# - .SYNOPSIS - Performs tests on a module. - - .EXAMPLE - Test-PSModule -Name 'World' - - "Hello, World!" - #> - [CmdletBinding()] - param ( - # Name of the person to greet. - [Parameter(Mandatory)] - [string] $Name - ) - Write-Output "Hello, $Name!" -} diff --git a/src/PSModule/PSModule.psd1 b/src/PSModule/PSModule.psd1 deleted file mode 100644 index d17e4eb8..00000000 --- a/src/PSModule/PSModule.psd1 +++ /dev/null @@ -1,6 +0,0 @@ -@{ - ModuleVersion = '0.0.1' - RootModule = 'PSModule.psm1' - Author = 'PSModule' - Description = 'PSModule Framework Test Module' -} diff --git a/src/PSModule/PSModule.psm1 b/src/PSModule/PSModule.psm1 deleted file mode 100644 index 302c035f..00000000 --- a/src/PSModule/PSModule.psm1 +++ /dev/null @@ -1,32 +0,0 @@ -[Cmdletbinding()] -param() - -Write-Verbose 'Importing subcomponents' -$Folders = '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" - } - } -} - -$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/src/PSModule/public/Test-PSModule.ps1 b/src/PSModule/public/Test-PSModule.ps1 deleted file mode 100644 index 131dcffb..00000000 --- a/src/PSModule/public/Test-PSModule.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -Function Test-PSModule { - <# - .SYNOPSIS - Performs tests on a module. - - .EXAMPLE - Test-PSModule -Name 'World' - - "Hello, World!" - #> - [CmdletBinding()] - param ( - # Name of the person to greet. - [Parameter(Mandatory)] - [string] $Name - ) - Write-Output "Hello, $Name!" -} diff --git a/tests/PSModule.Tests.ps1.ps1 b/tests/PSModule.Tests.ps1.ps1 deleted file mode 100644 index e5f39d0d..00000000 --- a/tests/PSModule.Tests.ps1.ps1 +++ /dev/null @@ -1,11 +0,0 @@ -Describe "PSModule.Tests.ps1" { - It "Should be able to import the module" { - Import-Module -Name 'PSModule' - Get-Module -Name 'PSModule' | Should -Not -BeNullOrEmpty - Write-Verbose (Get-Module -Name 'PSModule' | Out-String) -Verbose - } - It "Should be able to call the function" { - Test-PSModuleTest -Name 'World' | Should -Be "Hello, World!" - Write-Verbose (Test-PSModuleTest -Name 'World' | Out-String) -Verbose - } -} From ec4979eec6662ec27c64e82b0f91dc2162d1e486 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 20:40:12 +0100 Subject: [PATCH 02/14] test --- .github/workflows/Action-Test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 19e73e85..9746557e 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -23,7 +23,7 @@ jobs: - name: Copy test data shell: pwsh run: | - Get-ChildItem -Path ${{ matrix.path }} | Select-Object -ExpandProperty FullName + Get-ChildItem | Select-Object -ExpandProperty FullName # - name: Initialize environment # uses: PSModule/Initialize-PSModule@main From abe666033c94ebc00348f97884846b452a717dc9 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 20:44:13 +0100 Subject: [PATCH 03/14] test --- .github/workflows/Action-Test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 9746557e..42422e38 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -23,6 +23,7 @@ jobs: - name: Copy test data shell: pwsh run: | + Set-Location -Path $env:RUNNER_WORKSPACE Get-ChildItem | Select-Object -ExpandProperty FullName # - name: Initialize environment From 4afcf2a22070754effb2600d8dd1dc85336d420d Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 20:49:44 +0100 Subject: [PATCH 04/14] test --- .github/workflows/Action-Test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 42422e38..ea14a037 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -19,10 +19,12 @@ jobs: uses: actions/checkout@v4 with: repository: PSModule/PSModuleTest + path: PSModuleTest - name: Copy test data shell: pwsh run: | + $env:RUNNER_WORKSPACE Set-Location -Path $env:RUNNER_WORKSPACE Get-ChildItem | Select-Object -ExpandProperty FullName From bad4d3bec6639b4858de9445d835758d9064e404 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 20:51:07 +0100 Subject: [PATCH 05/14] recurse --- .github/workflows/Action-Test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index ea14a037..3a18d147 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -26,7 +26,7 @@ jobs: run: | $env:RUNNER_WORKSPACE Set-Location -Path $env:RUNNER_WORKSPACE - Get-ChildItem | Select-Object -ExpandProperty FullName + Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName # - name: Initialize environment # uses: PSModule/Initialize-PSModule@main From ed11f8f6ae2aade4d91e0ec03d7a3f0460d430cc Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 20:53:26 +0100 Subject: [PATCH 06/14] test --- .github/workflows/Action-Test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 3a18d147..2de366d7 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -19,7 +19,6 @@ jobs: uses: actions/checkout@v4 with: repository: PSModule/PSModuleTest - path: PSModuleTest - name: Copy test data shell: pwsh From 45d2d834ab0006fdea64a87fb3d119581b11e54a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 20:56:25 +0100 Subject: [PATCH 07/14] test --- .github/workflows/Action-Test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 2de366d7..be093179 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -19,6 +19,7 @@ jobs: uses: actions/checkout@v4 with: repository: PSModule/PSModuleTest + path: ../PSModuleTest - name: Copy test data shell: pwsh From f2f8e5e9a87cae4299295d6345bc976d8536619f Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 21:00:18 +0100 Subject: [PATCH 08/14] terst --- .github/workflows/Action-Test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index be093179..3d57abd5 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -19,14 +19,13 @@ jobs: uses: actions/checkout@v4 with: repository: PSModule/PSModuleTest - path: ../PSModuleTest + path: PSModuleTest - name: Copy test data shell: pwsh run: | - $env:RUNNER_WORKSPACE - Set-Location -Path $env:RUNNER_WORKSPACE - Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName + Copy-Item -Path .\PSModuleTest\scr\* -Destination .\tests\src -Recurse -Force + Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName | Sort-Object # - name: Initialize environment # uses: PSModule/Initialize-PSModule@main From afd6e0ff2decae983cc8fc81dd9b01dda109732b Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 21:04:08 +0100 Subject: [PATCH 09/14] est --- .github/workflows/Action-Test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 3d57abd5..a6a9360d 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -24,7 +24,7 @@ jobs: - name: Copy test data shell: pwsh run: | - Copy-Item -Path .\PSModuleTest\scr\* -Destination .\tests\src -Recurse -Force + Copy-Item -Path .\PSModuleTest\src\* -Destination .\tests\src -Recurse -Force Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName | Sort-Object # - name: Initialize environment From 33438f7a3ba6669c50760384afd838104aa0185e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 21:10:52 +0100 Subject: [PATCH 10/14] tests --- .github/workflows/Action-Test.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index a6a9360d..90151990 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -15,25 +15,25 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - name: Checkout test repo + - name: Checkout tests -> PSModuleTest uses: actions/checkout@v4 with: repository: PSModule/PSModuleTest path: PSModuleTest - - name: Copy test data + - name: Copy tests - PSModuleTest\src -> ${{ matrix.path }} shell: pwsh run: | - Copy-Item -Path .\PSModuleTest\src\* -Destination .\tests\src -Recurse -Force + Copy-Item -Path .\PSModuleTest\src\* -Destination .${{ matrix.path }} -Recurse -Force Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName | Sort-Object - # - name: Initialize environment - # uses: PSModule/Initialize-PSModule@main + - name: Initialize environment + uses: PSModule/Initialize-PSModule@main - # - name: Action-Test - # uses: ./ - # env: - # GITHUB_TOKEN: ${{ github.token }} - # with: - # Name: PSModule - # Path: ${{ matrix.path }} + - name: Action-Test + uses: ./ + env: + GITHUB_TOKEN: ${{ github.token }} + with: + Name: PSModule + Path: ${{ matrix.path }} From 19591bacc10d1c3e97e9b3055f928a70c21262c5 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 21:13:50 +0100 Subject: [PATCH 11/14] test --- .github/workflows/Action-Test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 90151990..b604aa35 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -8,7 +8,7 @@ jobs: ActionTestSrc: strategy: matrix: - path: [tests/src, tests/outputs/modules] + path: [tests\src, tests\outputs\modules] name: Action-Test - [${{ matrix.path }}] runs-on: ubuntu-latest steps: @@ -24,7 +24,7 @@ jobs: - name: Copy tests - PSModuleTest\src -> ${{ matrix.path }} shell: pwsh run: | - Copy-Item -Path .\PSModuleTest\src\* -Destination .${{ matrix.path }} -Recurse -Force + Copy-Item -Path .\PSModuleTest\src\* -Destination .\${{ matrix.path }} -Recurse -Force Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName | Sort-Object - name: Initialize environment From ea4e8afc1c0c6c8d0938180913dda9ad3257bbd1 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 21:15:46 +0100 Subject: [PATCH 12/14] test --- .github/workflows/Action-Test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index b604aa35..5085a5c4 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -19,12 +19,11 @@ jobs: uses: actions/checkout@v4 with: repository: PSModule/PSModuleTest - path: PSModuleTest + path: tests - - name: Copy tests - PSModuleTest\src -> ${{ matrix.path }} + - name: Show files shell: pwsh run: | - Copy-Item -Path .\PSModuleTest\src\* -Destination .\${{ matrix.path }} -Recurse -Force Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName | Sort-Object - name: Initialize environment From 5fc5229ebaf9f5aca1e4eace7d732223dfb1a37a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 21:38:29 +0100 Subject: [PATCH 13/14] Add fail-fast: false --- .github/workflows/Action-Test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 5085a5c4..f84279a1 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -7,6 +7,7 @@ on: [pull_request] jobs: ActionTestSrc: strategy: + fail-fast: false matrix: path: [tests\src, tests\outputs\modules] name: Action-Test - [${{ matrix.path }}] From 817a0dcf96ce548096e52c1a408b05c4da28e9ba Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 9 Mar 2024 22:07:08 +0100 Subject: [PATCH 14/14] test --- .github/workflows/Action-Test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index f84279a1..81fbec0e 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - path: [tests\src, tests\outputs\modules] + path: [tests/src, tests/outputs/modules] name: Action-Test - [${{ matrix.path }}] runs-on: ubuntu-latest steps: