From 7facab8ded33530fc3ab9d85223c883ac57fe275 Mon Sep 17 00:00:00 2001 From: David Anyatonwu Date: Fri, 6 Sep 2024 04:23:59 +0100 Subject: [PATCH] changes Signed-off-by: David Anyatonwu --- .github/workflows/ci.yml | 25 +++++++++++++++++++------ scripts/simulate_screen_activity.ps1 | 4 ++-- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 653d99a33..8808ec8e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -157,21 +157,22 @@ jobs: run: | sudo apt-get update sudo apt-get install -y xvfb pulseaudio ffmpeg imagemagick xdotool x11-xserver-utils xterm openbox alsa-utils - Xvfb :99 -ac -screen 0 1024x768 & + Xvfb :99 -ac -screen 0 1024x768x24 & export DISPLAY=:99 echo "DISPLAY=:99" >> $GITHUB_ENV - sleep 2 + sleep 5 openbox & - sleep 2 + sleep 5 pulseaudio --start pactl load-module module-null-sink sink_name=virtual_speaker pactl set-default-sink virtual_speaker pactl load-module module-virtual-source source_name=virtual_mic master=virtual_speaker.monitor pactl set-default-source virtual_mic - sleep 2 + sleep 5 xwininfo -root -tree || true chmod +x ./scripts/launch_test_window.sh ./scripts/launch_test_window.sh & + sleep 5 - name: Simulate screen and audio activity (Ubuntu) if: matrix.os == 'ubuntu-latest' @@ -188,9 +189,15 @@ jobs: echo "DISPLAY=$DISPLAY" xdpyinfo || true DISPLAY=:99 RUST_LOG=debug ./target/release/screenpipe --data-dir ./test_data --fps 1 > screenpipe_output.log 2>&1 & - cat screenpipe_output.log + CLI_PID=$! + sleep 10 # Give CLI some time to start up for i in {1..24}; do sleep 10 + if ! ps -p $CLI_PID > /dev/null; then + echo "CLI process has died" + cat screenpipe_output.log + exit 1 + fi response=$(curl -s http://localhost:3030/health) echo "$response" status=$(echo "$response" | jq -r '.status') @@ -230,7 +237,9 @@ jobs: - name: Run CLI and check health (Windows) if: matrix.os == 'windows-latest' run: | - Start-Process -FilePath .\target\release\screenpipe.exe -ArgumentList "--data-dir", ".\test_data" -NoNewWindow + $env:RUST_LOG = "debug" + Start-Process -FilePath .\target\release\screenpipe.exe -ArgumentList "--data-dir", ".\test_data" -NoNewWindow -PassThru -RedirectStandardOutput screenpipe_output.log -RedirectStandardError screenpipe_error.log + Start-Sleep -Seconds 10 # Give CLI some time to start up Start-Process -FilePath powershell -ArgumentList "-File", ".\scripts\simulate_screen_activity.ps1" -NoNewWindow Start-Process -FilePath powershell -ArgumentList "-File", ".\scripts\simulate_audio_activity.ps1" -NoNewWindow $attempts = 24 @@ -249,7 +258,11 @@ jobs: } Write-Output "Current processes:" Get-Process | Where-Object { $_.Name -match 'screenpipe|powershell' } | Format-Table -AutoSize + Write-Output "Screenpipe log tail:" + Get-Content .\test_data\logs\screenpipe.log -Tail 50 } Write-Error "Health check failed after 4 minutes" + Get-Content screenpipe_output.log + Get-Content screenpipe_error.log Get-Content .\test_data\logs\screenpipe.log exit 1 diff --git a/scripts/simulate_screen_activity.ps1 b/scripts/simulate_screen_activity.ps1 index 607995291..f214404a0 100644 --- a/scripts/simulate_screen_activity.ps1 +++ b/scripts/simulate_screen_activity.ps1 @@ -3,8 +3,8 @@ Add-Type -AssemblyName System.Windows.Forms while ($true) { # Simulate mouse movement for ($i = 0; $i -lt 20; $i++) { - $x = Get-Random -Minimum 0 -Maximum 1024 - $y = Get-Random -Minimum 0 -Maximum 768 + $x = Get-Random -Minimum 0 -Maximum ([System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width) + $y = Get-Random -Minimum 0 -Maximum ([System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height) [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y) Start-Sleep -Milliseconds 200 }