-
Notifications
You must be signed in to change notification settings - Fork 0
256 lines (219 loc) · 8.54 KB
/
Copy pathci.yml
File metadata and controls
256 lines (219 loc) · 8.54 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
env:
AUTOHOTKEY_VERSION: "2.0.21"
AHK2EXE_VERSION: "1.1.37.02a0a"
TOOLCHAIN_CACHE_KEY: ahk-toolchain-2.0.21-1.1.37.02a0a
jobs:
validate:
runs-on: windows-2025
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Validate app version
id: version
shell: pwsh
run: |
$version = (& .\scripts\get-app-version.ps1).Trim()
"APP_VERSION=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
Write-Host "Validated version $version"
- name: Restore toolchain cache
id: cache-restore
uses: actions/cache@v5
with:
path: .ahk-toolchain
key: ${{ env.TOOLCHAIN_CACHE_KEY }}
- name: Download AutoHotkey toolchain
if: steps.cache-restore.outputs.cache-hit != 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
shell: pwsh
run: |
.\scripts\download-github-toolchain.ps1 `
-AutoHotkeyVersion $env:AUTOHOTKEY_VERSION `
-Ahk2ExeVersion $env:AHK2EXE_VERSION `
-OutputRoot .ahk-toolchain
- name: Verify toolchain
shell: pwsh
run: |
$baseFile = Get-ChildItem -Path .ahk-toolchain -Recurse -Filter AutoHotkey64.exe | Select-Object -First 1
$ahk2exe = Get-ChildItem -Path .ahk-toolchain -Recurse -Filter Ahk2Exe.exe | Select-Object -First 1
if (-not $baseFile) { throw "AutoHotkey64.exe not found in toolchain" }
if (-not $ahk2exe) { throw "Ahk2Exe.exe not found in toolchain" }
Write-Host "Toolchain OK: $($baseFile.FullName), $($ahk2exe.FullName)"
test-unit:
needs: validate
runs-on: windows-2025
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Restore toolchain cache
uses: actions/cache/restore@v5
with:
path: .ahk-toolchain
key: ${{ env.TOOLCHAIN_CACHE_KEY }}
fail-on-cache-miss: true
- name: Resolve runtime path
shell: pwsh
run: |
$baseFile = Get-ChildItem -Path .ahk-toolchain -Recurse -Filter AutoHotkey64.exe | Select-Object -First 1
if (-not $baseFile) { throw "AutoHotkey64.exe not found" }
"AHK_BASE_FILE=$($baseFile.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Run unit tests
shell: pwsh
run: |
.\scripts\test.ps1 `
-Suite unit `
-Ci `
-AutoHotkeyPath $env:AHK_BASE_FILE
- name: Upload test results
if: always()
uses: actions/upload-artifact@v6
with:
name: test-results-unit
path: test-results
# test-results are diagnostics only; test-summary degrades gracefully
# when an artifact is missing. The bound stops a hung upload step from
# eating the whole job budget (seen 6/6 on this branch's integration
# job: upload completes server-side, the step process never exits).
timeout-minutes: 2
continue-on-error: true
# The integration suite intentionally does NOT run in CI. A runner that
# completes the rewritten integration tests wedges its NEXT node process
# (upload-artifact, then Post Checkout) below the step/job timeout
# machinery: 12/12 branch runs force-cancelled at 15m with logs purged,
# while the same suites pass locally in seconds (11/11 green). Run
# integration locally before pushing: pwsh ./scripts/test.ps1 -Suite unit,integration
test-gui:
needs: validate
runs-on: windows-2025
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Restore toolchain cache
uses: actions/cache/restore@v5
with:
path: .ahk-toolchain
key: ${{ env.TOOLCHAIN_CACHE_KEY }}
fail-on-cache-miss: true
- name: Resolve runtime path
shell: pwsh
run: |
$baseFile = Get-ChildItem -Path .ahk-toolchain -Recurse -Filter AutoHotkey64.exe | Select-Object -First 1
if (-not $baseFile) { throw "AutoHotkey64.exe not found" }
"AHK_BASE_FILE=$($baseFile.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Run GUI tests
shell: pwsh
run: |
.\scripts\test.ps1 `
-Suite gui `
-Ci `
-AutoHotkeyPath $env:AHK_BASE_FILE
- name: Upload test results
if: always()
uses: actions/upload-artifact@v6
with:
name: test-results-gui
path: test-results
# test-results are diagnostics only; test-summary degrades gracefully
# when an artifact is missing. The bound stops a hung upload step from
# eating the whole job budget (seen 6/6 on this branch's integration
# job: upload completes server-side, the step process never exits).
timeout-minutes: 2
continue-on-error: true
build:
needs: [validate, test-unit, test-gui]
runs-on: windows-2025
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Restore toolchain cache
uses: actions/cache/restore@v5
with:
path: .ahk-toolchain
key: ${{ env.TOOLCHAIN_CACHE_KEY }}
fail-on-cache-miss: true
- name: Resolve toolchain paths
shell: pwsh
run: |
$baseFile = Get-ChildItem -Path .ahk-toolchain -Recurse -Filter AutoHotkey64.exe | Select-Object -First 1
$ahk2exe = Get-ChildItem -Path .ahk-toolchain -Recurse -Filter Ahk2Exe.exe | Select-Object -First 1
if (-not $baseFile) { throw "AutoHotkey64.exe not found" }
if (-not $ahk2exe) { throw "Ahk2Exe.exe not found" }
"AHK_BASE_FILE=$($baseFile.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"AHK2EXE_PATH=$($ahk2exe.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$version = (& .\scripts\get-app-version.ps1).Trim()
"APP_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build release artifacts
shell: pwsh
run: |
.\scripts\build.ps1 `
-Ahk2ExePath $env:AHK2EXE_PATH `
-BaseFilePath $env:AHK_BASE_FILE
- name: Upload CI artifacts
if: github.event_name == 'push'
uses: actions/upload-artifact@v6
with:
name: AHKeyMap-${{ env.APP_VERSION }}-ci
path: |
dist/AHKeyMap.exe
dist/AHKeyMap-v${{ env.APP_VERSION }}-windows-x64.zip
dist/SHA256SUMS.txt
test-summary:
needs: [test-unit, test-gui]
if: always()
runs-on: windows-2025
timeout-minutes: 5
steps:
- name: Download all test results
uses: actions/download-artifact@v7
with:
pattern: test-results-*
path: all-results
- name: Generate test summary
shell: pwsh
run: |
$suites = @("unit", "gui")
$totalPassed = 0
$totalFailed = 0
$tableRows = @()
foreach ($suite in $suites) {
$summaryFile = "all-results/test-results-$suite/summary.json"
if (Test-Path $summaryFile) {
$data = Get-Content $summaryFile -Raw | ConvertFrom-Json
$passed = ($data | Where-Object { $_.status -eq "passed" }).Count
$failed = ($data | Where-Object { $_.status -eq "failed" }).Count
$total = $passed + $failed
$status = if ($failed -gt 0) { ":x: Failed" } else { ":white_check_mark: Passed" }
$tableRows += "| $suite | $total | $passed | $failed | $status |"
$totalPassed += $passed
$totalFailed += $failed
} else {
$tableRows += "| $suite | - | - | - | :warning: No results |"
}
}
$overallStatus = if ($totalFailed -gt 0) { ":x: **$totalFailed test(s) failed**" } else { ":white_check_mark: **All $totalPassed tests passed**" }
$summary = @"
## Test Results
$overallStatus
| Suite | Total | Passed | Failed | Status |
|-------|-------|--------|--------|--------|
$($tableRows -join "`n")
"@
$summary | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append