|
1 | | -# .github/workflows/cross_platform_test.yml |
2 | | -name: Cross-Platform Sanity Check |
| 1 | +name: "🚀 Windows - Omnipkg Demo Test (CI - No Redis)" |
| 2 | + |
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: |
6 | | - - development |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
7 | 8 | workflow_dispatch: |
8 | | - inputs: |
9 | | - branch: |
10 | | - description: 'The branch to test' |
11 | | - required: true |
12 | | - default: 'development' |
13 | | - type: choice |
14 | | - options: |
15 | | - - development |
16 | | - - main |
17 | | - - staging |
| 9 | + |
18 | 10 | jobs: |
19 | | - sanity-check: |
20 | | - strategy: |
21 | | - fail-fast: false |
22 | | - matrix: |
23 | | - os: [ubuntu-latest, macos-latest, windows-latest] |
24 | | - runs-on: ${{ matrix.os }} |
| 11 | + test: |
| 12 | + runs-on: windows-latest |
| 13 | + |
25 | 14 | steps: |
26 | 15 | - name: Checkout repository |
27 | 16 | uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Set up Python (3.11) |
| 19 | + uses: actions/setup-python@v5 |
28 | 20 | with: |
29 | | - ref: ${{ github.event.inputs.branch || 'development' }} |
| 21 | + python-version: '3.11' |
| 22 | + |
| 23 | + - name: Install omnipkg |
| 24 | + run: | |
| 25 | + python -m pip install --upgrade pip |
| 26 | + pip install -e . |
| 27 | + shell: pwsh |
| 28 | + |
| 29 | + - name: Install rich via omnipkg |
| 30 | + run: | |
| 31 | + python -m omnipkg.cli install rich |
| 32 | + shell: pwsh |
30 | 33 |
|
31 | | - - name: Display selected branch and OS |
| 34 | + - name: Configure omnipkg for non-interactive use |
32 | 35 | run: | |
33 | | - echo "Testing on: ${{ matrix.os }}" |
34 | | - echo "Branch: ${{ github.event.inputs.branch || 'development' }}" |
| 36 | + $configDir = "$HOME\.config\omnipkg" |
| 37 | + New-Item -ItemType Directory -Force -Path $configDir | Out-Null |
| 38 | + |
| 39 | + $config = @{ |
| 40 | + interactive = $false |
| 41 | + auto_confirm = $true |
| 42 | + } |
| 43 | + |
| 44 | + $config | ConvertTo-Json -Depth 4 | Out-File -FilePath "$configDir\config.json" -Encoding utf8 |
| 45 | + |
| 46 | + Write-Host "✅ Omnipkg configured for non-interactive use" |
| 47 | + Get-Content "$configDir\config.json" |
| 48 | + shell: pwsh |
35 | 49 |
|
36 | | - - name: Wipe previous omnipkg config (Windows) |
| 50 | + - name: Adopt Python Versions (Pre-warm) |
37 | 51 | run: | |
38 | | - if (Test-Path ~\.config\omnipkg) { |
39 | | - Remove-Item ~\.config\omnipkg -Recurse -Force |
40 | | - Write-Host "Cleared omnipkg config" |
41 | | - } else { |
42 | | - Write-Host "No previous omnipkg config found" |
| 52 | + Write-Host "--- Adopting Python Versions ---" |
| 53 | + |
| 54 | + Write-Host "Adopting Python 3.9..." |
| 55 | + python -m omnipkg.cli python adopt 3.9 2>&1 | Out-Null |
| 56 | + if ($LASTEXITCODE -ne 0) { |
| 57 | + Write-Host "⚠️ Python 3.9 adoption returned exit code $LASTEXITCODE (continuing anyway)" |
| 58 | + } |
| 59 | + |
| 60 | + Write-Host "Adopting Python 3.10..." |
| 61 | + python -m omnipkg.cli python adopt 3.10 2>&1 | Out-Null |
| 62 | + if ($LASTEXITCODE -ne 0) { |
| 63 | + Write-Host "⚠️ Python 3.10 adoption returned exit code $LASTEXITCODE (continuing anyway)" |
43 | 64 | } |
| 65 | + |
| 66 | + Write-Host "✅ Python versions adopted (or already present)" |
44 | 67 | shell: pwsh |
45 | | - if: runner.os == 'Windows' |
46 | | - continue-on-error: true |
47 | | - |
48 | | - - name: Wipe previous omnipkg config (Linux/macOS) |
| 68 | + |
| 69 | + - name: Prime Python Environments with Timeout |
| 70 | + timeout-minutes: 5 |
49 | 71 | run: | |
50 | | - if [ -d ~/.config/omnipkg ]; then |
51 | | - rm -rf ~/.config/omnipkg |
52 | | - echo "Cleared omnipkg config" |
53 | | - else |
54 | | - echo "No previous omnipkg config found" |
55 | | - fi |
56 | | - if: runner.os != 'Windows' |
| 72 | + Write-Host "--- Priming Python environments (with timeout) ---" |
| 73 | + |
| 74 | + $PYTHON_INFO = python -m omnipkg.cli info python 2>&1 | Out-String |
| 75 | + if ($LASTEXITCODE -ne 0) { |
| 76 | + Write-Host "❌ Failed to get Python info" |
| 77 | + exit 1 |
| 78 | + } |
| 79 | + |
| 80 | + # Parse Python versions |
| 81 | + $versions = @() |
| 82 | + foreach ($line in ($PYTHON_INFO -split '\r?\n')) { |
| 83 | + if ($line -match 'Python (\d\.\d+):(.+)') { |
| 84 | + $version = $matches[1] |
| 85 | + $path = ($matches[2].Trim() -split '\s+')[0] |
| 86 | + |
| 87 | + if ($path -and (Test-Path $path)) { |
| 88 | + $versions += @{Version = $version; Path = $path} |
| 89 | + Write-Host "Found Python $version" |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + if ($versions.Count -eq 0) { |
| 95 | + Write-Host "⚠️ No Python versions found to prime, skipping..." |
| 96 | + exit 0 |
| 97 | + } |
| 98 | + |
| 99 | + # Try each version sequentially with individual timeouts |
| 100 | + foreach ($pyInfo in $versions) { |
| 101 | + $version = $pyInfo.Version |
| 102 | + $pyExe = $pyInfo.Path |
| 103 | + |
| 104 | + Write-Host "" |
| 105 | + Write-Host "🔄 Priming Python $version..." |
| 106 | + |
| 107 | + try { |
| 108 | + $job = Start-Job -ScriptBlock { |
| 109 | + param($exe) |
| 110 | + & $exe -m omnipkg.cli reset --yes 2>&1 |
| 111 | + return $LASTEXITCODE |
| 112 | + } -ArgumentList $pyExe |
| 113 | + |
| 114 | + # Wait max 90 seconds per version |
| 115 | + $completed = Wait-Job -Job $job -Timeout 90 |
| 116 | + |
| 117 | + if ($completed) { |
| 118 | + $exitCode = Receive-Job -Job $job |
| 119 | + Remove-Job -Job $job -Force |
| 120 | + |
| 121 | + if ($exitCode -eq 0) { |
| 122 | + Write-Host "✅ Python $version primed successfully" |
| 123 | + } else { |
| 124 | + Write-Host "⚠️ Python $version priming failed (exit $exitCode) - continuing anyway" |
| 125 | + } |
| 126 | + } else { |
| 127 | + Write-Host "⚠️ Python $version priming timed out after 90s - stopping it" |
| 128 | + Stop-Job -Job $job |
| 129 | + Remove-Job -Job $job -Force |
| 130 | + Write-Host " This version might have issues, but continuing..." |
| 131 | + } |
| 132 | + } catch { |
| 133 | + Write-Host "⚠️ Python $version priming error: $($_.Exception.Message)" |
| 134 | + Write-Host " Continuing anyway..." |
| 135 | + } |
| 136 | + } |
| 137 | + |
| 138 | + Write-Host "" |
| 139 | + Write-Host "✅ Priming complete (some versions may have been skipped)" |
| 140 | + shell: pwsh |
57 | 141 | continue-on-error: true |
58 | | - |
59 | | - - name: Set up Python |
60 | | - uses: actions/setup-python@v5 |
61 | | - with: |
62 | | - python-version: '3.10' |
63 | | - |
64 | | - - name: Install omnipkg |
65 | | - run: pip install -e . |
66 | | - |
67 | | - - name: Configure omnipkg for non-interactive use |
| 142 | + |
| 143 | + - name: Pre-Install Test Packages (Cache Warm) |
68 | 144 | run: | |
69 | | - if [ "$RUNNER_OS" == "Windows" ]; then |
70 | | - mkdir -p ~/.config/omnipkg |
71 | | - echo '{"interactive": false, "auto_confirm": true}' > ~/.config/omnipkg/config.json |
72 | | - else |
73 | | - mkdir -p ~/.config/omnipkg |
74 | | - echo '{"interactive": false, "auto_confirm": true}' > ~/.config/omnipkg/config.json |
75 | | - fi |
76 | | - shell: bash |
77 | | - |
78 | | - - name: Run Demo (Let it handle everything) |
| 145 | + Write-Host "--- Pre-installing test packages ---" |
| 146 | + |
| 147 | + $PYTHON_INFO = python -m omnipkg.cli info python 2>&1 |
| 148 | + if ($LASTEXITCODE -ne 0) { |
| 149 | + Write-Host "❌ Failed to get Python info" |
| 150 | + exit 1 |
| 151 | + } |
| 152 | + |
| 153 | + $PYTHON_39_EXE = ($PYTHON_INFO -split '\r?\n' | Select-String -Pattern 'Python 3.9:' | ForEach-Object { |
| 154 | + $parts = $_ -split ':', 2 |
| 155 | + if ($parts.Length -eq 2) { ($parts[1].Trim()).Split(' ')[0] } |
| 156 | + }) |
| 157 | + $PYTHON_310_EXE = ($PYTHON_INFO -split '\r?\n' | Select-String -Pattern 'Python 3.10:' | ForEach-Object { |
| 158 | + $parts = $_ -split ':', 2 |
| 159 | + if ($parts.Length -eq 2) { ($parts[1].Trim()).Split(' ')[0] } |
| 160 | + }) |
| 161 | + $PYTHON_311_EXE = ($PYTHON_INFO -split '\r?\n' | Select-String -Pattern 'Python 3.11:' | ForEach-Object { |
| 162 | + $parts = $_ -split ':', 2 |
| 163 | + if ($parts.Length -eq 2) { ($parts[1].Trim()).Split(' ')[0] } |
| 164 | + }) |
| 165 | + |
| 166 | + if ($PYTHON_39_EXE -and (Test-Path $PYTHON_39_EXE)) { |
| 167 | + Write-Host "Installing rich==13.4.2 for Python 3.9..." |
| 168 | + & $PYTHON_39_EXE -m omnipkg.cli install rich==13.4.2 2>&1 | Out-Null |
| 169 | + } |
| 170 | + if ($PYTHON_310_EXE -and (Test-Path $PYTHON_310_EXE)) { |
| 171 | + Write-Host "Installing rich==13.6.0 for Python 3.10..." |
| 172 | + & $PYTHON_310_EXE -m omnipkg.cli install rich==13.6.0 2>&1 | Out-Null |
| 173 | + } |
| 174 | + if ($PYTHON_311_EXE -and (Test-Path $PYTHON_311_EXE)) { |
| 175 | + Write-Host "Installing rich==13.7.1 for Python 3.11..." |
| 176 | + & $PYTHON_311_EXE -m omnipkg.cli install rich==13.7.1 2>&1 | Out-Null |
| 177 | + } |
| 178 | + |
| 179 | + Write-Host "✅ Test packages pre-installed." |
| 180 | + shell: pwsh |
| 181 | + |
| 182 | + - name: Run Demo (Option 8 - Quantum Multiverse) |
79 | 183 | run: | |
80 | | - echo "--- Running Omnipkg Demo ---" |
81 | | - echo "Demo will handle adoption, installation, and KB rebuild automatically" |
82 | | - echo "" |
| 184 | + Write-Host "--- Running Omnipkg Demo: Quantum Multiverse ---" |
| 185 | + Write-Host "" |
| 186 | + |
| 187 | + # Run demo with option 8 (non-interactive via stdin) |
83 | 188 | echo "8" | python -m omnipkg.cli demo |
84 | | - shell: bash |
85 | | - env: |
86 | | - PYTHONUTF8: "1" |
| 189 | + |
| 190 | + $exitCode = $LASTEXITCODE |
| 191 | + Write-Host "" |
| 192 | + Write-Host "Demo exit code: $exitCode" |
| 193 | + |
| 194 | + if ($exitCode -eq 0) { |
| 195 | + Write-Host "✅ Demo completed successfully! (Should be fast ~500ms)" |
| 196 | + exit 0 |
| 197 | + } else { |
| 198 | + Write-Host "❌ Demo failed with exit code: $exitCode" |
| 199 | + exit $exitCode |
| 200 | + } |
| 201 | + shell: pwsh |
0 commit comments