-
Notifications
You must be signed in to change notification settings - Fork 10
478 lines (416 loc) · 19.7 KB
/
Copy pathbuild.yml
File metadata and controls
478 lines (416 loc) · 19.7 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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
name: "Build SysCaller: Bind"
permissions:
contents: write
packages: write
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
defaults:
run:
working-directory: ./Bind
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.3
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: '7e19f3c64cb636ee21f41bfe8558a6dfaae6236f'
vcpkgJsonGlob: 'vcpkg.json'
runVcpkgInstall: '--triplet=x64-windows --x-wait-for-lock'
- name: Set Vcpkg Environment
run: |
echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg" >> $env:GITHUB_ENV
echo "VcpkgRoot=${{ github.workspace }}/vcpkg" >> $env:GITHUB_ENV
echo "VCPKG_DEFAULT_TRIPLET=x64-windows" >> $env:GITHUB_ENV
echo "CMAKE_WARN_UNUSED_CLI_VARS=OFF" >> $env:GITHUB_ENV
echo "VCPKG_CMAKE_CONFIGURE_OPTIONS=-DCMAKE_WARN_UNUSED_CLI_VARS=OFF" >> $env:GITHUB_ENV
- name: Setup Vcpkg Binary Caching
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/vcpkg/installed
${{ github.workspace }}/vcpkg/packages
key: vcpkg-${{ hashFiles('**/vcpkg.json') }}-${{ runner.os }}-x64-windows
restore-keys: |
vcpkg-${{ hashFiles('**/vcpkg.json') }}-${{ runner.os }}-
vcpkg-${{ runner.os }}-
- name: Integrate Vcpkg with MSBuild
run: |
& "${{ github.workspace }}/vcpkg/vcpkg.exe" integrate install
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '5.15.2'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
cache: true
- name: Set Qt Environment Variables
run: |
# The Qt action installs to D:\a\SysCaller\Qt, not in the workspace
$qtPath = "D:\a\SysCaller\Qt\5.15.2\msvc2019_64"
echo "QTDIR=$qtPath" >> $env:GITHUB_ENV
echo "QT_ROOT_DIR=$qtPath" >> $env:GITHUB_ENV
echo "QT_PLUGIN_PATH=$qtPath\plugins" >> $env:GITHUB_ENV
echo "QML2_IMPORT_PATH=$qtPath\qml" >> $env:GITHUB_ENV
echo "PATH=$qtPath\bin;$env:PATH" >> $env:GITHUB_ENV
# Verify Qt Tools are Available
Write-Host "Checking Qt Tools Availability:"
Write-Host "Looking for Qt at: $qtPath"
if (Test-Path "$qtPath\bin\moc.exe") {
Write-Host "moc.exe found"
& "$qtPath\bin\moc.exe" -v
} else {
Write-Host "moc.exe not found, looking for alternatives..."
Get-ChildItem "D:\a\SysCaller\Qt" -Recurse -Name "moc.exe" | ForEach-Object { Write-Host "Found: $_" }
}
if (Test-Path "$qtPath\bin\rcc.exe") {
Write-Host "rcc.exe found"
} else {
Write-Host "rcc.exe not found"
}
- name: Setup Qt MSBuild Integration
run: |
# Create QtMsBuild Directory for Basic Qt Integration
$qtPath = "D:\a\SysCaller\Qt\5.15.2\msvc2019_64"
$qtMsBuildPath = "QtMsBuild"
# Create QtMsBuild Directory
New-Item -ItemType Directory -Path $qtMsBuildPath -Force
# Create Qt.props File
$qtPropsContent = '<?xml version="1.0" encoding="utf-8"?>' + "`n" +
'<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' + "`n" +
' <PropertyGroup>' + "`n" +
" <QTDIR>$qtPath</QTDIR>" + "`n" +
" <QtVersion>5.15.2</QtVersion>" + "`n" +
" <QtMsBuild>true</QtMsBuild>" + "`n" +
' </PropertyGroup>' + "`n" +
'</Project>'
$qtPropsContent | Out-File -FilePath "$qtMsBuildPath\Qt.props" -Encoding UTF8
# Create qt_defaults.props File
$qtDefaultsContent = '<?xml version="1.0" encoding="utf-8"?>' + "`n" +
'<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' + "`n" +
' <PropertyGroup>' + "`n" +
" <QTDIR>$qtPath</QTDIR>" + "`n" +
" <QtVersion>5.15.2</QtVersion>" + "`n" +
' </PropertyGroup>' + "`n" +
'</Project>'
$qtDefaultsContent | Out-File -FilePath "$qtMsBuildPath\qt_defaults.props" -Encoding UTF8
# Create qt.targets File with RCC support
$qtTargetsContent = '<?xml version="1.0" encoding="utf-8"?>' + "`n" +
'<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' + "`n" +
' <PropertyGroup>' + "`n" +
" <QTDIR>$qtPath</QTDIR>" + "`n" +
" <QtVersion>5.15.2</QtVersion>" + "`n" +
' </PropertyGroup>' + "`n" +
' <Target Name="QtRcc" BeforeTargets="ClCompile" Condition="''@(QtRcc)'' != ''''">' + "`n" +
' <Message Text="Processing Qt Resource Files..." Importance="high" />' + "`n" +
' <MakeDir Directories="$(GeneratedFilesDir)" />' + "`n" +
' <Exec Command=""$(QTDIR)\bin\rcc.exe" -name %(QtRcc.Filename) %(QtRcc.FullPath) -o "$(GeneratedFilesDir)\qrc_%(QtRcc.Filename).cpp""' + "`n" +
' Condition="''%(QtRcc.Identity)'' != ''''" />' + "`n" +
' </Target>' + "`n" +
'</Project>'
$qtTargetsContent | Out-File -FilePath "$qtMsBuildPath\qt.targets" -Encoding UTF8
# Set QtMsBuild Environment Variable
echo "QtMsBuild=$qtMsBuildPath" >> $env:GITHUB_ENV
Write-Host "QtMsBuild Set to: $qtMsBuildPath"
- name: Pre-generate MOC Files
run: |
$qtPath = "D:\a\SysCaller\Qt\5.15.2\msvc2019_64"
$mocPath = "$qtPath\bin\moc.exe"
$rccPath = "$qtPath\bin\rcc.exe"
if (Test-Path $mocPath) {
Write-Host "Pre-generating MOC Files..."
# Create GeneratedFiles Directory if it doesn't exist
New-Item -ItemType Directory -Path "GeneratedFiles" -Force
# List of Header Files that need MOC Generation
$mocFiles = @(
"include/GUI/MainWindow.h",
"include/GUI/Bars/ProgressBar.h",
"include/GUI/Bars/StatusBar.h",
"include/GUI/Bars/TitleBar.h",
"include/GUI/Bars/SettingsTitleBar.h",
"include/GUI/Buttons/BindButton.h",
"include/GUI/Panels/LeftPanel.h",
"include/GUI/Panels/OutputPanel.h",
"include/GUI/Panels/RightPanel.h",
"include/GUI/Dialogs/ChangelogDialog.h",
"include/GUI/Dialogs/HashCompareDialog.h",
"include/GUI/Dialogs/ObfuscationSelectionDialog.h",
"include/GUI/Dialogs/StubMapperDialog.h",
"include/GUI/Dialogs/SettingsDialog.h",
"include/GUI/Dialogs/ConfirmationDialog.h",
"include/GUI/Settings/Tabs/GeneralTab.h",
"include/GUI/Settings/Tabs/ObfuscationTab.h",
"include/GUI/Settings/Tabs/IntegrityTab.h",
"include/GUI/Settings/Tabs/ProfileTab.h",
"include/GUI/Settings/Tabs/IndirectObfuscationTab.h",
"include/GUI/Settings/Tabs/InlineObfuscationTab.h",
"include/GUI/Threads/ValidatorThread.h",
"include/GUI/Threads/CompatibilityThread.h",
"include/GUI/Threads/VerificationThread.h",
"include/GUI/Threads/ObfuscationThread.h",
"include/Core/Integrity/Compatibility/Compatibility.h",
"include/Core/Integrity/Validator/Validator.h",
"include/Core/Integrity/Verification/Verification.h"
)
foreach ($headerFile in $mocFiles) {
if (Test-Path $headerFile) {
$outputFile = "GeneratedFiles/moc_" + [System.IO.Path]::GetFileNameWithoutExtension($headerFile) + ".cpp"
Write-Host "Generating MOC for: $headerFile -> $outputFile"
& $mocPath $headerFile -o $outputFile
if ($LASTEXITCODE -eq 0) {
Write-Host "Successfully generated: $outputFile"
} else {
Write-Host "MOC generation failed for $headerFile with exit code: $LASTEXITCODE"
}
} else {
Write-Host "Header file not found: $headerFile"
}
}
# Generate RCC file manually
if (Test-Path $rccPath) {
Write-Host "Generating RCC file..."
$rccInput = "src/Res/resources.qrc"
$rccOutput = "GeneratedFiles/qrc_resources.cpp"
if (Test-Path $rccInput) {
Write-Host "RCC Input: $rccInput"
Write-Host "RCC Output: $rccOutput"
Write-Host "Current directory: $(Get-Location)"
Write-Host "Verifying resource files..."
$qrcContent = Get-Content $rccInput -Raw
if ($qrcContent -match '<file>(.*?)</file>') {
$resourceFiles = [regex]::Matches($qrcContent, '<file>(.*?)</file>') | ForEach-Object { $_.Groups[1].Value }
$qrcDir = Split-Path (Resolve-Path $rccInput) -Parent
foreach ($resFile in $resourceFiles) {
$fullPath = Join-Path $qrcDir $resFile
$fullPath = [System.IO.Path]::GetFullPath($fullPath)
if (Test-Path $fullPath) {
Write-Host " Found: $resFile"
} else {
Write-Host " WARNING: Missing resource file: $resFile (expected at: $fullPath)"
}
}
}
& $rccPath -name resources $rccInput -o $rccOutput
if ($LASTEXITCODE -eq 0) {
Write-Host "Successfully generated RCC file: $rccOutput"
if (Test-Path $rccOutput) {
$fileSize = (Get-Item $rccOutput).Length
Write-Host "RCC file size: $fileSize bytes"
}
} else {
Write-Host "RCC generation failed with exit code: $LASTEXITCODE"
Write-Host "RCC command: $rccPath -name resources $rccInput -o $rccOutput"
}
} else {
Write-Host "RCC input file not found: $rccInput"
Write-Host "Current directory: $(Get-Location)"
Write-Host "Files in current directory:"
Get-ChildItem -Recurse -Filter "resources.qrc" | ForEach-Object { Write-Host " Found: $($_.FullName)" }
}
} else {
Write-Host "RCC tool not found, skipping resource compilation"
}
Write-Host "MOC generation completed"
} else {
Write-Host "MOC tool not found, skipping pre-generation"
}
- name: Verify Qt Installation
run: |
Write-Host "Qt Installation Verification:"
Write-Host "QTDIR: $env:QTDIR"
if (Test-Path $env:QTDIR) {
Write-Host "Qt directory exists"
Get-ChildItem $env:QTDIR | Select-Object Name
} else {
Write-Host "Qt Directory not found!"
}
if (Test-Path "$env:QTDIR\bin") {
Write-Host "Qt bin Directory exists"
Get-ChildItem "$env:QTDIR\bin" | Where-Object { $_.Name -like "qmake*" } | Select-Object Name
} else {
Write-Host "Qt bin Directory not found!"
}
- name: Verify Generated Files
run: |
Write-Host "Checking Generated Files:"
if (Test-Path "GeneratedFiles") {
Write-Host "GeneratedFiles directory exists"
Get-ChildItem "GeneratedFiles" | Select-Object Name, Length
if (Test-Path "GeneratedFiles/qrc_resources.cpp") {
Write-Host "RCC file generated successfully!"
$rccSize = (Get-Item "GeneratedFiles/qrc_resources.cpp").Length
Write-Host "RCC file size: $rccSize bytes"
} else {
Write-Host "RCC file NOT found!"
}
} else {
Write-Host "GeneratedFiles directory not found!"
}
- name: Build Solution (Debug x64)
run: |
# Build with proper Environment Variables
Write-Host "Building Debug x64..."
Write-Host "QTDIR: $env:QTDIR"
Write-Host "VcpkgRoot: $env:VcpkgRoot"
Write-Host "VCPKG_ROOT: $env:VCPKG_ROOT"
msbuild "../SysCaller.sln" /p:Configuration=Debug /p:Platform=x64 /p:VcpkgEnabled=true /p:VcpkgEnableManifest=true /p:VcpkgUseStatic=false /p:VcpkgTriplet=x64-windows /p:QTDIR="$env:QTDIR" /p:VcpkgRoot="$env:VcpkgRoot" /t:Bind
- name: Copy Vcpkg Dependencies (Debug)
run: |
Write-Host "Copying Vcpkg Dependencies for Debug Build..."
$outputDir = "../Build/Bind/Debug"
$vcpkgBin = "${{ github.workspace }}/vcpkg/installed/x64-windows/bin"
# Copy Vcpkg Dependencies (Qt dependencies will be handled by windeployqt)
if (Test-Path "$vcpkgBin/pe-parsed.dll") {
Copy-Item "$vcpkgBin/pe-parsed.dll" $outputDir
Write-Host "Copied pe-parsed.dll"
}
if (Test-Path "$vcpkgBin/cmark.dll") {
Copy-Item "$vcpkgBin/cmark.dll" $outputDir
Write-Host "Copied cmark.dll"
}
Write-Host "Vcpkg dependencies copied to $outputDir"
- name: Deploy Qt Dependencies (Debug)
run: |
Write-Host "Running Qt deployment for Debug build..."
$qtBin = "D:\a\SysCaller\Qt\5.15.2\msvc2019_64\bin"
$windeployqt = "$qtBin\windeployqt.exe"
if (Test-Path $windeployqt) {
Write-Host "Running windeployqt on Debug executable..."
Write-Host "Checking GeneratedFiles directory before windeployqt..."
if (Test-Path "GeneratedFiles") {
Get-ChildItem "GeneratedFiles" -Name | Where-Object { $_ -like "*qrc*" } | ForEach-Object { Write-Host "Found RCC file: $_" }
}
& $windeployqt "../Build/Bind/Debug/Bind.exe" --debug --no-compiler-runtime --no-opengl-sw --force
if ($LASTEXITCODE -eq 0) {
Write-Host "Qt deployment completed successfully for Debug build"
Get-ChildItem "../Build/Bind/Debug" -Name | Sort-Object
} else {
Write-Host "windeployqt failed with exit code: $LASTEXITCODE"
}
} else {
Write-Host "windeployqt.exe not found at: $windeployqt"
}
- name: Build Solution (Release x64)
run: |
# Build with proper Environment Variables
Write-Host "Building Release x64..."
Write-Host "QTDIR: $env:QTDIR"
Write-Host "VcpkgRoot: $env:VcpkgRoot"
Write-Host "VCPKG_ROOT: $env:VCPKG_ROOT"
msbuild "../SysCaller.sln" /p:Configuration=Release /p:Platform=x64 /p:VcpkgEnabled=true /p:VcpkgEnableManifest=true /p:VcpkgUseStatic=false /p:VcpkgTriplet=x64-windows /p:QTDIR="$env:QTDIR" /p:VcpkgRoot="$env:VcpkgRoot" /t:Bind
- name: Copy Vcpkg Dependencies (Release)
run: |
Write-Host "Copying Vcpkg Dependencies for Release Build..."
$outputDir = "../Build/Bind/Release"
$vcpkgBin = "${{ github.workspace }}/vcpkg/installed/x64-windows/bin"
# Copy Vcpkg Dependencies (Qt dependencies will be handled by windeployqt)
if (Test-Path "$vcpkgBin/pe-parse.dll") {
Copy-Item "$vcpkgBin/pe-parse.dll" $outputDir
Write-Host "Copied pe-parse.dll"
}
if (Test-Path "$vcpkgBin/cmark.dll") {
Copy-Item "$vcpkgBin/cmark.dll" $outputDir
Write-Host "Copied cmark.dll"
}
Write-Host "Vcpkg dependencies copied to $outputDir"
- name: Deploy Qt Dependencies (Release)
run: |
Write-Host "Running Qt deployment for Release build..."
$qtBin = "D:\a\SysCaller\Qt\5.15.2\msvc2019_64\bin"
$windeployqt = "$qtBin\windeployqt.exe"
if (Test-Path $windeployqt) {
Write-Host "Running windeployqt on Release executable..."
& $windeployqt "../Build/Bind/Release/Bind.exe" --release --no-compiler-runtime --no-opengl-sw --force
if ($LASTEXITCODE -eq 0) {
Write-Host "Qt deployment completed successfully for Release build"
Get-ChildItem "../Build/Bind/Release" -Name | Sort-Object
} else {
Write-Host "windeployqt failed with exit code: $LASTEXITCODE"
}
} else {
Write-Host "windeployqt.exe not found at: $windeployqt"
}
- name: Verify Executables Exist
run: |
if (Test-Path "../Build/Bind/Release/Bind.exe") {
Write-Host "Bind.exe (Release) Built Successfully!"
Get-Item "../Build/Bind/Release/Bind.exe" | Select-Object Name, Length, LastWriteTime
} else {
Write-Host "Bind.exe (Release) not found!"
Get-ChildItem -Recurse -Name "*.exe" | ForEach-Object { Write-Host "Found: $_" }
exit 1
}
if (Test-Path "../Build/Bind/Debug/Bind.exe") {
Write-Host "Bind.exe (Debug) Built Successfully!"
Get-Item "../Build/Bind/Debug/Bind.exe" | Select-Object Name, Length, LastWriteTime
} else {
Write-Host "Bind.exe (Debug) not found!"
}
- name: List Build Directory Contents
run: |
Write-Host "Current Directory Contents:"
Get-ChildItem -Recurse | Where-Object { $_.Name -like "*.exe" -or $_.Name -like "*.pdb" -or $_.Name -like "*.zip" } | Select-Object FullName, Length, LastWriteTime
- name: Upload Build Artifacts (Release)
uses: actions/upload-artifact@v4
with:
name: Bind-Release
path: Build/Bind/Release/
retention-days: 30
- name: Upload Build Artifacts (Debug)
uses: actions/upload-artifact@v4
with:
name: Bind-Debug
path: Build/Bind/Debug/
retention-days: 30
- name: Create Release Package
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
run: |
$version = "v1.3.2"
$zipName = "Bind-$version.zip"
New-Item -ItemType Directory -Path "release-package" -Force
Copy-Item "../Build/Bind/Release/*" "release-package\" -Recurse
# Create the zip file
Compress-Archive -Path "release-package\*" -DestinationPath $zipName -Force
Write-Host "Created Release Package: $zipName"
Get-Item $zipName | Select-Object Name, Length
- name: Upload Release Package
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
uses: actions/upload-artifact@v4
with:
name: Release-Package
path: Bind/Bind-v1.3.2.zip
retention-days: 90
- name: Create GitHub Release
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v1.3.2
release_name: "SysCaller: Bind v1.3.2"
body: |
## SysCaller: Bind v1.3.2
**Build Date:** ${{ github.event.head_commit.timestamp }}
**Commit:** ${{ github.sha }}
**Platform:** Windows x64 (64-bit)
- name: Upload Release Asset
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Bind/Bind-v1.3.2.zip
asset_name: Bind-v1.3.2.zip
asset_content_type: application/zip