Skip to content

Commit 015fb46

Browse files
Merge pull request #1955 from PowerShell/andschwa/powershell7.3
Add PowerShell 7.3 to test matrix
2 parents 502ddaf + 8f31af3 commit 015fb46

File tree

9 files changed

+68
-29
lines changed

9 files changed

+68
-29
lines changed

.github/workflows/codeql-analysis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
- name: Checkout repository
3030
uses: actions/checkout@v3
3131

32+
- name: Install dotnet
33+
uses: actions/setup-dotnet@v3
34+
3235
# Initializes the CodeQL tools for scanning.
3336
- name: Initialize CodeQL
3437
uses: github/codeql-action/init@v2

.github/workflows/emacs-test.yml

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
- name: Checkout repository
1818
uses: actions/checkout@v3
1919

20+
- name: Install dotnet
21+
uses: actions/setup-dotnet@v3
22+
2023
- name: Build PSES
2124
shell: pwsh
2225
run: tools/azurePipelinesBuild.ps1

.github/workflows/vim-test.yml

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
- name: Checkout repository
1818
uses: actions/checkout@v3
1919

20+
- name: Install dotnet
21+
uses: actions/setup-dotnet@v3
22+
2023
- name: Build PSES
2124
shell: pwsh
2225
run: tools/azurePipelinesBuild.ps1

.vsts-ci/templates/ci-general.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ steps:
1212
pwsh: ${{ parameters.pwsh }}
1313

1414
- task: UseDotNet@2
15-
displayName: Install .NET 6.0.x SDK
15+
displayName: Install .NET 7.0.x SDK
1616
inputs:
1717
packageType: sdk
18+
version: 7.0.x
19+
performMultiLevelLookup: true
20+
21+
- task: UseDotNet@2
22+
displayName: Install .NET 6.0.x runtime
23+
inputs:
24+
packageType: runtime
1825
version: 6.0.x
1926
performMultiLevelLookup: true
2027

PowerShellEditorServices.build.ps1

+25-20
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ $script:PsesCommonProps = [xml](Get-Content -Raw "$PSScriptRoot/PowerShellEditor
4141
$script:NetRuntime = @{
4242
PS7 = 'netcoreapp3.1'
4343
PS72 = 'net6.0'
44+
PS73 = 'net7.0'
4445
Desktop = 'net462'
4546
Standard = 'netstandard2.0'
4647
}
@@ -73,24 +74,24 @@ Task FindDotNet {
7374
}
7475

7576
Task BinClean {
76-
Remove-Item $PSScriptRoot\.tmp -Recurse -Force -ErrorAction Ignore
77-
Remove-Item $PSScriptRoot\module\PowerShellEditorServices\bin -Recurse -Force -ErrorAction Ignore
78-
Remove-Item $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin -Recurse -Force -ErrorAction Ignore
77+
Remove-BuildItem $PSScriptRoot\.tmp
78+
Remove-BuildItem $PSScriptRoot\module\PowerShellEditorServices\bin
79+
Remove-BuildItem $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin
7980
}
8081

8182
Task Clean FindDotNet, BinClean, {
82-
Exec { & dotnet clean $VerbosityArgs }
83-
Get-ChildItem -Recurse $PSScriptRoot\src\*.nupkg | Remove-Item -Force -ErrorAction Ignore
84-
Get-ChildItem $PSScriptRoot\PowerShellEditorServices*.zip | Remove-Item -Force -ErrorAction Ignore
85-
Get-ChildItem $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US\*-help.xml | Remove-Item -Force -ErrorAction Ignore
83+
Invoke-BuildExec { & dotnet clean $VerbosityArgs }
84+
Get-ChildItem -Recurse $PSScriptRoot\src\*.nupkg | Remove-BuildItem
85+
Get-ChildItem $PSScriptRoot\PowerShellEditorServices*.zip | Remove-BuildItem
86+
Get-ChildItem $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US\*-help.xml | Remove-BuildItem
8687

8788
# Remove bundled component modules
8889
$moduleJsonPath = "$PSScriptRoot\modules.json"
8990
if (Test-Path $moduleJsonPath) {
9091
Get-Content -Raw $moduleJsonPath |
9192
ConvertFrom-Json |
9293
ForEach-Object { $_.PSObject.Properties.Name } |
93-
ForEach-Object { Remove-Item -Path "$PSScriptRoot/module/$_" -Recurse -Force -ErrorAction Ignore }
94+
ForEach-Object { Remove-BuildItem -Path "$PSScriptRoot/module/$_" }
9495
}
9596
}
9697

@@ -161,20 +162,20 @@ Task SetupHelpForTests {
161162
}
162163

163164
Task Build FindDotNet, CreateBuildInfo, {
164-
Exec { & dotnet restore $VerbosityArgs }
165-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:NetRuntime.Standard }
166-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.PS7 }
165+
Invoke-BuildExec { & dotnet restore $VerbosityArgs }
166+
Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:NetRuntime.Standard }
167+
Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.PS7 }
167168
if (-not $script:IsNix) {
168-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.Desktop }
169+
Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.Desktop }
169170
}
170171

171172
# Build PowerShellEditorServices.VSCode module
172-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj -f $script:NetRuntime.Standard }
173+
Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj -f $script:NetRuntime.Standard }
173174
}
174175

175176
Task Test TestServer, TestE2E
176177

177-
Task TestServer TestServerWinPS, TestServerPS7, TestServerPS72
178+
Task TestServer TestServerWinPS, TestServerPS7, TestServerPS72, TestServerPS73
178179

179180
# NOTE: While these can run under `pwsh.exe` we only want them to run under
180181
# `powershell.exe` so that the CI time isn't doubled.
@@ -184,25 +185,29 @@ Task TestServerWinPS -If ($PSVersionTable.PSEdition -eq "Desktop") Build, SetupH
184185
# that is debuggable! If architecture is added, the assembly path gets an
185186
# additional folder, necesstiating fixes to find the commands definition
186187
# file and test files.
187-
Exec { & dotnet $script:dotnetTestArgs $script:NetRuntime.Desktop }
188+
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.Desktop }
188189
}
189190

190191
Task TestServerPS7 -If ($PSVersionTable.PSEdition -eq "Core" -and -not $script:IsAppleM1 -and -not $script:IsArm64) Build, SetupHelpForTests, {
191192
Set-Location .\test\PowerShellEditorServices.Test\
192-
Exec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS7 }
193+
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS7 }
193194
}
194195

195196
Task TestServerPS72 -If ($PSVersionTable.PSEdition -eq "Core") Build, SetupHelpForTests, {
196197
Set-Location .\test\PowerShellEditorServices.Test\
197-
Exec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS72 }
198+
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS72 }
199+
}
200+
201+
Task TestServerPS73 -If ($PSVersionTable.PSEdition -eq "Core") Build, SetupHelpForTests, {
202+
Set-Location .\test\PowerShellEditorServices.Test\
203+
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS73 }
198204
}
199205

200206
Task TestE2E Build, SetupHelpForTests, {
201207
Set-Location .\test\PowerShellEditorServices.Test.E2E\
202208

203209
$env:PWSH_EXE_NAME = if ($IsCoreCLR) { "pwsh" } else { "powershell" }
204-
$NetRuntime = if ($IsAppleM1 -or $script:IsArm64) { $script:NetRuntime.PS72 } else { $script:NetRuntime.PS7 }
205-
Exec { & dotnet $script:dotnetTestArgs $NetRuntime }
210+
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS72 }
206211

207212
if (!$script:IsNix) {
208213
if (-not [Security.Principal.WindowsIdentity]::GetCurrent().Owner.IsWellKnown("BuiltInAdministratorsSid")) {
@@ -213,7 +218,7 @@ Task TestE2E Build, SetupHelpForTests, {
213218
try {
214219
Write-Host "Running end-to-end tests in Constrained Language Mode."
215220
[System.Environment]::SetEnvironmentVariable("__PSLockdownPolicy", "0x80000007", [System.EnvironmentVariableTarget]::Machine);
216-
Exec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS7 }
221+
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS72 }
217222
} finally {
218223
[System.Environment]::SetEnvironmentVariable("__PSLockdownPolicy", $null, [System.EnvironmentVariableTarget]::Machine);
219224
}

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0",
3+
"version": "7.0.100",
44
"rollForward": "latestFeature",
55
"allowPrerelease": true
66
}

src/PowerShellEditorServices/Utility/FormatUtils.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ internal static class FormatUtils
2323

2424
private const string Static = "static ";
2525

26+
private static HashSet<string>? usingNamespaces;
27+
2628
/// <summary>
2729
/// Space, new line, carriage return and tab.
2830
/// </summary>
@@ -164,9 +166,9 @@ private static string GetMethodDocumentation(ReadOnlySpan<char> toolTip, out Mar
164166
{
165167
kind = MarkupKind.Markdown;
166168
StringBuilder text = new();
167-
HashSet<string>? usingNamespaces = null;
168169
while (true)
169170
{
171+
usingNamespaces = null;
170172
toolTip = toolTip.TrimStart(s_whiteSpace.Span);
171173
toolTip = ProcessMethod(toolTip, text, ref usingNamespaces);
172174
if (toolTip.IsEmpty)

test/PowerShellEditorServices.Test.E2E/Processes/LoggingStream.cs

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ internal class LoggingStream : Stream
1616

1717
public LoggingStream(Stream underlyingStream) => _underlyingStream = underlyingStream;
1818

19+
protected override void Dispose(bool disposing)
20+
{
21+
base.Dispose(disposing);
22+
if (disposing)
23+
{
24+
_underlyingStream.Dispose();
25+
}
26+
}
27+
1928
public override bool CanRead => _underlyingStream.CanRead;
2029

2130
public override bool CanSeek => _underlyingStream.CanSeek;

test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj

+13-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), PowerShellEditorServices.Common.props))\PowerShellEditorServices.Common.props" />
33

44
<PropertyGroup>
5-
<TargetFrameworks>net6.0;netcoreapp3.1;net462</TargetFrameworks>
5+
<TargetFrameworks>net7.0;net6.0;netcoreapp3.1;net462</TargetFrameworks>
66
<AssemblyName>Microsoft.PowerShell.EditorServices.Test</AssemblyName>
77
<TargetPlatform>x64</TargetPlatform>
88
</PropertyGroup>
@@ -12,20 +12,30 @@
1212
<ProjectReference Include="..\PowerShellEditorServices.Test.Shared\PowerShellEditorServices.Test.Shared.csproj" />
1313
</ItemGroup>
1414

15-
<!-- This is for testing PowerShell 7.2 LTS -->
15+
<!-- Latest PowerShell -->
16+
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
17+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.3.0" />
18+
</ItemGroup>
19+
20+
<!-- PowerShell LTS-Current -->
1621
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
1722
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.7" />
1823
</ItemGroup>
1924

20-
<!-- This is for testing PowerShell 7.0 LTS and so needs to be 7.0.x -->
25+
<!-- PowerShell LTS -->
2126
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
2227
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.0.13" />
2328
</ItemGroup>
2429

30+
<!-- Windows PowerShell 5.1 -->
2531
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
2632
<PackageReference Include="Microsoft.PowerShell.5.ReferenceAssemblies" Version="1.1.0" />
2733
</ItemGroup>
2834

35+
<PropertyGroup Condition=" '$(TargetFramework)' != 'net462' ">
36+
<DefineConstants>$(DefineConstants);CoreCLR</DefineConstants>
37+
</PropertyGroup>
38+
2939
<ItemGroup>
3040
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
3141
<PackageReference Include="xunit" Version="2.4.2" />
@@ -48,7 +58,4 @@
4858
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
4959
</ItemGroup>
5060

51-
<PropertyGroup Condition=" '$(TargetFramework)' != 'net462' ">
52-
<DefineConstants>$(DefineConstants);CoreCLR</DefineConstants>
53-
</PropertyGroup>
5461
</Project>

0 commit comments

Comments
 (0)