-
Notifications
You must be signed in to change notification settings - Fork 52
feat: implement static builds for Mithril nodes in CI #2998
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
Merged
turmelclem
merged 39 commits into
main
from
ctl/2989-implement-static-build-for-Mithril-nodes_in-CI
Mar 19, 2026
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
7dcb25b
refactor(client, common, stm): switching from rug to num-integer
turmelclem 41b212f
feature(ci): statically build aggregator, signer and client in github ci
turmelclem 8d7212f
refactor(client-cli, ci): remove ../ from assets variable for automat…
turmelclem e2d1f1d
feature(ci): add a step in the CI verifying binaries build are static
turmelclem 29e8d06
refactor(aggregator, signer, ci): remove jemallicator from default fe…
turmelclem 4fa7d3c
feature(ci): add a step in the CI verifying binaries build are static…
turmelclem d6ce3ce
feature(hydra): statically build aggregator, client and signer in Hydra
turmelclem b76339b
feat(nix): build static versions of the aggregator, signer and client
jpraynaud 00d54a5
feat: remove reqwest default features
jpraynaud e9ce46f
refactor(ci): move static build checks in a dedicated github action a…
turmelclem 66d2a3d
refactor(ci): handle build target path for the build-upload-mithril-a…
turmelclem 4bb1f22
refactor(ci): add a step moving binaries in a same root folder to avo…
turmelclem 5778deb
refactor(ci): move static build check inside build-upload-mithril-art…
turmelclem 4fe502c
refactor(ci): use runner.os instead of distribution os from input matrix
turmelclem 8c71544
feature(nix): only build aggregator, signer and client-cli statically…
turmelclem 3d1d6ff
feature(client, nix): make feature TLS mandatory for client library c…
turmelclem e82ae2d
refactor(aggregator, signer, ci, nix): make Jemmallocator a default d…
turmelclem b7f9559
chore: upgrade dockerfile devian version to debian 13
turmelclem d539ddf
feature(aggregator, signer): add Mimalloc has Jemalloc replacement fo…
turmelclem ad437b2
docs: remove mentions of glibc
turmelclem 5e9cfbc
refactor(relay): download adduser dependency for docker image
turmelclem 17d661f
refactor(chore): check glibc version only with dynamic binary after d…
turmelclem d83c57b
refactor(client-cli): switch default allocator to Jemalloc (Linux) or…
turmelclem 18833bd
refactor(client): update documentation about TLS usage
turmelclem d42f47a
refactor(ci): check for all binaries static instead of just the client
turmelclem 820b1e9
refactor(chore): improve static binaries check verification in instal…
turmelclem b79ee82
refactor(cargo.lock): downgrading yamux version because of a vulnerab…
turmelclem daec30d
refactor(ci, flake): avoid pkgs redefinition
turmelclem d598dec
fix(ci): flakiness in decentralized e2e test
jpraynaud d51ff3d
refactor(ci, aggregator): rework CI build using '--bins -p' instead o…
turmelclem 7cd8f24
refactor(ci): simplify toolchain installation
turmelclem 92852e7
refactor(ci, relay, client): fix some wording and ordering features
turmelclem f594f4f
refactor(ci): split static binaries verification in three steps based…
turmelclem ee96cd5
refactor(ci, hydra): remove docheck=false to trigger unit tests
turmelclem 48efe75
refactor(ci): rework binaries dependencies check on windows with a li…
turmelclem 344c62a
refactor(examples): specify rustls-tls feature inside mithril-client …
turmelclem f22cbfc
refactor(signer, relay, end-to-end) set rustls-tls has default feature
turmelclem 38a1fb8
docs: update CHANGELOG
turmelclem e028b52
chore: upgrade crate versions and `mithril-test-lab/mithril-devnet/VE…
turmelclem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
193 changes: 193 additions & 0 deletions
193
.github/workflows/actions/check-static-binaries/action.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,193 @@ | ||
| name: check-static-binaries | ||
| description: Verify that binaries are statically linked (cross-platform support) | ||
|
|
||
| inputs: | ||
| binaries: | ||
| description: "Comma-separated list of binary names to check" | ||
| required: true | ||
| target-path: | ||
| description: "Path to the directory containing the binaries" | ||
| required: true | ||
| default: "target/release" | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Check Linux static binaries | ||
| if: runner.os == 'Linux' | ||
| shell: pwsh | ||
| run: | | ||
| $BINARIES = "${{ inputs.binaries }}" | ||
| $TARGET_PATH = "${{ inputs.target-path }}" | ||
|
|
||
| foreach ($bin in $BINARIES -split ",") { | ||
| $bin = $bin.Trim() | ||
| $BIN_PATH = "$TARGET_PATH/$bin" | ||
|
|
||
| Write-Host "Checking $bin is statically linked..." | ||
|
|
||
| if (-Not (Test-Path $BIN_PATH)) { | ||
| Write-Host "❌ Binary not found at $BIN_PATH" | ||
| exit 1 | ||
| } | ||
|
|
||
| $output = & readelf -d $BIN_PATH 2>$null | Select-String NEEDED | ||
| if ($output) { | ||
| Write-Host "❌ $bin is NOT static (has dynamic dependencies)" | ||
| exit 1 | ||
| } | ||
| Write-Host "✅ $bin is fully static" | ||
| } | ||
|
|
||
| Write-Host "🎉 All binaries are static!" | ||
| exit 0 | ||
|
|
||
| - name: Check macOS static binaries | ||
| if: runner.os == 'macOS' | ||
| shell: pwsh | ||
| run: | | ||
| $BINARIES = "${{ inputs.binaries }}" | ||
| $TARGET_PATH = "${{ inputs.target-path }}" | ||
|
|
||
| $MACOS_ALLOWED_DEPS = @( | ||
| "/System/Library/Frameworks/Security.framework", | ||
| "/System/Library/Frameworks/SystemConfiguration.framework", | ||
| "/System/Library/Frameworks/CoreFoundation.framework", | ||
| "/usr/lib/libiconv", | ||
| "/usr/lib/libSystem" | ||
| ) | ||
|
|
||
| function IsMacosAllowed { | ||
| param([string]$dep) | ||
| foreach ($allowed in $MACOS_ALLOWED_DEPS) { | ||
| if ($dep -like "$allowed*") { | ||
| return $true | ||
| } | ||
| } | ||
| return $false | ||
| } | ||
|
|
||
| foreach ($bin in $BINARIES -split ",") { | ||
| $bin = $bin.Trim() | ||
| $BIN_PATH = "$TARGET_PATH/$bin" | ||
|
|
||
| Write-Host "Checking $bin is statically linked..." | ||
|
|
||
| if (-Not (Test-Path $BIN_PATH)) { | ||
| Write-Host "❌ Binary not found at $BIN_PATH" | ||
| exit 1 | ||
| } | ||
|
|
||
| $disallowed_deps = @() | ||
| $otool_output = & otool -L $BIN_PATH 2>$null | Select-Object -Skip 1 | ||
|
|
||
| foreach ($line in $otool_output) { | ||
| $dep = ($line -split '\s+')[0] | ||
|
|
||
| if ([string]::IsNullOrWhiteSpace($dep) -or $dep -like "@*") { | ||
| continue | ||
| } | ||
|
|
||
| if (-Not (IsMacosAllowed $dep)) { | ||
| $disallowed_deps += $dep | ||
| } | ||
| } | ||
|
|
||
| if ($disallowed_deps.Count -gt 0) { | ||
| Write-Host "❌ $bin has disallowed dynamic dependencies:" | ||
| foreach ($dep in $disallowed_deps) { | ||
| Write-Host " - $dep" | ||
| } | ||
| exit 1 | ||
| } | ||
| Write-Host "✅ $bin is fully static (or has only whitelisted system dependencies)" | ||
| } | ||
|
|
||
| Write-Host "🎉 All binaries are static!" | ||
| exit 0 | ||
|
|
||
| - name: Check Windows static binaries | ||
| if: runner.os == 'Windows' | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| BINARIES="${{ inputs.binaries }}" | ||
| TARGET_PATH="${{ inputs.target-path }}" | ||
|
|
||
| WHITELIST=( | ||
| "KERNEL32.dll" | ||
| "ntdll.dll" | ||
| "bcryptprimitives.dll" | ||
| "advapi32.dll" | ||
| "secur32.dll" | ||
| "ws2_32.dll" | ||
| "crypt32.dll" | ||
| "bcrypt.dll" | ||
| "api-ms-win-core-synch-l1-2-0.dll" | ||
| "userenv.dll" | ||
| "VCRUNTIME140.dll" | ||
| "api-ms-win-crt-math-l1-1-0.dll" | ||
| "api-ms-win-crt-string-l1-1-0.dll" | ||
| "api-ms-win-crt-heap-l1-1-0.dll" | ||
| "api-ms-win-crt-stdio-l1-1-0.dll" | ||
| "api-ms-win-crt-runtime-l1-1-0.dll" | ||
| "api-ms-win-crt-locale-l1-1-0.dll" | ||
| ) | ||
|
|
||
| check_binary() { | ||
| local bin="$1" | ||
| local path="$TARGET_PATH/${bin}.exe" | ||
|
|
||
| echo "Checking $bin is statically linked..." | ||
|
|
||
| if [[ ! -f "$path" ]]; then | ||
| echo "❌ Binary not found at $path" | ||
| exit 1 | ||
| fi | ||
|
|
||
| DLLS=$(objdump -p "$path" | grep "DLL Name" | awk '{print $3}' || true) | ||
|
|
||
| echo "Detected DLLs:" | ||
| echo "$DLLS" | ||
|
|
||
| local non_whitelisted=() | ||
|
|
||
| while IFS= read -r dll; do | ||
| [[ -z "$dll" ]] && continue | ||
|
|
||
| local allowed=false | ||
| for w in "${WHITELIST[@]}"; do | ||
| if [[ "${dll^^}" == "${w^^}" ]]; then | ||
| allowed=true | ||
| break | ||
| fi | ||
| done | ||
|
|
||
| if [[ "$allowed" == false ]]; then | ||
| non_whitelisted+=("$dll") | ||
| fi | ||
| done <<< "$DLLS" | ||
|
|
||
| if [[ ${#non_whitelisted[@]} -eq 0 ]]; then | ||
| echo "✅ $bin is fully static (or has only whitelisted system dependencies)" | ||
| else | ||
| echo "❌ $bin is NOT static" | ||
| echo "Unexpected DLLs:" | ||
| for dll in "${non_whitelisted[@]}"; do | ||
| echo " - $dll" | ||
| done | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo | ||
| } | ||
|
|
||
| IFS=',' read -ra BIN_ARRAY <<< "$BINARIES" | ||
|
|
||
| for raw in "${BIN_ARRAY[@]}"; do | ||
| bin="$(echo "$raw" | xargs)" # trim | ||
| check_binary "$bin" | ||
| done | ||
|
|
||
| echo "🎉 All binaries are static!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.