mirror of
https://github.com/herdrdev/herdr.git
synced 2026-09-27 16:01:13 +00:00
feat: add native windows beta support
This commit is contained in:
@@ -11,6 +11,7 @@ on:
|
||||
options:
|
||||
- linux
|
||||
- macos
|
||||
- windows
|
||||
- all
|
||||
libghostty_optimize:
|
||||
description: libghostty-vt optimize mode for this build
|
||||
@@ -179,3 +180,55 @@ jobs:
|
||||
${{ matrix.name }}
|
||||
BUILD_INFO.txt
|
||||
retention-days: 7
|
||||
|
||||
build-windows:
|
||||
if: ${{ inputs.build_group == 'windows' || inputs.build_group == 'all' }}
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
LIBGHOSTTY_VT_OPTIMIZE: ${{ inputs.libghostty_optimize }}
|
||||
LIBGHOSTTY_VT_SIMD: ${{ inputs.libghostty_simd }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-pc-windows-msvc
|
||||
|
||||
- name: Install Zig
|
||||
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
|
||||
with:
|
||||
version: 0.15.2
|
||||
|
||||
- name: Remove Zig caches
|
||||
shell: pwsh
|
||||
run: |
|
||||
Remove-Item -Recurse -Force .zig-cache -ErrorAction SilentlyContinue
|
||||
Remove-Item -Recurse -Force vendor/libghostty-vt/.zig-cache -ErrorAction SilentlyContinue
|
||||
Remove-Item -Recurse -Force vendor/libghostty-vt/zig-out -ErrorAction SilentlyContinue
|
||||
|
||||
- name: Build
|
||||
run: cargo build --release --locked --target x86_64-pc-windows-msvc
|
||||
|
||||
- name: Package artifact
|
||||
shell: pwsh
|
||||
run: |
|
||||
Copy-Item target\x86_64-pc-windows-msvc\release\herdr.exe herdr-windows-x86_64.exe
|
||||
"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
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: herdr-windows-x86_64-${{ inputs.libghostty_optimize }}-simd-${{ inputs.libghostty_simd }}
|
||||
path: |
|
||||
herdr-windows-x86_64.exe
|
||||
BUILD_INFO.txt
|
||||
retention-days: 7
|
||||
|
||||
@@ -76,3 +76,79 @@ jobs:
|
||||
|
||||
- name: Run checks
|
||||
run: just ci '${{ matrix.nextest_filter }}'
|
||||
|
||||
check-windows:
|
||||
name: check (windows)
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-pc-windows-msvc
|
||||
|
||||
- name: Install Rust tools
|
||||
uses: taiki-e/install-action@b550161ef8a7bc4f2a671c0b03a18ac9ccedea1e # v2
|
||||
with:
|
||||
tool: cargo-nextest
|
||||
|
||||
- name: Install Zig
|
||||
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
|
||||
with:
|
||||
version: 0.15.2
|
||||
|
||||
- name: Restore cargo cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-bin: false
|
||||
key: windows-x86_64-pc-windows-msvc
|
||||
|
||||
- name: Run Windows checks
|
||||
shell: pwsh
|
||||
run: |
|
||||
cargo fmt --check
|
||||
cargo clippy --bin herdr --locked --target x86_64-pc-windows-msvc -- -D warnings
|
||||
cargo nextest run --locked --target x86_64-pc-windows-msvc -E "binary(herdr)" --status-level fail --final-status-level slow --failure-output final --success-output never
|
||||
cargo build --locked --target x86_64-pc-windows-msvc
|
||||
|
||||
- name: Smoke ConPTY pane
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:HERDR_SESSION = "ci-windows-$env:GITHUB_RUN_ID-$env:GITHUB_RUN_ATTEMPT"
|
||||
$exe = Join-Path $PWD "target\x86_64-pc-windows-msvc\debug\herdr.exe"
|
||||
|
||||
& $exe --version
|
||||
& $exe --default-config | Out-Null
|
||||
|
||||
$server = Start-Process -FilePath $exe -ArgumentList "server" -PassThru -WindowStyle Hidden
|
||||
try {
|
||||
$deadline = (Get-Date).AddSeconds(10)
|
||||
do {
|
||||
Start-Sleep -Milliseconds 250
|
||||
$status = & $exe status server 2>&1
|
||||
if ($LASTEXITCODE -eq 0 -and (($status -join "`n") -match "status: running")) {
|
||||
break
|
||||
}
|
||||
} while ((Get-Date) -lt $deadline)
|
||||
|
||||
if ((Get-Date) -ge $deadline) {
|
||||
throw "server did not become ready"
|
||||
}
|
||||
|
||||
& $exe agent start smoke -- "$env:ComSpec" /K dir
|
||||
Start-Sleep -Seconds 2
|
||||
$read = & $exe agent read smoke --source recent --lines 40 --format text
|
||||
$text = $read -join "`n"
|
||||
if ($text -notmatch "Directory of") {
|
||||
throw "pane read did not include cmd.exe directory output: $text"
|
||||
}
|
||||
} finally {
|
||||
& $exe server stop 2>$null
|
||||
Wait-Process -Id $server.Id -Timeout 10 -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user