Skip to content

Commit

Permalink
works?
Browse files Browse the repository at this point in the history
Signed-off-by: David Anyatonwu <[email protected]>
  • Loading branch information
onyedikachi-david committed Sep 6, 2024
1 parent f28b651 commit a3b8924
Showing 1 changed file with 93 additions and 100 deletions.
193 changes: 93 additions & 100 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,127 +148,120 @@ jobs:
sudo apt-get install -y libx11-dev libxcb1-dev
sudo apt-get install -y scrot
sudo apt-get install -y libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev
sudo apt-get install -y xterm openbox alsa-utils
- name: Build CLI
run: cargo build --release --bin screenpipe

- name: Debug setup (Ubuntu)
- name: Set up virtual display and audio (Ubuntu)
if: matrix.os == 'ubuntu-latest'
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 1024x768x24 &
export DISPLAY=:99
echo "DISPLAY=:99" >> $GITHUB_ENV
sleep 5
openbox &
sleep 5
pulseaudio --start
sleep 2
pacmd load-module module-null-sink sink_name=virtual_speaker
pacmd set-default-sink virtual_speaker
pacmd load-module module-virtual-source source_name=virtual_mic master=virtual_speaker.monitor
pacmd set-default-source virtual_mic
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 5
xwininfo -root -tree || true
chmod +x ./scripts/launch_test_window.sh
./scripts/launch_test_window.sh &
sleep 5
# Debug information
echo "X11 setup:"
xdpyinfo | head -n 10
echo "Window list:"
xwininfo -root -tree
echo "Audio setup:"
pacmd list-sinks
pacmd list-sources
pactl list short sinks
pactl list short sources
echo "Environment variables:"
env | grep -E 'DISPLAY|XAUTHORITY|PULSE'
echo "Process list:"
ps aux | grep -E 'Xvfb|pulseaudio|openbox'
- name: Simulate screen and audio activity (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
chmod +x ./scripts/simulate_screen_activity.sh
chmod +x ./scripts/simulate_audio_activity.sh
DISPLAY=:99 ./scripts/simulate_screen_activity.sh &
./scripts/simulate_audio_activity.sh &
- name: Debug CLI execution (Ubuntu)
- name: Run CLI and check health (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
export DISPLAY=:99
mkdir -p ./test_data/logs
echo "Starting screenpipe CLI..."
RUST_LOG=debug ./target/release/screenpipe --data-dir ./test_data --fps 1 --disable-audio &
echo "DISPLAY=$DISPLAY"
xdpyinfo || true
DISPLAY=:99 RUST_LOG=debug ./target/release/screenpipe --data-dir ./test_data --fps 1 > screenpipe_output.log 2>&1 &
CLI_PID=$!
sleep 20 # Increase wait time to 20 seconds
echo "Checking if CLI is running:"
if ps -p $CLI_PID > /dev/null; then
echo "CLI is running with PID $CLI_PID"
else
echo "CLI process has died"
cat screenpipe_output.log
exit 1
fi
echo "Attempting to query health endpoint:"
curl -v http://localhost:3030/health || true
echo "CLI output:"
cat ./test_data/logs/screenpipe.log || true
echo "Killing CLI process"
kill $CLI_PID || true
- name: Debug setup (Windows)
if: matrix.os == 'windows-latest'
run: |
Write-Output "Display information:"
Get-WmiObject -Class Win32_VideoController | Format-List Name, VideoModeDescription
Write-Output "Audio devices:"
Get-WmiObject -Class Win32_SoundDevice | Format-List Name, Status
Write-Output "Environment variables:"
Get-ChildItem Env: | Where-Object { $_.Name -match 'DISPLAY|AUDIO' }
- name: Install FFmpeg (Windows)
if: matrix.os == 'windows-latest'
run: |
choco install ffmpeg -y
refreshenv
- name: Debug CLI execution (Windows)
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')
frame_status=$(echo "$response" | jq -r '.frame_status')
audio_status=$(echo "$response" | jq -r '.audio_status')
if [[ "$status" == "Healthy" && "$frame_status" == "OK" && "$audio_status" == "OK" ]]; then
echo "Health check passed"
exit 0
fi
# Debug information
echo "Iteration $i: Current window list"
DISPLAY=:99 xwininfo -root -children
echo "Current processes:"
ps aux | grep -E 'Xvfb|xterm|screenpipe|simulate|openbox'
echo "Screenshot exists:"
ls -l /tmp/screenshot.png
echo "Screenshot content:"
file /tmp/screenshot.png
echo "X11 environment variables:"
env | grep -E 'DISPLAY|XAUTHORITY'
echo "X11 server check:"
xdpyinfo | head -n 5
echo "Audio devices:"
aplay -l
echo "PulseAudio status:"
pactl info
echo "Screenpipe log tail:"
tail -n 50 ./test_data/logs/screenpipe.log
done
echo "Health check failed after 4 minutes"
echo "Xvfb log:"
cat /var/log/Xvfb.0.log
echo "screenpipe log:"
cat ./test_data/logs/screenpipe.log
exit 1
- name: Run CLI and check health (Windows)
if: matrix.os == 'windows-latest'
run: |
$env:RUST_LOG = "debug"
$env:PATH += ";C:\Program Files\FFmpeg\bin"
New-Item -ItemType Directory -Force -Path .\test_data\logs
Write-Output "Starting screenpipe CLI..."
Start-Process -FilePath .\target\release\screenpipe.exe -ArgumentList "--data-dir", ".\test_data", "--fps", "1", "--disable-audio" -NoNewWindow -PassThru -RedirectStandardOutput screenpipe_output.log -RedirectStandardError screenpipe_error.log
Start-Sleep -Seconds 20
Write-Output "Checking if CLI is running:"
$process = Get-Process screenpipe -ErrorAction SilentlyContinue
if ($process) {
Write-Output "CLI is running with PID $($process.Id)"
} else {
Write-Output "CLI process not found"
Get-Content screenpipe_output.log
Get-Content screenpipe_error.log
exit 1
}
Write-Output "Attempting to query health endpoint:"
try {
$response = Invoke-RestMethod -Uri http://localhost:3030/health -ErrorAction Stop
$response | ConvertTo-Json
} catch {
Write-Output "Error querying health endpoint: $_"
exit 1
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
$interval = 10
for ($i = 0; $i -lt $attempts; $i++) {
Start-Sleep -Seconds $interval
try {
$response = Invoke-RestMethod -Uri http://localhost:3030/health
$response | ConvertTo-Json
if ($response.status -eq "Healthy" -and $response.frame_status -eq "OK" -and $response.audio_status -eq "OK") {
Write-Output "Health check passed"
exit 0
}
} catch {
Write-Output "Error occurred while checking health: $_"
}
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-Output "CLI output:"
Get-Content .\test_data\logs\screenpipe.log -ErrorAction SilentlyContinue
Get-Content screenpipe_output.log -ErrorAction SilentlyContinue
Get-Content screenpipe_error.log -ErrorAction SilentlyContinue
Write-Output "Stopping CLI process"
Stop-Process -Name screenpipe -ErrorAction SilentlyContinue
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

0 comments on commit a3b8924

Please sign in to comment.