aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-07-25 02:40:14 +0300
committerGitHub <noreply@github.com>2026-07-25 02:40:14 +0300
commit8afd52ae57f9237f4f46138ad224dfc621d7ba59 (patch)
tree349bbbd86c57863539ebc4c2eacf34550e076fa2 /.github
parent5f1957c27bd23f73b339265d3acd32f4a21878a3 (diff)
fix: bundle modern ConPTY on Windows (#1828)
refs #1533 refs #1644
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/build-artifacts-manual.yml15
-rw-r--r--.github/workflows/ci.yml103
-rw-r--r--.github/workflows/preview.yml15
3 files changed, 125 insertions, 8 deletions
diff --git a/.github/workflows/build-artifacts-manual.yml b/.github/workflows/build-artifacts-manual.yml
index 3896138c..7fc2e9b8 100644
--- a/.github/workflows/build-artifacts-manual.yml
+++ b/.github/workflows/build-artifacts-manual.yml
@@ -224,19 +224,26 @@ jobs:
- name: Package artifact
shell: pwsh
run: |
- Copy-Item target\x86_64-pc-windows-msvc\release\herdr.exe herdr-windows-x86_64.exe
+ $ErrorActionPreference = "Stop"
+ $package = Join-Path $env:RUNNER_TEMP "Microsoft.Windows.Console.ConPTY.nupkg"
+ $stage = Join-Path $env:RUNNER_TEMP "herdr-windows-x86_64"
+ .\scripts\package_windows_conpty.ps1 `
+ -HerdrExe target\x86_64-pc-windows-msvc\release\herdr.exe `
+ -PackagePath $package `
+ -StageDir $stage `
+ -OutputPath herdr-windows-x86_64.zip
"commit=$env:GITHUB_SHA" | Out-File -Encoding utf8 BUILD_INFO.txt
"target=x86_64-pc-windows-msvc" | Out-File -Encoding utf8 -Append BUILD_INFO.txt
"libghostty_vt_optimize=$env:LIBGHOSTTY_VT_OPTIMIZE" | Out-File -Encoding utf8 -Append BUILD_INFO.txt
"libghostty_vt_simd=$env:LIBGHOSTTY_VT_SIMD" | Out-File -Encoding utf8 -Append BUILD_INFO.txt
- $hash = (Get-FileHash -Algorithm SHA256 herdr-windows-x86_64.exe).Hash.ToLowerInvariant()
- "sha256=$hash herdr-windows-x86_64.exe" | Out-File -Encoding utf8 -Append BUILD_INFO.txt
+ $hash = (Get-FileHash -Algorithm SHA256 herdr-windows-x86_64.zip).Hash.ToLowerInvariant()
+ "sha256=$hash herdr-windows-x86_64.zip" | Out-File -Encoding utf8 -Append BUILD_INFO.txt
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: herdr-windows-x86_64-${{ inputs.libghostty_optimize }}-simd-${{ inputs.libghostty_simd }}
path: |
- herdr-windows-x86_64.exe
+ herdr-windows-x86_64.zip
BUILD_INFO.txt
retention-days: 7
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index dc715802..458c92c3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -173,3 +173,106 @@ jobs:
$ErrorActionPreference = "Stop"
$exe = Join-Path $PWD "target\x86_64-pc-windows-msvc\debug\herdr.exe"
.\scripts\windows_smoke_conpty_path.ps1 -ExePath $exe -Session "ci-windows-$env:GITHUB_RUN_ID-$env:GITHUB_RUN_ATTEMPT"
+
+ windows-conpty-package:
+ name: Windows ConPTY package
+ runs-on: windows-2022
+ timeout-minutes: 25
+ steps:
+ - name: Checkout
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
+ with:
+ persist-credentials: false
+
+ - name: Install Rust
+ uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # v1
+ with:
+ toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
+ targets: x86_64-pc-windows-msvc
+
+ - name: Install Zig
+ uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
+ with:
+ version: 0.15.2
+ use-cache: false
+
+ - name: Restore Cargo cache
+ uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
+ with:
+ cache-bin: false
+ key: conpty-package-windows-2022
+
+ - name: Build Herdr
+ run: cargo build --locked --target x86_64-pc-windows-msvc
+
+ - name: Verify invalid bundle is rejected and system override recovers
+ shell: pwsh
+ run: |
+ $ErrorActionPreference = "Stop"
+ Remove-Item Env:HERDR_SOCKET_PATH, Env:HERDR_CLIENT_SOCKET_PATH -ErrorAction SilentlyContinue
+ $exe = Join-Path $PWD "target\x86_64-pc-windows-msvc\debug\herdr.exe"
+ $bundle = Join-Path (Split-Path -Parent $exe) "conpty"
+ New-Item -ItemType Directory -Force -Path (Join-Path $bundle "x64"), (Join-Path $bundle "arm64") | Out-Null
+ Set-Content -LiteralPath (Join-Path $bundle "herdr-conpty.json") -Value "{}" -Encoding ascii
+ [System.IO.File]::WriteAllBytes((Join-Path $bundle "conpty.dll"), [byte[]](0x48, 0x45, 0x52, 0x44, 0x52))
+ [System.IO.File]::WriteAllBytes((Join-Path $bundle "x64\OpenConsole.exe"), [byte[]](0x48, 0x45, 0x52, 0x44, 0x52))
+ [System.IO.File]::WriteAllBytes((Join-Path $bundle "arm64\OpenConsole.exe"), [byte[]](0x48, 0x45, 0x52, 0x44, 0x52))
+ try {
+ $rejected = $false
+ try {
+ .\scripts\windows_smoke_conpty_path.ps1 `
+ -ExePath $exe `
+ -Session "ci-conpty-invalid-windows-2022-$env:GITHUB_RUN_ID-$env:GITHUB_RUN_ATTEMPT"
+ } catch {
+ if ($_.Exception.Message -notlike "workspace create failed with exit code*") {
+ throw
+ }
+ $rejected = $true
+ }
+ if (-not $rejected) {
+ throw "Herdr accepted a tampered app-local ConPTY bundle"
+ }
+
+ $env:HERDR_WINDOWS_CONPTY = "system"
+ .\scripts\windows_smoke_conpty_path.ps1 `
+ -ExePath $exe `
+ -Session "ci-conpty-system-windows-2022-$env:GITHUB_RUN_ID-$env:GITHUB_RUN_ATTEMPT"
+ } finally {
+ Remove-Item Env:HERDR_WINDOWS_CONPTY -ErrorAction SilentlyContinue
+ Remove-Item -LiteralPath $bundle -Recurse -Force -ErrorAction SilentlyContinue
+ }
+
+ - name: Build and verify official ConPTY package
+ shell: pwsh
+ run: |
+ $ErrorActionPreference = "Stop"
+ $package = Join-Path $env:RUNNER_TEMP "Microsoft.Windows.Console.ConPTY.nupkg"
+ $stage = Join-Path $env:RUNNER_TEMP "herdr-windows-x86_64"
+ New-Item -ItemType Directory -Force -Path artifacts | Out-Null
+ .\scripts\package_windows_conpty.ps1 `
+ -HerdrExe target\x86_64-pc-windows-msvc\debug\herdr.exe `
+ -PackagePath $package `
+ -StageDir $stage `
+ -OutputPath artifacts\herdr-windows-x86_64.zip
+ "HERDR_CONPTY_PACKAGE_DIR=$stage" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
+
+ - name: Probe enhanced pane input with bundled ConPTY
+ shell: pwsh
+ run: |
+ $ErrorActionPreference = "Stop"
+ $exe = Join-Path $env:HERDR_CONPTY_PACKAGE_DIR "herdr.exe"
+ $consoleHost = Join-Path $env:HERDR_CONPTY_PACKAGE_DIR "conpty\x64\OpenConsole.exe"
+ .\scripts\windows_conpty_enhanced_input_probe.ps1 `
+ -ExePath $exe `
+ -Session "ci-conpty-bundled-windows-2022-$env:GITHUB_RUN_ID-$env:GITHUB_RUN_ATTEMPT" `
+ -ExpectedConsoleHostPath $consoleHost
+
+ - name: Test packaged installer and repair with Windows PowerShell 5.1
+ shell: pwsh
+ run: |
+ & powershell.exe -NoProfile -ExecutionPolicy Bypass -File `
+ .\scripts\windows_install_conpty_package_test.ps1 `
+ -ArchivePath artifacts\herdr-windows-x86_64.zip
+ if ($LASTEXITCODE -ne 0) {
+ throw "Windows PowerShell installer test failed with exit code $LASTEXITCODE"
+ }
diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml
index 370028fe..6704505b 100644
--- a/.github/workflows/preview.yml
+++ b/.github/workflows/preview.yml
@@ -139,7 +139,7 @@ jobs:
name: herdr-macos-aarch64
- target: x86_64-pc-windows-msvc
os: windows-latest
- name: herdr-windows-x86_64.exe
+ name: herdr-windows-x86_64.zip
runs-on: ${{ matrix.os }}
env:
LIBGHOSTTY_VT_OPTIMIZE: ReleaseFast
@@ -258,7 +258,14 @@ jobs:
if: runner.os == 'Windows'
shell: pwsh
run: |
- Copy-Item target\${{ matrix.target }}\release\herdr.exe ${{ matrix.name }}
+ $ErrorActionPreference = "Stop"
+ $package = Join-Path $env:RUNNER_TEMP "Microsoft.Windows.Console.ConPTY.nupkg"
+ $stage = Join-Path $env:RUNNER_TEMP "herdr-windows-x86_64"
+ .\scripts\package_windows_conpty.ps1 `
+ -HerdrExe target\${{ matrix.target }}\release\herdr.exe `
+ -PackagePath $package `
+ -StageDir $stage `
+ -OutputPath ${{ matrix.name }}
$hash = (Get-FileHash -Algorithm SHA256 ${{ matrix.name }}).Hash.ToLowerInvariant()
"$hash ${{ matrix.name }}" | Out-File -Encoding ascii ${{ matrix.name }}.sha256
"commit=${{ needs.preflight.outputs.commit }}" | Out-File -Encoding utf8 BUILD_INFO.txt
@@ -324,7 +331,7 @@ jobs:
result = {}
for path in pathlib.Path('artifacts').glob('herdr-*/*.sha256'):
digest, name = path.read_text().split()[:2]
- target = name.removeprefix('herdr-').removesuffix('.exe')
+ target = name.removeprefix('herdr-').removesuffix('.exe').removesuffix('.zip')
result[target] = digest
pathlib.Path('preview-sha256.json').write_text(json.dumps(result, indent=2) + '\n')
PY
@@ -344,7 +351,7 @@ jobs:
artifacts/herdr-linux-aarch64/herdr-linux-aarch64
artifacts/herdr-macos-x86_64/herdr-macos-x86_64
artifacts/herdr-macos-aarch64/herdr-macos-aarch64
- artifacts/herdr-windows-x86_64.exe/herdr-windows-x86_64.exe
+ artifacts/herdr-windows-x86_64.zip/herdr-windows-x86_64.zip
- name: Update preview manifest
run: |