Skip to content

Commit 0a63001

Browse files
authored
Merge pull request #3 from adamdriscoll/master
Update .NET and fix tests.
2 parents 54ac232 + 5071558 commit 0a63001

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

.github/workflows/ci-cd.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ jobs:
1818
- name: Setup .NET
1919
uses: actions/setup-dotnet@v4
2020
with:
21-
dotnet-version: '6.0.x'
21+
global-json-file: global.json
22+
2223

2324
- name: Restore dependencies
2425
run: dotnet restore
@@ -30,7 +31,9 @@ jobs:
3031
shell: pwsh
3132
run: |
3233
Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser
33-
Invoke-Pester -Path .\Tests\FindOpenFile.Tests.ps1 -Output Detailed -Configuration @{ Run = @{ Container = New-PesterContainer -Path .\Tests\FindOpenFile.Tests.ps1 -Data @{ Configuration = 'Release' } } }
34+
Invoke-Pester -Path .\Tests\FindOpenFile.Tests.ps1 -Output Detailed
35+
env:
36+
BUILD_CONFIGURATION: Release
3437

3538
- name: Upload build artifacts
3639
uses: actions/upload-artifact@v4
@@ -49,7 +52,7 @@ jobs:
4952
- name: Setup .NET
5053
uses: actions/setup-dotnet@v4
5154
with:
52-
dotnet-version: '6.0.x'
55+
dotnet-version: '10.0.x'
5356

5457
- name: Build Release
5558
run: dotnet build --configuration Release

Tests/FindOpenFile.Tests.ps1

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
param(
2-
[Parameter()]
3-
[ValidateSet('Debug', 'Release')]
4-
[string]$Configuration = 'Debug'
5-
)
6-
71
BeforeAll {
2+
# Get configuration from environment variable, default to 'Debug' if not set
3+
$Configuration = $env:BUILD_CONFIGURATION
4+
if ([string]::IsNullOrWhiteSpace($Configuration)) {
5+
$Configuration = 'Debug'
6+
}
7+
8+
# Validate configuration value
9+
if ($Configuration -notin @('Debug', 'Release')) {
10+
throw "Invalid BUILD_CONFIGURATION value: '$Configuration'. Must be 'Debug' or 'Release'."
11+
}
12+
813
# Import the module from the specified build configuration directory
914
$modulePath = Join-Path $PSScriptRoot "..\bin\$Configuration\netstandard2.0\FindOpenFile.psd1"
1015

global.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sdk": {
3+
"version": "10.0.100",
4+
"rollForward": "latestMinor"
5+
}
6+
}

0 commit comments

Comments
 (0)