Skip to content

Improve GitHub Actions workflow for testing #1394

Improve GitHub Actions workflow for testing

Improve GitHub Actions workflow for testing #1394

Workflow file for this run

name: 'EmulationStation Setup Test'
on:
push:
branches: [master, dev, test, test-modernized-emulators]
pull_request:
branches: [master]
# schedule:
# - cron: "0 0 */2 * *"
jobs:
test-setup:
runs-on: windows-latest
timeout-minutes: 120
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup PowerShell execution policy
run: Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
shell: powershell
- name: Display system information
run: |
Write-Host "Windows Version: $(Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version)"
Write-Host "PowerShell Version: $($PSVersionTable.PSVersion)"
Write-Host "Available Disk Space: $([math]::Round((Get-WmiObject -Class Win32_LogicalDisk -Filter "DeviceID='C:'").FreeSpace / 1GB, 2)) GB"
shell: powershell
- name: Test download validation
run: |
Write-Host "Testing download URLs from download_list.json..."
$json = Get-Content "download_list.json" | ConvertFrom-Json
$testCount = 0
$failedUrls = @()
# Test first 5 download URLs to avoid timeout
$json.downloads | Select-Object -First 5 | ForEach-Object {
$testCount++
Write-Host "Testing URL $testCount: $($_.url)"
try {
$response = Invoke-WebRequest -Uri $_.url -Method Head -UseBasicParsing -TimeoutSec 30
Write-Host "✓ $($_.file) - Status: $($response.StatusCode)"
} catch {
Write-Host "✗ $($_.file) - Failed: $($_.Exception.Message)"
$failedUrls += $_.url
}
}
if($failedUrls.Count -gt 0) {
Write-Host "WARNING: $($failedUrls.Count) URLs failed validation"
} else {
Write-Host "SUCCESS: All tested URLs are accessible"
}
shell: powershell
- name: Test script syntax
run: |
Write-Host "Validating PowerShell script syntax..."
try {
$null = [System.Management.Automation.PSParser]::Tokenize((Get-Content "prepare.ps1" -Raw), [ref]$null)
Write-Host "✓ PowerShell syntax is valid"
} catch {
Write-Host "✗ PowerShell syntax error: $($_.Exception.Message)"
exit 1
}
shell: powershell
- name: Test JSON validity
run: |
Write-Host "Validating JSON configuration..."
try {
$json = Get-Content "download_list.json" | ConvertFrom-Json
Write-Host "✓ JSON syntax is valid"
Write-Host "Downloads: $($json.downloads.Count) items"
Write-Host "Releases: $($json.releases.Count) items"
Write-Host "Other downloads: $($json.other_downloads.Count) items"
} catch {
Write-Host "✗ JSON syntax error: $($_.Exception.Message)"
exit 1
}
shell: powershell
- name: Run setup script (dry run)
run: |
Write-Host "This would normally run the full setup script."
Write-Host "Skipping actual installation in CI environment to avoid timeouts."
Write-Host "Script validation completed successfully!"
shell: powershell