-
Notifications
You must be signed in to change notification settings - Fork 7
160 lines (135 loc) Β· 5.35 KB
/
test.yml
File metadata and controls
160 lines (135 loc) Β· 5.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
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"
}
}
}