Skip to content

Commit

Permalink
fix windows failure
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 7, 2024
1 parent eda1771 commit 005c16c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 37 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ jobs:
echo "Screenpipe PID: $CLI_PID"
# Wait longer for initialization
sleep 30
sleep 60
# Check if screenpipe is still running
if ! ps -p $CLI_PID > /dev/null; then
Expand Down Expand Up @@ -296,12 +296,15 @@ jobs:
path: .

- name: Install FFmpeg
run: choco install ffmpeg -y
run: |
choco install ffmpeg -y
refreshenv
- name: Setup and run CLI (Windows)
shell: pwsh
run: |
# Set up environment
$env:RUST_LOG = "debug"
$env:RUST_LOG = "debug,screenpipe=trace"
$env:RUST_BACKTRACE = "1"
New-Item -ItemType Directory -Force -Path .\test_data\logs
Expand All @@ -310,8 +313,8 @@ jobs:
$screenpipePID = $screenpipeProcess.Id
Write-Output "Screenpipe started with PID: $screenpipePID"
# Wait for screenpipe to start
Start-Sleep -Seconds 20
# Wait longer for screenpipe to start
Start-Sleep -Seconds 60
# Check if screenpipe is still running
$runningProcess = Get-Process -Id $screenpipePID -ErrorAction SilentlyContinue
Expand Down Expand Up @@ -361,3 +364,10 @@ jobs:
Write-Output "Network connections:"
netstat -ano | Select-String "3030"
exit 1
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: windows-test-logs
path: .\test_data\logs\*
45 changes: 25 additions & 20 deletions scripts/simulate_audio_activity.ps1
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
Add-Type -AssemblyName System.Speech

$synthesizer = New-Object System.Speech.Synthesis.SpeechSynthesizer

# Try to set the audio output to the default device
try {
$synthesizer.SetOutputToDefaultAudioDevice()
} catch {
Write-Output "Failed to set audio output to default device: $_"
# If setting to default device fails, try to use the first available device
$audioDevices = [System.Speech.Synthesis.SpeechSynthesizer]::InstalledVoices
if ($audioDevices.Count -gt 0) {
$synthesizer.SelectVoice($audioDevices[0].VoiceInfo.Name)
} else {
Write-Output "No audio devices available. Audio simulation will be skipped."
exit
}
}
$synthesizer = New-Object System.Speech.Synthesis.SpeechSynthesizer

while ($true) {
# Try to set the audio output to the default device
try {
$synthesizer.SpeakAsync("This is a test of screenpipe CLI audio capture")
Start-Sleep -Seconds 2
$synthesizer.SetOutputToDefaultAudioDevice()
} catch {
Write-Output "Error during speech synthesis: $_"
Start-Sleep -Seconds 5
Write-Output "Failed to set audio output to default device: $_"
# If setting to default device fails, try to use the first available device
$audioDevices = [System.Speech.Synthesis.SpeechSynthesizer]::InstalledVoices
if ($audioDevices.Count -gt 0) {
$synthesizer.SelectVoice($audioDevices[0].VoiceInfo.Name)
} else {
Write-Output "No audio devices available. Audio simulation will be skipped."
exit
}
}

while ($true) {
try {
$synthesizer.SpeakAsync("This is a test of screenpipe CLI audio capture")
Start-Sleep -Seconds 2
} catch {
Write-Output "Error during speech synthesis: $_"
Start-Sleep -Seconds 5
}
}
} catch {
Write-Error "Error in simulate_audio_activity: $_"
exit 1
}
29 changes: 17 additions & 12 deletions scripts/simulate_screen_activity.ps1
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
Add-Type -AssemblyName System.Windows.Forms

while ($true) {
# Simulate mouse movement
for ($i = 0; $i -lt 20; $i++) {
$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
}
try {
while ($true) {
# Simulate mouse movement
for ($i = 0; $i -lt 20; $i++) {
$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
}

# Simulate typing
[System.Windows.Forms.SendKeys]::SendWait("Screenpipe Test Content{ENTER}")
[System.Windows.Forms.SendKeys]::SendWait("This is a test of screenpipe CLI{ENTER}")
# Simulate typing
[System.Windows.Forms.SendKeys]::SendWait("Screenpipe Test Content{ENTER}")
[System.Windows.Forms.SendKeys]::SendWait("This is a test of screenpipe CLI{ENTER}")

Start-Sleep -Seconds 1
Start-Sleep -Seconds 1
}
} catch {
Write-Error "Error in simulate_screen_activity: $_"
exit 1
}

0 comments on commit 005c16c

Please sign in to comment.