fix windows failure 2 #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# testing locally with act cli | |
# act -W .github/workflows/ci.yml --container-architecture linux/amd64 -env ACTIONS_RUNTIME_URL=http://host.docker.internal:8080/ --env ACTIONS_RUNTIME_TOKEN=foo --env ACTIONS_CACHE_URL=http://host.docker.internal:8080/ --artifact-server-path out -j build-ubuntu -P ubuntu-latest=-self-hosted --env-file .env --secret-file .secrets | |
name: Rust CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
test-ubuntu: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y tesseract-ocr libtesseract-dev libavformat-dev libavfilter-dev libavdevice-dev ffmpeg libasound2-dev libgtk-3-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev | |
sudo apt-get install -y libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev | |
- name: Copy test image | |
run: | | |
mkdir -p target/debug/deps | |
cp screenpipe-vision/tests/testing_OCR.png target/debug/deps/ | |
- name: Run tests | |
run: cargo test | |
test-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~\AppData\Local\cargo\ | |
target\ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: setup Bun | |
uses: oven-sh/setup-bun@v1 | |
- name: Run pre_build.js on | |
shell: bash | |
run: bun ./scripts/pre_build.js | |
working-directory: ./examples/apps/screenpipe-app-tauri | |
# - name: Run tests | |
# run: cargo test | |
- name: Copy test image | |
shell: bash | |
run: | | |
mkdir -p target/debug/deps || true | |
cp screenpipe-vision/tests/testing_OCR.png target/debug/deps/ | |
- name: Run specific Windows OCR test | |
run: cargo test test_process_ocr_task_windows | |
test-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~\AppData\Local\cargo\ | |
target\ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: setup Bun | |
uses: oven-sh/setup-bun@v1 | |
- name: Run pre_build.js on | |
shell: bash | |
env: | |
SKIP_SCREENPIPE_SETUP: true # avoid trying to copy screenpipe binaries, not yet built (next step) | |
run: bun ./scripts/pre_build.js | |
working-directory: ./examples/apps/screenpipe-app-tauri | |
- name: Copy test image | |
shell: bash | |
run: | | |
mkdir -p target/debug/deps || true | |
cp screenpipe-vision/tests/testing_OCR.png target/debug/deps/ | |
- name: Run specific Apple OCR test | |
shell: bash | |
env: | |
DYLD_LIBRARY_PATH: /Users/runner/work/screenpipe/screenpipe/screenpipe-vision/lib | |
run: cargo test test_apple_native_ocr | |
build-cli: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Install dependencies (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libasound2-dev libgtk-3-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev ffmpeg | |
sudo apt-get install -y libavutil-dev libavformat-dev libavfilter-dev libavdevice-dev | |
sudo apt-get install -y pkg-config xvfb pulseaudio xdotool x11-xserver-utils sox | |
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 | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
RUSTFLAGS: "-C target-cpu=native" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: screenpipe-${{ matrix.os }} | |
path: target/release/screenpipe* | |
test-cli-ubuntu: | |
needs: build-cli | |
runs-on: ubuntu-latest | |
timeout-minutes: 360 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: screenpipe-ubuntu-latest | |
path: . | |
- name: Install dependencies (Ubuntu) | |
timeout-minutes: 30 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y xvfb pulseaudio ffmpeg imagemagick xdotool x11-xserver-utils xterm openbox alsa-utils sox tesseract-ocr libtesseract-dev | |
- name: Setup display and window manager (Ubuntu) | |
timeout-minutes: 30 | |
run: | | |
# Start Xvfb | |
Xvfb :99 -ac -screen 0 1024x768x24 & | |
export DISPLAY=:99 | |
echo "DISPLAY=:99" >> $GITHUB_ENV | |
sleep 5 | |
# Start window manager | |
openbox & | |
sleep 5 | |
# Start a visible application | |
xterm -e "echo 'Test Window'; while true; do date; sleep 1; done" & | |
sleep 5 | |
- name: Setup audio (Ubuntu) | |
timeout-minutes: 30 | |
run: | | |
# Setup audio | |
pulseaudio --start | |
sleep 2 | |
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 | |
- name: Debug information (Ubuntu) | |
timeout-minutes: 30 | |
run: | | |
echo "Window list:" | |
xwininfo -root -tree | |
echo "Display info:" | |
xdpyinfo | head -n 20 | |
echo "Audio devices:" | |
pactl list short sinks | |
pactl list short sources | |
- name: Start simulations (Ubuntu) | |
timeout-minutes: 30 | |
run: | | |
# Start screen and audio simulation | |
chmod +x ./scripts/simulate_screen_activity.sh | |
chmod +x ./scripts/simulate_audio_activity.sh | |
./scripts/simulate_screen_activity.sh & | |
./scripts/simulate_audio_activity.sh & | |
- name: Run screenpipe and health checks (Ubuntu) | |
timeout-minutes: 30 | |
run: | | |
# Run screenpipe | |
chmod +x ./screenpipe | |
mkdir -p ./test_data/logs | |
RUST_LOG=debug,screenpipe=trace RUST_BACKTRACE=1 ./screenpipe --data-dir ./test_data --fps 1 > ./test_data/logs/screenpipe.log 2>&1 & | |
CLI_PID=$! | |
echo "Screenpipe PID: $CLI_PID" | |
# Wait longer for initialization | |
sleep 60 | |
# Check if screenpipe is still running | |
if ! ps -p $CLI_PID > /dev/null; then | |
echo "Screenpipe process has died" | |
cat ./test_data/logs/screenpipe.log | |
exit 1 | |
fi | |
# Health checks | |
for i in {1..30}; do | |
response=$(curl -s http://localhost:3030/health) | |
echo "Health check $i: $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 | |
# Check if screenpipe is still running | |
if ! ps -p $CLI_PID > /dev/null; then | |
echo "Screenpipe process has died during health checks" | |
break | |
fi | |
sleep 10 | |
done | |
echo "Health check failed after 5 minutes" | |
echo "Screenpipe log:" | |
cat ./test_data/logs/screenpipe.log | |
echo "Xvfb log:" | |
cat /tmp/.X99-lock | |
echo "Process list:" | |
ps aux | grep -E 'Xvfb|pulseaudio|openbox|xterm|screenpipe' | |
echo "Audio devices:" | |
pactl list short sinks | |
pactl list short sources | |
echo "Network connections:" | |
netstat -tuln | grep 3030 | |
exit 1 | |
test-cli-windows: | |
needs: [build-cli, test-cli-ubuntu] | |
runs-on: windows-latest | |
timeout-minutes: 360 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: screenpipe-windows-latest | |
path: . | |
- name: Install FFmpeg | |
shell: pwsh | |
run: | | |
choco install ffmpeg -y | |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") | |
Write-Output "FFmpeg version:" | |
ffmpeg -version | |
- name: Setup and run CLI (Windows) | |
shell: pwsh | |
run: | | |
# Set up environment | |
$env:RUST_LOG = "debug,screenpipe=trace" | |
$env:RUST_BACKTRACE = "1" | |
New-Item -ItemType Directory -Force -Path .\test_data\logs | |
# Debug: List directory contents | |
Write-Output "Directory contents:" | |
Get-ChildItem -Recurse | |
# Debug: Check screenpipe.exe exists and its permissions | |
if (Test-Path .\screenpipe.exe) { | |
Write-Output "screenpipe.exe exists" | |
Get-Acl .\screenpipe.exe | Format-List | |
} else { | |
Write-Error "screenpipe.exe not found" | |
exit 1 | |
} | |
# Start screenpipe and capture its process ID | |
$screenpipeProcess = Start-Process -FilePath .\screenpipe.exe -ArgumentList "--data-dir", ".\test_data", "--fps", "1" -NoNewWindow -PassThru -RedirectStandardOutput .\test_data\logs\screenpipe.log -RedirectStandardError .\test_data\logs\screenpipe_error.log | |
$screenpipePID = $screenpipeProcess.Id | |
Write-Output "Screenpipe started with PID: $screenpipePID" | |
# Wait longer for screenpipe to start | |
Start-Sleep -Seconds 60 | |
# Check if screenpipe is still running | |
$runningProcess = Get-Process -Id $screenpipePID -ErrorAction SilentlyContinue | |
if ($null -eq $runningProcess) { | |
Write-Error "Screenpipe process has exited unexpectedly" | |
Get-Content .\test_data\logs\screenpipe.log | |
Get-Content .\test_data\logs\screenpipe_error.log | |
exit 1 | |
} | |
# Start screen and audio simulation | |
Start-Process -FilePath powershell -ArgumentList "-File", ".\scripts\simulate_screen_activity.ps1" -NoNewWindow | |
Start-Process -FilePath powershell -ArgumentList "-File", ".\scripts\simulate_audio_activity.ps1" -NoNewWindow | |
# Health checks | |
$attempts = 30 | |
$interval = 10 | |
for ($i = 0; $i -lt $attempts; $i++) { | |
Start-Sleep -Seconds $interval | |
# Check if screenpipe is still running | |
$runningProcess = Get-Process -Id $screenpipePID -ErrorAction SilentlyContinue | |
if ($null -eq $runningProcess) { | |
Write-Error "Screenpipe process has exited unexpectedly during health checks" | |
Get-Content .\test_data\logs\screenpipe.log | |
Get-Content .\test_data\logs\screenpipe_error.log | |
exit 1 | |
} | |
try { | |
$response = Invoke-RestMethod -Uri http://localhost:3030/health -ErrorAction Stop | |
Write-Output "Health check $($i+1): $($response | ConvertTo-Json -Compress)" | |
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-Error "Health check failed after 5 minutes" | |
Get-Content .\test_data\logs\screenpipe.log | |
Get-Content .\test_data\logs\screenpipe_error.log | |
Write-Output "Process list:" | |
Get-Process | Where-Object { $_.Name -match 'screenpipe|ffmpeg' } | Format-Table -AutoSize | |
Write-Output "Network connections:" | |
netstat -ano | Select-String "3030" | |
exit 1 | |
- name: Upload logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows-test-logs | |
path: .\test_data\logs\* |