Skip to content

TestDriver.ai

TestDriver.ai #26

Workflow file for this run

name: TestDriver.ai
permissions:
actions: read
contents: write
pull-requests: write
on:
push:
branches: ["main"]
workflow_dispatch:
jobs:
test:
name: "TestDriver"
runs-on: ubuntu-latest
steps:
- uses: testdriverai/action@main
with:
key: ${{ secrets.TESTDRIVER_API_KEY }}
prompt: |
1. /run testdriver/test.yml
prerun: |
# Define variables
$osInstallerUrl = "https://builds.pieces.app/stages/production/os_server/windows-exe/download"
$appInstallerUrl = "https://builds.pieces.app/stages/production/pieces_for_x/windows-exe/download"
$osInstallerPath = "$env:USERPROFILE\Downloads\out-windows.exe"
$appInstallerPath = "$env:USERPROFILE\Downloads\out-windows (1).exe"
function Install-Application($installerUrl, $installerPath, $appName) {
Write-Host "$(Get-Date -Format G): Starting download of $appName installer..."
# Create WebClient object
$webClient = New-Object System.Net.WebClient
$progressEvent = Register-ObjectEvent -InputObject $webClient -EventName DownloadProgressChanged -Action {
$percent = $EventArgs.ProgressPercentage
Write-Host "$(Get-Date -Format G): Downloading $($using:appName) - $percent% complete"
}
# Download file asynchronously
$webClient.DownloadFileAsync($installerUrl, $installerPath)
while ($webClient.IsBusy) {
Start-Sleep -Milliseconds 500
}
Unregister-Event -SourceIdentifier $progressEvent.Name
Remove-Job -Name $progressEvent.Name
Write-Host "$(Get-Date -Format G): $appName installer download complete."
if (Test-Path $installerPath) {
Write-Host "$(Get-Date -Format G): Running the $appName installer..."
Start-Process -FilePath $installerPath -ArgumentList '/SILENT' -Wait
Start-Sleep -Seconds 10
} else {
Write-Host "$(Get-Date -Format G): Failed to download the $appName installer."
}
}
Install-Application $osInstallerUrl $osInstallerPath "Pieces OS Server"
Install-Application $appInstallerUrl $appInstallerPath "Pieces Application"
Write-Host "$(Get-Date -Format G): Attempting to start the Pieces OS Server..."
$osServerExePath = "C:\Program Files\Pieces OS\os_server.exe"
if (Test-Path $osServerExePath) {
Start-Process -FilePath $osServerExePath -ArgumentList '/SILENT'
Write-Host "$(Get-Date -Format G): Pieces OS Server started successfully."
} else {
Write-Host "$(Get-Date -Format G): Failed to find the Pieces OS Server executable."
}
Start-Sleep -Seconds 5
Write-Host "$(Get-Date -Format G): Attempting to start the Pieces application..."
$piecesExePath = "C:\Program Files\Pieces for Developers\pieces_for_x.exe"
if (Test-Path $piecesExePath) {
Start-Process -FilePath $piecesExePath
Write-Host "$(Get-Date -Format G): Pieces application started successfully."
} else {
Write-Host "$(Get-Date -Format G): Failed to find the Pieces application executable."
}
env:
FORCE_COLOR: "3"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}