Skip to content

Commit 31ff8cd

Browse files
yotsudaclaude
andcommitted
Fix CI for single net8.0 DLL structure
- Build only PowerShell.MCP module, let dotnet test handle its own restore+build - Move SelfContained from Proxy csproj to publish command line - Add --self-contained to Build-AllPlatforms.ps1 publish args - Exclude Proxy test files on net8.0 (Proxy is net9.0 only) - Make path tests cross-platform (skip Windows drive-letter tests on Unix) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fbdf5d0 commit 31ff8cd

5 files changed

Lines changed: 16 additions & 16 deletions

File tree

.github/workflows/cross-platform-test.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,23 +107,19 @@ jobs:
107107
108108
- name: Run unit tests
109109
run: |
110-
dotnet test Tests/PowerShell.MCP.Tests.csproj -c Release --no-restore -v normal
110+
dotnet test Tests/PowerShell.MCP.Tests.csproj -c Release -v normal
111111
112112
- name: Setup module directory (Windows)
113113
if: runner.os == 'Windows'
114114
shell: pwsh
115115
run: |
116116
$modulePath = "$env:USERPROFILE\Documents\PowerShell\Modules\PowerShell.MCP"
117117
New-Item -Path "$modulePath\bin\${{ matrix.rid }}" -ItemType Directory -Force | Out-Null
118-
New-Item -Path "$modulePath\lib\net8.0" -ItemType Directory -Force | Out-Null
119-
New-Item -Path "$modulePath\lib\net9.0" -ItemType Directory -Force | Out-Null
120118
121-
Copy-Item "PowerShell.MCP\bin\Release\net8.0\PowerShell.MCP.dll" -Destination "$modulePath\lib\net8.0"
122-
Copy-Item "PowerShell.MCP\bin\Release\net9.0\PowerShell.MCP.dll" -Destination "$modulePath\lib\net9.0"
119+
Copy-Item "PowerShell.MCP\bin\Release\net8.0\PowerShell.MCP.dll" -Destination $modulePath
120+
Copy-Item "PowerShell.MCP\bin\Release\net8.0\Ude.NetStandard.dll" -Destination $modulePath
123121
Copy-Item "Staging\PowerShell.MCP.psd1" -Destination $modulePath
124122
Copy-Item "Staging\PowerShell.MCP.psm1" -Destination $modulePath
125-
# Ude.NetStandard.dll is netstandard2.0 — single copy at module root
126-
Copy-Item "PowerShell.MCP\bin\Release\net9.0\Ude.NetStandard.dll" -Destination $modulePath
127123
Copy-Item "PowerShell.MCP.Proxy\bin\Release\net9.0\${{ matrix.rid }}\publish\${{ matrix.exe }}" -Destination "$modulePath\bin\${{ matrix.rid }}"
128124
129125
Write-Host "Module files:"
@@ -134,15 +130,11 @@ jobs:
134130
run: |
135131
MODULE_PATH="$HOME/.local/share/powershell/Modules/PowerShell.MCP"
136132
mkdir -p "$MODULE_PATH/bin/${{ matrix.rid }}"
137-
mkdir -p "$MODULE_PATH/lib/net8.0"
138-
mkdir -p "$MODULE_PATH/lib/net9.0"
139133
140-
cp PowerShell.MCP/bin/Release/net8.0/PowerShell.MCP.dll "$MODULE_PATH/lib/net8.0/"
141-
cp PowerShell.MCP/bin/Release/net9.0/PowerShell.MCP.dll "$MODULE_PATH/lib/net9.0/"
134+
cp PowerShell.MCP/bin/Release/net8.0/PowerShell.MCP.dll "$MODULE_PATH/"
135+
cp PowerShell.MCP/bin/Release/net8.0/Ude.NetStandard.dll "$MODULE_PATH/"
142136
cp Staging/PowerShell.MCP.psd1 "$MODULE_PATH/"
143137
cp Staging/PowerShell.MCP.psm1 "$MODULE_PATH/"
144-
# Ude.NetStandard.dll is netstandard2.0 — single copy at module root
145-
cp PowerShell.MCP/bin/Release/net9.0/Ude.NetStandard.dll "$MODULE_PATH/"
146138
cp "PowerShell.MCP.Proxy/bin/Release/net9.0/${{ matrix.rid }}/publish/${{ matrix.exe }}" "$MODULE_PATH/bin/${{ matrix.rid }}/"
147139
chmod +x "$MODULE_PATH/bin/${{ matrix.rid }}/${{ matrix.exe }}"
148140

Build-AllPlatforms.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ if ($proxyTargets) {
156156
'-c', $Configuration
157157
'-r', $rid
158158
'-o', $outputDir
159+
'--self-contained'
159160
'--source', 'https://api.nuget.org/v3/index.json'
160161
)
161162

PowerShell.MCP.Proxy/PowerShell.MCP.Proxy.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
@@ -10,7 +10,6 @@
1010

1111
<!-- Single File デプロイ設定 -->
1212
<PublishSingleFile>true</PublishSingleFile>
13-
<SelfContained>true</SelfContained>
1413

1514
<!-- ファイルサイズ最適化設定 -->
1615
<PublishTrimmed>true</PublishTrimmed>

Tests/PowerShell.MCP.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@
2727
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
2828
<ProjectReference Include="..\PowerShell.MCP.Proxy\PowerShell.MCP.Proxy.csproj" />
2929
</ItemGroup>
30+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
31+
<Compile Remove="Unit\Proxy\**" />
32+
</ItemGroup>
3033

3134
</Project>

Tests/Unit/Core/TextFileCmdletBaseTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Management.Automation;
2+
using System.Runtime.InteropServices;
23
using Xunit;
34
using PowerShell.MCP.Cmdlets;
45

@@ -58,6 +59,10 @@ public void IsPSDrivePath_ValidPSDrivePaths_ReturnsTrue(string path, bool expect
5859
[InlineData("", false)]
5960
public void IsPSDrivePath_NonPSDrivePaths_ReturnsFalse(string path, bool expected)
6061
{
62+
// On non-Windows, single-letter drive paths look like PSDrive paths
63+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && path.Length >= 2 && path[1] == ':' && char.IsLetter(path[0]))
64+
return;
65+
6166
// Act
6267
var result = TestCmdlet.PublicIsPSDrivePath(path);
6368

@@ -156,7 +161,7 @@ public void GetDisplayPathForWildcard_SimplePattern_ReturnsFileName()
156161
// Arrange
157162
var cmdlet = new TestCmdlet();
158163
var pattern = "*.txt";
159-
var resolved = "C:\\\\temp\\\\file.txt";
164+
var resolved = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? @"C:\\temp\\file.txt" : "/tmp/file.txt";
160165

161166
// Act
162167
var result = cmdlet.PublicGetDisplayPathForWildcard(pattern, resolved);

0 commit comments

Comments
 (0)