Skip to content

Windows Daemon Test - Fire and Forget #12

Windows Daemon Test - Fire and Forget

Windows Daemon Test - Fire and Forget #12

name: "Windows Daemon Test - Improved"
on:
workflow_dispatch:
push:
branches: ['**']
paths:
- 'omnipkg/**'
- '.github/workflows/windows_daemon.yml'
jobs:
windows-daemon-test:
name: "Windows Daemon Diagnostic Test"
runs-on: windows-latest
timeout-minutes: 15
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Configure UTF-8 Environment
shell: pwsh
run: |
# Force UTF-8 for all Python I/O operations
[System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8
[System.Console]::InputEncoding = [System.Text.Encoding]::UTF8
echo "PYTHONIOENCODING=utf-8" >> $env:GITHUB_ENV
echo "PYTHONUTF8=1" >> $env:GITHUB_ENV
echo "PYTHONLEGACYWINDOWSSTDIO=utf-8" >> $env:GITHUB_ENV
Write-Host "UTF-8 encoding configured"
- name: Install Omnipkg
shell: pwsh
run: |
python -m pip install --upgrade pip
pip install -e .
Write-Host "Omnipkg installed"
- name: Generate Config (No Emojis)
shell: pwsh
run: |
$configDir = "$env:USERPROFILE\.config\omnipkg"
New-Item -ItemType Directory -Force -Path $configDir | Out-Null
$config = @{
interactive = $false
auto_confirm = $true
daemon_port = 5678
log_level = "DEBUG"
}
$config | ConvertTo-Json | Out-File -FilePath "$configDir\config.json" -Encoding utf8
Write-Host "Config created at: $configDir\config.json"
Get-Content "$configDir\config.json"
- name: Pre-create Log Directory
shell: pwsh
run: |
# Create potential log directories ahead of time
$logDirs = @(
"$env:USERPROFILE\.omnipkg\logs",
"$env:USERPROFILE\.config\omnipkg\logs",
"$env:LOCALAPPDATA\omnipkg\logs",
"$env:TEMP\omnipkg"
)
foreach ($dir in $logDirs) {
New-Item -ItemType Directory -Force -Path $dir | Out-Null
Write-Host "Created: $dir"
}
- name: Start Daemon with Verbose Output
id: start_daemon
continue-on-error: true
shell: pwsh
run: |
Write-Host "============================================"
Write-Host "Starting Omnipkg Daemon"
Write-Host "============================================"
# Capture both stdout and stderr
$output = omnipkg daemon start 2>&1
$exitCode = $LASTEXITCODE
Write-Host "Output:"
Write-Host $output
Write-Host "Exit Code: $exitCode"
# Wait for daemon initialization
Start-Sleep -Seconds 8
exit $exitCode
- name: Check Daemon Status
if: steps.start_daemon.outcome == 'success'
shell: pwsh
run: |
Write-Host "Checking daemon status..."
omnipkg daemon status
if ($LASTEXITCODE -ne 0) {
Write-Error "Daemon status check failed"
exit 1
}
Write-Host "Daemon is running"
- name: Test Daemon Functionality
if: steps.start_daemon.outcome == 'success'
continue-on-error: true
shell: pwsh
run: |
Write-Host "Testing daemon with a simple command..."
omnipkg list --limit 5
- name: Stop Daemon
if: always()
continue-on-error: true
shell: pwsh
run: |
omnipkg daemon stop 2>&1
Start-Sleep -Seconds 2
# ════════════════════════════════════════════════════════════════
# COMPREHENSIVE LOG COLLECTION
# ════════════════════════════════════════════════════════════════
- name: Collect All Logs
if: always()
shell: pwsh
run: |
Write-Host "::group::Searching for Omnipkg Logs"
$searchPaths = @(
"$env:USERPROFILE\.omnipkg\logs",
"$env:USERPROFILE\.config\omnipkg\logs",
"$env:LOCALAPPDATA\omnipkg\logs",
"$env:TEMP\omnipkg",
"$env:USERPROFILE\AppData\Local\Temp\omnipkg"
)
$allLogs = @()
foreach ($path in $searchPaths) {
if (Test-Path $path) {
Write-Host "Checking: $path"
$logs = Get-ChildItem -Path $path -Filter "*.log" -Recurse -ErrorAction SilentlyContinue
if ($logs) {
Write-Host " Found $($logs.Count) log file(s)"
$allLogs += $logs
}
} else {
Write-Host " Path does not exist: $path"
}
}
Write-Host "::endgroup::"
if ($allLogs.Count -eq 0) {
Write-Host "::warning::No log files found!"
# Try broader search as fallback
Write-Host "Attempting broader search in TEMP and AppData..."
$broadLogs = Get-ChildItem -Path $env:TEMP -Filter "*omnipkg*.log" -Recurse -ErrorAction SilentlyContinue
$allLogs += $broadLogs
}
# Display all found logs
foreach ($log in $allLogs) {
Write-Host ""
Write-Host "================================================================"
Write-Host "LOG: $($log.FullName)"
Write-Host "SIZE: $($log.Length) bytes | MODIFIED: $($log.LastWriteTime)"
Write-Host "================================================================"
try {
$content = Get-Content $log.FullName -Raw -Encoding utf8 -ErrorAction Stop
Write-Host $content
} catch {
Write-Host "::error::Failed to read log: $_"
}
Write-Host ""
}
- name: Show Process Information
if: always()
shell: pwsh
run: |
Write-Host "::group::Active Python Processes"
Get-Process | Where-Object {$_.ProcessName -like "*python*"} | Format-Table -AutoSize
Write-Host "::endgroup::"
Write-Host "::group::Network Listeners on Port 5678"
netstat -ano | Select-String "5678"
Write-Host "::endgroup::"
- name: Upload Logs as Artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: windows-daemon-logs
path: |
${{ runner.temp }}/omnipkg/*.log
~/.omnipkg/logs/**/*.log
~/.config/omnipkg/logs/**/*.log
~/AppData/Local/omnipkg/logs/**/*.log
~/AppData/Local/Temp/omnipkg/**/*.log
if-no-files-found: warn
retention-days: 7