name: Windows CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: windows-latest
env:
VENV_DIR: .\.venv # single source of truth
VENV_BIN: .\.venv\Scripts # helper so paths stay short
steps:
- uses: actions/checkout@v4
# ──────────────────────────────────────────
# Python / deps
# ──────────────────────────────────────────
- name: Set-up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install deps with uv
shell: pwsh
run: |
python -m pip install --upgrade pip
pip install uv
uv venv $env:VENV_DIR
& $env:VENV_BIN\Activate.ps1
uv pip install -e .[dev]
# ──────────────────────────────────────────
# Unit tests on host Windows
# ──────────────────────────────────────────
- name: Run pytest (host)
shell: pwsh
run: |
& $env:VENV_BIN\Activate.ps1
pytest -v
# ──────────────────────────────────────────
# Provision WSL (Ubuntu 22.04)
# ──────────────────────────────────────────
- name: Enable WSL (Ubuntu 22.04)
uses: Vampire/setup-wsl@v5
with:
distribution: Ubuntu-22.04 # pre-installed on GH runners
# ──────────────────────────────────────────
# Create a tiny project inside WSL
# ──────────────────────────────────────────
- name: Create sample project in WSL
shell: pwsh
run: |
wsl bash -c 'mkdir -p /home/runner/testproj && echo hi > /home/runner/testproj/hello.txt'
# ──────────────────────────────────────────
# Start WSL & warm-up the \\wsl$ UNC share
# ──────────────────────────────────────────
- name: Start WSL & warm-up UNC share
shell: pwsh
run: |
$ErrorActionPreference = 'Continue' # keep the build going even if UNC warm-up fails
# helper: first listed distro, with NULs stripped
$distro = wsl -l -q |
ForEach-Object { ($_ -replace "`0",'').Trim() } |
Select-Object -First 1
if (-not $distro) {
Write-Host "No WSL distro found – skipping warm-up"
exit 0
}
Write-Host "Starting WSL distro $distro …"
wsl -d $distro -e sh -c 'true'
$unc = "\\\\wsl$\\$distro\\home\\runner\\testproj"
Write-Host "Warming up UNC path $unc"
$tries = 0
while (-not (Test-Path -LiteralPath $unc) -and $tries -lt 20) {
Start-Sleep -Milliseconds 300
$tries++
}
if (-not (Test-Path -LiteralPath $unc)) {
Write-Host "UNC still not available after $($tries*300) ms – continuing anyway"
} else {
Write-Host "UNC is available."
}
# ──────────────────────────────────────────
# Smoke-tests jinni path translation
# ──────────────────────────────────────────
- name: Smoke test vscode-remote URI
shell: pwsh
run: |
$distro = wsl -l -q |
ForEach-Object { ($_ -replace "`0",'').Trim() } |
Select-Object -First 1
if (-not $distro) { throw "Could not determine WSL distro name." }
$uri = "vscode-remote://wsl+$distro/home/runner/testproj"
Write-Host "Testing URI: $uri"
& $env:VENV_BIN\Activate.ps1
& $env:VENV_BIN\jinni.exe --list-only $uri | Select-String 'hello.txt'
- name: Smoke test POSIX path
shell: pwsh
run: |
$distro = wsl -l -q |
ForEach-Object { ($_ -replace "`0",'').Trim() } |
Select-Object -First 1
if (-not $distro) { throw "Could not determine WSL distro name." }
Write-Host "Assuming WSL distro for POSIX path test: $distro"
& $env:VENV_BIN\Activate.ps1
$env:JINNI_ASSUME_WSL_DISTRO = $distro
& $env:VENV_BIN\jinni.exe --list-only '/home/runner/testproj' |
Select-String 'hello.txt'
# ──────────────────────────────────────────
# Run WSL-specific unit tests on host
# ──────────────────────────────────────────
- name: Run pytest (WSL path utils)
shell: pwsh
run: |
Write-Host "Running WSL path translation tests..."
& $env:VENV_BIN\Activate.ps1
pytest tests/test_utils_wsl.py -v