Skip to content

Commit 2cab84f

Browse files
committed
Try again to fix path problems so we test the right module
1 parent e39342d commit 2cab84f

File tree

1 file changed

+31
-19
lines changed

1 file changed

+31
-19
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ jobs:
3232
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
3333
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
3434

35-
- uses: actions/upload-artifact@v4
35+
- name: Upload Built Modules
36+
uses: actions/upload-artifact@v4
3637
with:
37-
name: ModuleBuilder
38-
path: Modules/ModuleBuilder
38+
name: Modules
39+
path: |
40+
Modules/*
41+
!Modules/*-TestResults
3942
4043
- uses: actions/upload-artifact@v4
4144
with:
@@ -62,33 +65,42 @@ jobs:
6265
matrix:
6366
os: [windows-latest, ubuntu-latest, macos-latest]
6467
steps:
65-
- name: Download Build Output
68+
- name: Download build.requires.psd1
6669
uses: actions/download-artifact@v4
6770
with:
68-
name: ModuleBuilder
69-
path: Modules/ModuleBuilder # /home/runner/work/ModuleBuilder/ModuleBuilder/Modules/ModuleBuilder
71+
name: build.requires.psd1
7072
- name: Download Pester Tests
7173
uses: actions/download-artifact@v4
7274
with:
7375
name: PesterTests
7476
path: PesterTests
75-
- name: Download build.requires.psd1
77+
- name: Download Build Output
7678
uses: actions/download-artifact@v4
7779
with:
78-
name: build.requires.psd1
79-
- name: ⚡ Install PowerShell Modules
80-
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)) | Split-Path | Remove-Item -Recurse -Force
88-
- name: Put Build output in PATH
80+
name: Modules
81+
path: Modules # /home/runner/work/ModuleBuilder/ModuleBuilder/Modules
82+
- name: Install Output Modules
8983
shell: pwsh
9084
run: | # PowerShell
91-
$Env:PATH -split ([IO.Path]::PathSeparator) | Out-Host
85+
$ModuleDestination = if ($IsWindows) {
86+
Join-Path ([Environment]::GetFolderPath('MyDocuments')) 'PowerShell/Modules'
87+
} else {
88+
Join-Path $HOME '.local/share/powershell/Modules'
89+
}
90+
91+
Get-ChildItem -Directory Modules -OutVariable Modules
92+
| Move-Item -Destination { Join-Path $ModuleDestination $_.Name } -Force
93+
94+
Write-Host "Installing $($Modules -join ', ') to $ModuleDestination"
95+
Get-ChildItem -Directory $ModuleDestination
96+
Write-Host "PSModulePath:"
97+
$Env:PSModulePath -split ([IO.Path]::PathSeparator) | Out-Host
98+
99+
@(Get-Content build.requires.psd1)
100+
| Where { $_ -notmatch "ModuleBuilder"}
101+
| Set-Content build.requires.psd1
102+
- name: ⚡ Install Required Modules
103+
uses: JustinGrote/[email protected]
92104
- name: Invoke Pester Tests
93105
id: pester
94106
uses: zyborg/pester-tests-report@v1

0 commit comments

Comments
 (0)