-
Notifications
You must be signed in to change notification settings - Fork 37.7k
ci: remove 3rd party js from windows dll gha job #32513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32513. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Concept ACK. Thank you for taking this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 2549a10, tested locally on Windows 11. Additionally tested in my personal repo with invalidated vcpkg binary cache.
2549a10
to
449cb9e
Compare
It might be better to use a more general solution for setting up VS prompts, this would also work once #32396 is merged. - name: Set up VS Developer Prompt
shell: pwsh
run: |
$vswherePath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installationPath = & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -property installationPath
if ($installationPath -and (test-path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -no_logo && set" | foreach-object {
$name, $value = $_ -split '=', 2
echo "$name=$value" >> $env:GITHUB_ENV
}
} This snippet was mostly taken from this |
449cb9e
to
dc403f0
Compare
Rebased and taken @davidgumberg's great suggestion. |
This approach here should also be applied to replace the |
5bd3a34
to
ff2e35f
Compare
@hebasto @davidgumberg I believe all comments have been addressed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK ff2e35f.
While touching this code, it seems reasonable to also address the other @davidgumberg's comment:
Might be nice to have a CI check like davidgumberg@1b98160 to prevent future regressions, but OK for a separate PR if out of scope.
I don't mind adding that. |
I suspect checking for manifests will currently fail for bench_bitcoin.exe as it doesn't yet have a manifest. Not sure about other binaries. Wouldn't be against adding missing manifests unless it slows down the builds noticeably. |
.github/workflows/ci.yml
Outdated
"MT_EXE=${sdk_dir}bin\${sdk_latest}\x64\mt.exe" >> $env:GITHUB_ENV | ||
$vswherePath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" | ||
$installationPath = & $vswherePath -latest -property installationPath | ||
if ($installationPath -and (test-path "$installationPath\Common7\Tools\vsdevcmd.bat")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Sorry for the churn here)
I think we actually want to drop this if
guard here and above, the CI job should fail right here if the path to vsdevcmd.bat
breaks, so that the cause/fix is obvious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry, I'm reworking it to do more manifest checks anyway so changes at this point are fine.
Will look at this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be addressed
ff2e35f
to
a453e66
Compare
Added |
.github/workflows/ci.yml
Outdated
|
||
Write-Host "Checking $exeName" | ||
& mt.exe -nologo -inputresource:$_.FullName -validate_manifest | ||
if ($LASTEXITCODE -ne 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, this if
branch will never be reached since the CI script will exit if the line above has a non-zero exit code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default behaviour in powershell is to continue on error (unless it's a terminating error like throw). When calling a powershell cmdlet you can set $ErrorActionPreference = 'Stop'
but being as this is a call to an external process I don't believe that approach works here, hence why checking the exit code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which now worries me about elsewhere we have used powershell, if it will exit like we think it should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default behaviour in powershell is to continue on error
Do we have that turned off for all of our CIs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't appear to be turned off on our CI and I think it should be.
In Powershell 7.4 and up there is now a setting PSNativeCommandUseErrorActionPreference
which should make calling native commands respect the ErrorActionPreference
so we should set both of those, globally if possible. I will look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wrong about powershell cmdlets: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
Github sets ErrorActionPreference
to stop
but it doesn't appear that they set PSNativeCommandUseErrorActionPreference
which is why calling native executables (like mt.exe) can still fail silently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default behaviour in powershell is to continue on error
Do we have that turned off for all of our CIs?
We did:
bitcoin/.github/workflows/ci.yml
Lines 24 to 28 in e872a56
defaults: | |
run: | |
# Enforce fail-fast behavior for all platforms. | |
# See: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference | |
shell: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hebasto but there are a few places where we use pwsh, which will still fail fast if using exclusively cmdlets but doesn't appear to fail when calling native executables.
Here is a commit to demonstrate it won't always failfast: 4bf1031
and the job run that didn't fail: https://github.com/m3dwards/bitcoin/actions/runs/15415032095/job/43375709475
Suggest we set PSNativeCommandUseErrorActionPreference
to true
everywhere we use pwsh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR enables failing fast for executables in pwsh:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidgumberg force pushed a change so that it behaves how you expected it to: https://github.com/bitcoin/bitcoin/compare/a453e66c827f260da597bf70273bcd0da2313774..7f8393ad745e6bc44dc9481428ea5979ed31a3c9
We can use vswhere.exe directly to create a vs developer prompt and so can remove this third party dependency. Co-authored-by: David Gumberg <davidzgumberg@gmail.com>
This sets up a vs developer command prompt and should hopefully should be more resilient to upstream changes Co-authored-by: David Gumberg <davidzgumberg@gmail.com>
The other executables have manifests and these should be checked in addition to bitcoind. Skipping fuzz.exe, bench_bitcoin.exe and test_bitcoin-qt.exe as they do not have manifests.
a453e66
to
7f8393a
Compare
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 asMSBuild.exe
andmt.exe
. We can remove this dependency and usevswhere.exe
directly to find these tools and create a "Developer command prompt" 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