diff --git a/.gitea/workflows/windows-smoke.yml b/.gitea/workflows/windows-smoke.yml index 084e2bd..1c1ba77 100644 --- a/.gitea/workflows/windows-smoke.yml +++ b/.gitea/workflows/windows-smoke.yml @@ -5,7 +5,8 @@ # (playwright-core over CDP): boots to the login screen, local server address, # microphone permission for the app and not for a foreign page, the call page's # own origin + isolation, the Credential Manager round trip. Features a build -# doesn't have are reported "n/a". +# doesn't have are reported "n/a". Then it updates the app while it is running, +# the way the auto-updater does (#1). # # Run it from the Actions tab (workflow_dispatch): # - no `ref`: tests the published nightly installer (a couple of minutes); @@ -121,6 +122,39 @@ jobs: try { (Invoke-WebRequest -UseBasicParsing http://localhost:44548/ -TimeoutSec 5).StatusCode | Write-Host } catch { Write-Host "44548: $($_.Exception.Message)" } node smoke-deps\windows-smoke.mjs smoke-out + # cinny-desktop #1: an auto-update over the RUNNING app. tauri-plugin-updater + # starts the installer in passive update mode (/P /UPDATE) and the app then + # exits; if it was slow to let go of cinny.exe, NSIS stopped on "Error opening + # file for writing". The installer's pre-install hook (src-tauri/nsis/ + # hooks.nsh) now waits for the file to be writable. Here the app stays up 3 s + # after the installer starts, then goes. Pass = the installer finishes on its + # own (no dialog), exits 0, and has rewritten cinny.exe (its timestamp was set + # to 2000 first; NSIS writes the build's own timestamp back). + - name: Update over the running app (#1) + shell: powershell + run: | + Get-Process cinny -ErrorAction SilentlyContinue | Stop-Process -Force + $app = Join-Path $env:LOCALAPPDATA 'Lotus Chat\cinny.exe' + (Get-Item $app).LastWriteTime = Get-Date '2000-01-01' + Start-Process $app + Start-Sleep -Seconds 10 + if (-not (Get-Process cinny -ErrorAction SilentlyContinue)) { Write-Error 'app did not start'; exit 1 } + $inst = Start-Process smoke-installer\setup.exe -ArgumentList '/P', '/UPDATE' -PassThru + Start-Sleep -Seconds 3 + Get-Process cinny -ErrorAction SilentlyContinue | Stop-Process -Force + if (-not $inst.WaitForExit(90000)) { + Write-Host '--- windows with a title (an error dialog would be here)' + Get-Process | Where-Object { $_.MainWindowTitle } | Select-Object Name, MainWindowTitle | Format-Table | Out-String | Write-Host + $inst | Stop-Process -Force + Write-Error 'installer did not finish within 90 s (stuck on a dialog?)' + exit 1 + } + $written = (Get-Item $app).LastWriteTime + Write-Host "installer exit code $($inst.ExitCode); cinny.exe timestamp now $written" + if ($inst.ExitCode -ne 0) { Write-Error "installer exit code $($inst.ExitCode)"; exit 1 } + if ($written -lt (Get-Date '2001-01-01')) { Write-Error 'cinny.exe was not rewritten'; exit 1 } + Get-Process cinny -ErrorAction SilentlyContinue | Stop-Process -Force + - name: Stop the app if: ${{ always() }} shell: powershell