Skip to content

Commit 8c55d98

Browse files
Merge pull request #19 from WarehouseFinds/feat/update-actions
Update .NET version in CI workflow to 10.0.x
2 parents b731bf2 + 27ac3f5 commit 8c55d98

4 files changed

Lines changed: 51 additions & 14 deletions

File tree

.github/actions/ps-build/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ runs:
5555
uses: actions/upload-artifact@v4
5656
with:
5757
name: ${{ github.event.repository.name }}.${{ steps.gitversion.outputs.MajorMinorPatch }}.nupkg
58-
path: /build/package/${{ github.event.repository.name }}.${{ steps.gitversion.outputs.MajorMinorPatch }}.nupkg
58+
path: build/package/${{ github.event.repository.name }}.${{ steps.gitversion.outputs.MajorMinorPatch }}.nupkg
5959

6060
- name: Upload module bin artifacts
6161
id: upload_bin

.github/workflows/ci.yml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
- name: Setup .NET
7777
uses: actions/setup-dotnet@v5
7878
with:
79-
dotnet-version: '8.0.x'
79+
dotnet-version: '10.0.x'
8080

8181
- name: Restore dependencies
8282
run: dotnet restore
@@ -124,22 +124,55 @@ jobs:
124124
- name: Setup .NET
125125
uses: actions/setup-dotnet@v5
126126
with:
127-
dotnet-version: '8.0.x'
127+
dotnet-version: '10.0.x'
128128

129-
- name: Download all build artifacts
130-
uses: actions/download-artifact@v5
131-
with:
132-
name: PSBinaryModule
133-
path: build/out/PSBinaryModule
129+
- name: Build Module
130+
shell: pwsh
131+
run: |
132+
dotnet restore './PSBinaryModule.sln'
133+
dotnet build './PSBinaryModule.sln' --configuration Release --no-restore
134+
135+
if (Get-Command Invoke-Build -ErrorAction SilentlyContinue) {
136+
Invoke-Build -Task Build -Configuration Release
137+
} else {
138+
Install-Module InvokeBuild -Force -SkipPublisherCheck
139+
Invoke-Build -Task Build -Configuration Release
140+
}
141+
142+
- name: Install PowerShell
143+
shell: pwsh
144+
run: |
145+
if ($env:RUNNER_OS -eq 'Linux') {
146+
sudo apt-get update
147+
sudo apt-get install -y powershell
148+
} elseif ($env:RUNNER_OS -eq 'macOS') {
149+
brew install --cask powershell
150+
}
134151
135-
- name: Setup PowerShell
152+
- name: Install Pester
136153
shell: pwsh
137154
run: |
138-
Install-PSResource -Name Pester -TrustRepository -AcceptLicense
155+
Install-Module Pester -Force -SkipPublisherCheck
156+
157+
- name: Configure .NET Environment
158+
shell: pwsh
159+
run: |
160+
$dotnetInfo = & dotnet --info
161+
$sdkPath = $dotnetInfo | Select-String "Base Path:" | ForEach-Object { $_.Line -replace '.*Base Path:\s*', '' }
162+
if ($sdkPath) {
163+
$dotnetRoot = Split-Path -Parent (Split-Path -Parent $sdkPath)
164+
echo "DOTNET_ROOT=$dotnetRoot" >> $env:GITHUB_ENV
165+
echo "DOTNET_MULTILEVEL_LOOKUP=1" >> $env:GITHUB_ENV
166+
Write-Host "DOTNET_ROOT set to: $dotnetRoot"
167+
}
139168
140169
- name: Run Integration Tests
141170
shell: pwsh
171+
env:
172+
DOTNET_ROOT: ${{ env.DOTNET_ROOT }}
173+
DOTNET_MULTILEVEL_LOOKUP: ${{ env.DOTNET_MULTILEVEL_LOOKUP }}
142174
run: |
175+
Import-Module Pester
143176
$config = New-PesterConfiguration @{
144177
Run = @{
145178
Path = './tests/Integration'
@@ -158,7 +191,6 @@ jobs:
158191
}
159192
}
160193
Invoke-Pester -Configuration $config
161-
162194
- name: Upload test results
163195
uses: actions/upload-artifact@v6
164196
if: always()

PSBinaryModule.build.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,21 @@ task Build Compile, {
169169
Copy-Item -Path "$helpPath/*" -Destination $outputHelpPath -Recurse -Force
170170
}
171171

172-
# Copy dependencies (if any)
172+
# Copy dependencies
173173
$binPath = Join-Path -Path $srcPath -ChildPath "bin/$Configuration"
174174
Get-ChildItem -Path $binPath -Filter '*.dll' | Where-Object {
175175
$_.Name -ne "$moduleName.dll" -and
176-
$_.Name -notmatch '^System\.' -and
177-
$_.Name -notmatch '^Microsoft\.' -and
178176
$_.Name -ne 'PowerShellStandard.Library.dll'
179177
} | ForEach-Object {
180178
Copy-Item -Path $_.FullName -Destination $outputPath -Force
181179
}
182180

181+
# Copy the deps.json file which helps with assembly resolution
182+
$depsFile = Join-Path -Path $binPath -ChildPath "$moduleName.deps.json"
183+
if (Test-Path $depsFile) {
184+
Copy-Item -Path $depsFile -Destination $outputPath -Force
185+
}
186+
183187
Write-Build Green "Module built successfully at: $outputPath"
184188
}
185189

src/PSBinaryModule.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>
5+
<RuntimeIdentifiers>win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
56
<AssemblyName>PSBinaryModule</AssemblyName>
67
<RootNamespace>PSBinaryModule</RootNamespace>
78
<LangVersion>latest</LangVersion>

0 commit comments

Comments
 (0)