Skip to content

Commit ec58418

Browse files
committed
Merge bitcoin/bitcoin#32513: ci: remove 3rd party js from windows dll gha job
1569279 ci: Check windows manifests for all executables (Max Edwards) e1a1b14 ci: use a more generic way of finding mt.exe (Max Edwards) 7ae0497 ci: remove 3rd party js from windows dll gha job (Max Edwards) Pull request description: The windows job uses the external dependency `ilammy/msvc-dev-cmd` which runs javascript. We use this to put various tools on the path such as `MSBuild.exe` and `mt.exe`. We can remove this dependency and use `vswhere.exe` directly to find these tools and create a "[Developer command prompt](https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt#using-powershell)" as someone would on their dev machine. While in this area of the code, this PR also runs some additional manifest checks on the windows binaries. Fixes: #32508 ACKs for top commit: davidgumberg: crACK 1569279 hebasto: ACK 1569279. Tree-SHA512: df640dff27579a1c95daddc5a5ba8fd655bbd0a6f2aff74d0f63439c7185c0b18a90abfee3f1f032fe833cd19b822ef71812f44b24c4c044222e46d01c271864
2 parents d735e2e + 1569279 commit ec58418

File tree

1 file changed

+44
-20
lines changed

1 file changed

+44
-20
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,16 @@ jobs:
211211
steps:
212212
- *CHECKOUT
213213

214-
- name: Configure Developer Command Prompt for Microsoft Visual C++
215-
# Using microsoft/setup-msbuild is not enough.
216-
uses: ilammy/msvc-dev-cmd@v1
217-
with:
218-
arch: x64
214+
- &SET_UP_VS
215+
name: Set up VS Developer Prompt
216+
shell: pwsh -Command "$PSVersionTable; $PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'Stop'; & '{0}'"
217+
run: |
218+
$vswherePath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
219+
$installationPath = & $vswherePath -latest -property installationPath
220+
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | foreach-object {
221+
$name, $value = $_ -split '=', 2
222+
echo "$name=$value" >> $env:GITHUB_ENV
223+
}
219224
220225
- name: Get tool information
221226
shell: pwsh
@@ -263,14 +268,26 @@ jobs:
263268
run: |
264269
cmake --build . -j $NUMBER_OF_PROCESSORS --config Release
265270
266-
- name: Get bitcoind manifest
271+
- name: Check executable manifests
267272
if: matrix.job-type == 'standard'
268273
working-directory: build
274+
shell: pwsh -Command "$PSVersionTable; $PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'Stop'; & '{0}'"
269275
run: |
270-
mt.exe -nologo -inputresource:bin/Release/bitcoind.exe -out:bitcoind.manifest
271-
cat bitcoind.manifest
272-
echo
273-
mt.exe -nologo -inputresource:bin/Release/bitcoind.exe -validate_manifest
276+
mt.exe -nologo -inputresource:bin\Release\bitcoind.exe -out:bitcoind.manifest
277+
Get-Content bitcoind.manifest
278+
279+
Get-ChildItem -Filter "bin\Release\*.exe" | ForEach-Object {
280+
$exeName = $_.Name
281+
282+
# Skip as they currently do not have manifests
283+
if ($exeName -eq "fuzz.exe" -or $exeName -eq "bench_bitcoin.exe" -or $exeName -eq "test_bitcoin-qt.exe") {
284+
Write-Host "Skipping $exeName (no manifest present)"
285+
return
286+
}
287+
288+
Write-Host "Checking $exeName"
289+
& mt.exe -nologo -inputresource:$_.FullName -validate_manifest
290+
}
274291
275292
- name: Run test suite
276293
if: matrix.job-type == 'standard'
@@ -370,19 +387,26 @@ jobs:
370387
- name: Run bitcoind.exe
371388
run: ./bin/bitcoind.exe -version
372389

373-
- name: Find mt.exe tool
374-
shell: pwsh
375-
run: |
376-
$sdk_dir = (Get-ItemProperty 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots' -Name KitsRoot10).KitsRoot10
377-
$sdk_latest = (Get-ChildItem "$sdk_dir\bin" -Directory | Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } | Sort-Object Name -Descending | Select-Object -First 1).Name
378-
"MT_EXE=${sdk_dir}bin\${sdk_latest}\x64\mt.exe" >> $env:GITHUB_ENV
390+
- *SET_UP_VS
379391

380-
- name: Get bitcoind manifest
381-
shell: pwsh
392+
- name: Check executable manifests
393+
shell: pwsh -Command "$PSVersionTable; $PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'Stop'; & '{0}'"
382394
run: |
383-
& $env:MT_EXE -nologo -inputresource:bin\bitcoind.exe -out:bitcoind.manifest
395+
mt.exe -nologo -inputresource:bin\bitcoind.exe -out:bitcoind.manifest
384396
Get-Content bitcoind.manifest
385-
& $env:MT_EXE -nologo -inputresource:bin\bitcoind.exe -validate_manifest
397+
398+
Get-ChildItem -Filter "bin\*.exe" | ForEach-Object {
399+
$exeName = $_.Name
400+
401+
# Skip as they currently do not have manifests
402+
if ($exeName -eq "fuzz.exe" -or $exeName -eq "bench_bitcoin.exe") {
403+
Write-Host "Skipping $exeName (no manifest present)"
404+
return
405+
}
406+
407+
Write-Host "Checking $exeName"
408+
& mt.exe -nologo -inputresource:$_.FullName -validate_manifest
409+
}
386410
387411
- name: Run unit tests
388412
# Can't use ctest here like other jobs as we don't have a CMake build tree.

0 commit comments

Comments
 (0)