Skip to content

first commit

first commit #1

Workflow file for this run

name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
unit-tests:
name: Unit Tests
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check test structure
run: |
Write-Host "Checking test structure..."
if (Test-Path "tests/ImageWriterTests.dpr") {
Write-Host "βœ“ Test project found"
} else {
Write-Host "βœ— Test project not found"
exit 1
}
if (Test-Path "tests/run_tests.ps1") {
Write-Host "βœ“ Test runner script found"
} else {
Write-Host "βœ— Test runner script not found"
}
- name: List test files
run: |
Write-Host "Available test files:"
Get-ChildItem -Path "tests" -Filter "*Tests.pas" | ForEach-Object {
Write-Host " - $($_.Name)"
}
- name: Validate test files
run: |
Write-Host "Validating test files..."
$testFiles = Get-ChildItem -Path "tests" -Filter "*Tests.pas"
foreach ($file in $testFiles) {
$content = Get-Content $file.FullName -Raw
if ($content -match "TestFramework") {
Write-Host "βœ“ $($file.Name) uses DUnit framework"
}
if ($content -match "procedure\s+Test\w+;") {
Write-Host "βœ“ $($file.Name) contains test procedures"
}
}
# Note: Actual test execution requires compiled test executable
# This would need Delphi 7 or FPC to compile ImageWriterTests.dpr
- name: Run PowerShell integration tests
run: |
Write-Host "Running PowerShell integration tests..."
if (Test-Path "tests/IntegrationTests.ps1") {
# Run integration tests (these don't require compilation)
# & "tests/IntegrationTests.ps1"
Write-Host "βœ“ Integration test script available"
}
- name: Test summary
run: |
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Test Check Summary" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "βœ“ Test structure validated" -ForegroundColor Green
Write-Host "βœ“ Test files checked" -ForegroundColor Green
Write-Host "⚠ Note: Test execution requires compiled executable" -ForegroundColor Yellow
Write-Host ""
Write-Host "Test files found:" -ForegroundColor Cyan
Get-ChildItem -Path "tests" -Filter "*Tests.pas" | ForEach-Object {
Write-Host " - $($_.Name)" -ForegroundColor White
}
code-quality:
name: Code Quality Checks
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check copyright headers
run: |
Write-Host "Checking copyright headers in source files..."
$pasFiles = Get-ChildItem -Path "src" -Filter "*.pas" -Recurse
$missingHeaders = @()
foreach ($file in $pasFiles) {
$content = Get-Content $file.FullName -Raw
if ($content -notmatch "Copyright \(c\)") {
$missingHeaders += $file.Name
}
}
if ($missingHeaders.Count -gt 0) {
Write-Host "⚠ Files missing copyright headers:" -ForegroundColor Yellow
$missingHeaders | ForEach-Object { Write-Host " - $_" -ForegroundColor Yellow }
} else {
Write-Host "βœ“ All files have copyright headers" -ForegroundColor Green
}
- name: Check for TODO/FIXME comments
run: |
Write-Host "Checking for TODO/FIXME comments..."
$pasFiles = Get-ChildItem -Path "src" -Filter "*.pas" -Recurse
$todos = @()
foreach ($file in $pasFiles) {
$content = Get-Content $file.FullName
$lineNum = 0
foreach ($line in $content) {
$lineNum++
if ($line -match "//\s*(TODO|FIXME|HACK|XXX)") {
$todos += "$($file.Name):$lineNum - $line"
}
}
}
if ($todos.Count -gt 0) {
Write-Host "Found $($todos.Count) TODO/FIXME comments:" -ForegroundColor Yellow
$todos | Select-Object -First 10 | ForEach-Object {
Write-Host " $_" -ForegroundColor Yellow
}
if ($todos.Count -gt 10) {
Write-Host " ... and $($todos.Count - 10) more" -ForegroundColor Yellow
}
} else {
Write-Host "βœ“ No TODO/FIXME comments found" -ForegroundColor Green
}
- name: Check file encoding
run: |
Write-Host "Checking file encodings..."
$pasFiles = Get-ChildItem -Path "src" -Filter "*.pas" -Recurse | Select-Object -First 5
foreach ($file in $pasFiles) {
$encoding = [System.Text.Encoding]::Default
$bytes = [System.IO.File]::ReadAllBytes($file.FullName)
# Check for BOM
if ($bytes.Length -ge 3) {
if ($bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
Write-Host " $($file.Name): UTF-8 with BOM"
} else {
Write-Host " $($file.Name): ANSI/ASCII"
}
}
}