Skip to content

Test end-to-end with PowerShell Daily #2124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
paths-ignore: [ '**/*.md' ]
merge_group:
types: [ checks_requested ]
schedule:
# 6am UTC which should be after a new daily build posts
- cron: "0 6 * * *"

jobs:
ci:
Expand Down Expand Up @@ -37,12 +40,25 @@ jobs:

- name: Install PSResources
shell: pwsh
run: tools/installPSResources.ps1
run: ./tools/installPSResources.ps1

- name: Download daily install script
uses: actions/checkout@v4
with:
repository: PowerShell/PowerShell
path: pwsh
sparse-checkout: tools/install-powershell.ps1
sparse-checkout-cone-mode: false

- name: Build and test
shell: pwsh
run: Invoke-Build ${{ github.event_name == 'merge_group' && 'TestFull' || 'Test' }}

- name: Test with daily
if: ${{ github.event_name == 'schedule' }}
shell: pwsh
run: ./pwsh/tools/install-powershell.ps1 -Daily && Invoke-Build TestE2EDaily

- name: Upload build artifacts
if: always()
uses: actions/upload-artifact@v3
Expand Down
13 changes: 13 additions & 0 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,19 @@ Task TestE2EPwsh Build, SetupHelpForTests, {
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetFramework.PS74 }
}

$PwshDaily = if ($script:IsNix) {
"$HOME/.powershell-daily/pwsh"
} else {
"$env:LOCALAPPDATA\Microsoft\powershell-daily\pwsh.exe"
}

Task TestE2EDaily -If (Test-Path $PwshDaily) Build, SetupHelpForTests, {
Set-Location .\test\PowerShellEditorServices.Test.E2E\
$env:PWSH_EXE_NAME = $PwshDaily
Write-Host "Running end-to-end tests with: $(& $PwshDaily --version)"
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetFramework.PS74 }
}

Task TestE2EPowerShell -If (-not $script:IsNix) Build, SetupHelpForTests, {
Set-Location .\test\PowerShellEditorServices.Test.E2E\
$env:PWSH_EXE_NAME = "powershell"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class PsesStdioProcess : StdioServerProcess

// NOTE: Just hard-code this to "powershell" when testing with the code lens.
public static string PwshExe { get; } = Environment.GetEnvironmentVariable("PWSH_EXE_NAME") ?? "pwsh";
public static bool IsWindowsPowerShell { get; } = PwshExe.Contains("powershell");
public static bool IsWindowsPowerShell { get; } = PwshExe.EndsWith("powershell");
public static bool RunningInConstrainedLanguageMode { get; } =
Environment.GetEnvironmentVariable("__PSLockdownPolicy", EnvironmentVariableTarget.Machine) != null;

Expand Down