Skip to content

Commit c64711d

Browse files
committed
Try to fix path problems so we test the right module
1 parent 975a7ab commit c64711d

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

.github/workflows/build.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
uses: actions/download-artifact@v4
6767
with:
6868
name: ModuleBuilder
69-
path: Modules/ModuleBuilder
69+
path: Modules/ModuleBuilder # /home/runner/work/ModuleBuilder/ModuleBuilder/Modules/ModuleBuilder
7070
- name: Download Pester Tests
7171
uses: actions/download-artifact@v4
7272
with:
@@ -78,6 +78,18 @@ jobs:
7878
name: build.requires.psd1
7979
- name: ⚡ Install PowerShell Modules
8080
uses: JustinGrote/[email protected]
81+
- name: Put Build output in PATH
82+
shell: pwsh
83+
run: | # PowerShell
84+
Convert-Path Modules -OutVariable BuiltModules
85+
Add-Content -Path $env:GITHUB_PATH -Value $BuiltModules -Encoding utf8
86+
# Uninstall the "installed" copy of ModuleBuilder
87+
Get-Module -Name ModuleBuilder -List | Where ModuleBase -notmatch ([regex]::escape($pwd)) | Uninstall-Module -Force
88+
Join-Path ([Environment]::GetFolderPath('LocalApplicationData')) 'powershell/Modules/ModuleBuilder' | Remove-Item -Recurse -Force
89+
- name: Put Build output in PATH
90+
shell: pwsh
91+
run: | # PowerShell
92+
$Env:PATH -split ([IO.Path]::PathSeparator) | Out-Host
8193
- name: Invoke Pester Tests
8294
id: pester
8395
uses: zyborg/pester-tests-report@v1
@@ -90,7 +102,7 @@ jobs:
90102
github_token: ${{ secrets.GITHUB_TOKEN }}
91103
- name: dump test results
92104
shell: pwsh
93-
run: |
105+
run: | # PowerShell
94106
Write-Host 'Total Tests Executed...: ${{ steps.pester.outputs.total_count }}'
95107
Write-Host 'Total Tests PASSED.....: ${{ steps.pester.outputs.passed_count }}'
96108
Write-Host 'Total Tests FAILED.....: ${{ steps.pester.outputs.failed_count }}'

Tests/Integration/Parameters.Tests.ps1

+9-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ Describe "Parameters" -Tag Integration {
99
}
1010
# Throw in an extra file that would get cleaned up normally ...
1111
New-Item $PSScriptRoot/Result3/Parameters/3.0.0/DeleteMe.md -ItemType File -Force
12+
13+
Write-Host "Module Under Test:"
14+
Get-Command Build-Module
15+
| Get-Module -Name { $_.Source }
16+
| Get-Item
17+
| Out-Host
1218
}
1319

1420
It "Passthru is read from the build manifest" {
15-
$Output = Build-Module (Convert-FolderSeparator "$PSScriptRoot/Parameters/build.psd1") -Verbose
21+
Build-Module (Convert-FolderSeparator "$PSScriptRoot/Parameters/build.psd1") -Verbose -OutVariable Output
22+
| Out-Host
23+
1624
$Output | Should -Not -BeNullOrEmpty
1725
$Output.Path | Convert-FolderSeparator | Should -Be (Convert-FolderSeparator "$PSScriptRoot/Result3/Parameters/3.0.0/Parameters.psd1")
1826
}

0 commit comments

Comments
 (0)