-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (157 loc) · 6.44 KB
/
Copy pathci.yml
File metadata and controls
177 lines (157 loc) · 6.44 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
name: CI
# Runs on every push to any branch and on every pull request.
# Builds PowerMeter.exe (Release x64) and both ACSIL DLLs, then runs
# smoke tests to verify the binaries are valid PE images and export
# the expected entry points.
on:
push:
branches: ["**"]
tags-ignore: ["v*"]
pull_request:
branches: ["**"]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
# ---------------------------------------------------------------------------
build-overlay:
name: Build PowerMeter.exe
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build PowerMeter.exe (Release x64)
run: |
msbuild PowerMeter.vcxproj `
/p:Configuration=Release `
/p:Platform=x64 `
/p:PlatformToolset=v143 `
/v:minimal `
/nologo
- name: Locate PowerMeter.exe
id: locate-exe
shell: pwsh
run: |
$candidates = @(
"x64\Release\PowerMeter.exe",
"PowerMeter\x64\Release\PowerMeter.exe"
)
$found = $candidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if (-not $found) { Write-Error "PowerMeter.exe not found after build."; exit 1 }
Write-Host "Found: $found"
"exe_path=$found" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Smoke test - valid AMD64 PE image
shell: pwsh
run: |
$exe = "${{ steps.locate-exe.outputs.exe_path }}"
$bytes = [System.IO.File]::ReadAllBytes($exe)
if ($bytes[0] -ne 0x4D -or $bytes[1] -ne 0x5A) { Write-Error "Missing MZ header"; exit 1 }
$peOffset = [BitConverter]::ToInt32($bytes, 0x3C)
$machine = [BitConverter]::ToUInt16($bytes, $peOffset + 4)
if ($machine -ne 0x8664) { Write-Error ("Not AMD64: 0x{0:X4}" -f $machine); exit 1 }
$size = (Get-Item $exe).Length
if ($size -lt 50KB) { Write-Error "Binary too small: $size bytes"; exit 1 }
Write-Host ("PASS: AMD64 PE, {0:N0} bytes" -f $size)
- name: Upload overlay artifact
uses: actions/upload-artifact@v4
with:
name: PowerMeter-exe
path: ${{ steps.locate-exe.outputs.exe_path }}
retention-days: 7
# ---------------------------------------------------------------------------
build-acsil:
name: Build ACSIL DLLs
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
# SC headers are bundled in ACSIL/sc_stub/ACS_Source/ — no download needed.
- name: Build PowerMeterFeed DLL (Debug x64)
run: |
msbuild PowerMeterFeed.vcxproj `
/p:Configuration=Debug `
/p:Platform=x64 `
/p:PlatformToolset=v143 `
/p:SierraChartRoot="${{ github.workspace }}\ACSIL\sc_stub" `
/v:minimal `
/nologo
working-directory: ACSIL
- name: Build PowerMeterFeedJS DLL (Debug x64)
run: |
msbuild PowerMeterFeedJS.vcxproj `
/p:Configuration=Debug `
/p:Platform=x64 `
/p:PlatformToolset=v143 `
/p:SierraChartRoot="${{ github.workspace }}\ACSIL\sc_stub" `
/v:minimal `
/nologo
working-directory: ACSIL
- name: Smoke test - DLLs are valid AMD64 PE images
shell: pwsh
run: |
$dlls = @(
"ACSIL\bin\x64\Debug\PowerMeterFeed_64_d.dll",
"ACSIL\bin\x64\Debug\PowerMeterFeedJS_64_d.dll"
)
foreach ($dll in $dlls) {
if (-not (Test-Path $dll)) { Write-Error "Not found: $dll"; exit 1 }
$bytes = [System.IO.File]::ReadAllBytes($dll)
if ($bytes[0] -ne 0x4D -or $bytes[1] -ne 0x5A) { Write-Error "Bad MZ: $dll"; exit 1 }
$peOffset = [BitConverter]::ToInt32($bytes, 0x3C)
$machine = [BitConverter]::ToUInt16($bytes, $peOffset + 4)
if ($machine -ne 0x8664) { Write-Error ("Not AMD64: $dll (0x{0:X4})" -f $machine); exit 1 }
$size = (Get-Item $dll).Length
if ($size -lt 10KB) { Write-Error "Too small: $size bytes ($dll)"; exit 1 }
Write-Host ("PASS: $(Split-Path $dll -Leaf) ({0:N0} bytes, AMD64)" -f $size)
}
- name: Smoke test - DLL exports
shell: pwsh
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vswhere -latest -property installationPath
$dumpbin = Get-ChildItem "$vsPath\VC\Tools\MSVC" -Recurse -Filter "dumpbin.exe" |
Where-Object { $_.FullName -match "HostX64\\x64" } |
Select-Object -First 1
if (-not $dumpbin) { Write-Error "dumpbin.exe not found via vswhere"; exit 1 }
Write-Host "dumpbin: $($dumpbin.FullName)"
$checks = @(
@{ dll = "ACSIL\bin\x64\Debug\PowerMeterFeed_64_d.dll"; symbol = "scsf_PowerMeterFeed" },
@{ dll = "ACSIL\bin\x64\Debug\PowerMeterFeedJS_64_d.dll"; symbol = "scsf_PowerMeterFeedJS" }
)
foreach ($check in $checks) {
$dll = $check.dll
$symbol = $check.symbol
Write-Host "Checking exports of $dll for '$symbol'..."
$exports = & $dumpbin.FullName /exports $dll 2>&1 | Out-String
Write-Host $exports
if ($exports -notmatch $symbol) {
Write-Error "Export '$symbol' not found in $dll"
exit 1
}
Write-Host "PASS: $symbol exported from $(Split-Path $dll -Leaf)"
}
- name: Upload ACSIL artifacts
uses: actions/upload-artifact@v4
with:
name: ACSIL-debug-dlls
path: ACSIL/bin/x64/Debug/*.dll
retention-days: 7
# ---------------------------------------------------------------------------
ci-passed:
name: CI passed
needs: [build-overlay, build-acsil]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check all jobs succeeded
run: |
if [[ "${{ needs.build-overlay.result }}" != "success" || \
"${{ needs.build-acsil.result }}" != "success" ]]; then
echo "One or more CI jobs failed."
exit 1
fi
echo "All CI jobs passed."