From f2001bffc584e4ebd77105badd2d2476cf83aa5d Mon Sep 17 00:00:00 2001 From: chavic Date: Fri, 17 Jul 2026 15:03:49 +0200 Subject: [PATCH] Pin bindings CI to the maintained lockfile The bindings test scripts ran bare cargo with no lockfile, so every CI run resolved the whole dependency graph to the latest crates. tokio 1.53.0 made the cost concrete: it resolves as 1.85-compatible but uses Once::wait, stabilized in 1.86, in its Windows-only signal code, which broke the Windows csharp job on every pull request. Source contrib/lockfile.sh and build against Cargo-recent.lock in the four bindings test entry points, the same mechanism the Rust jobs use and the lock-maintenance workflow keeps updated. The Windows csharp entry point mirrors it in PowerShell since lockfile.sh is bash. lockfile.sh now records absolute paths: its EXIT trap restored the lockfile relative to the current directory, which silently no-ops for callers that change directory after use_lockfile, as these scripts do. The detached payjoin-ffi/dart/native wrapper workspace still resolves fresh and is left for a separate change. --- contrib/lockfile.sh | 8 ++++--- payjoin-ffi/csharp/contrib/test.sh | 10 ++++++++- .../csharp/scripts/generate_bindings.ps1 | 22 +++++++++++++++++++ payjoin-ffi/dart/contrib/test.sh | 10 ++++++++- payjoin-ffi/javascript/contrib/test.sh | 10 ++++++++- payjoin-ffi/python/contrib/test.sh | 10 ++++++++- 6 files changed, 63 insertions(+), 7 deletions(-) diff --git a/contrib/lockfile.sh b/contrib/lockfile.sh index 4c57d0b0d..39f68d53f 100644 --- a/contrib/lockfile.sh +++ b/contrib/lockfile.sh @@ -1,9 +1,11 @@ #!/usr/bin/env bash set -euo pipefail -LOCKFILE="Cargo.lock" -LOCKDIR=".bak" -LOCKFILE_BAK="${LOCKDIR}/${LOCKFILE}" +# Absolute paths so the EXIT trap restores the lockfile even if the sourcing +# script changes directory after calling use_lockfile. +LOCKFILE="${PWD}/Cargo.lock" +LOCKDIR="${PWD}/.bak" +LOCKFILE_BAK="${LOCKDIR}/Cargo.lock" _cleanup_lockfile() { if [ -f "$LOCKFILE_BAK" ]; then diff --git a/payjoin-ffi/csharp/contrib/test.sh b/payjoin-ffi/csharp/contrib/test.sh index 73cfcf3df..3445c3048 100755 --- a/payjoin-ffi/csharp/contrib/test.sh +++ b/payjoin-ffi/csharp/contrib/test.sh @@ -1,7 +1,15 @@ #!/usr/bin/env bash set -euo pipefail -cd "$(dirname "$0")/.." +# Build against the maintained lockfile instead of resolving the dependency +# graph fresh on every run. use_lockfile copies Cargo-recent.lock into place +# and restores the previous state when this script exits. +REPO_ROOT="$(cd "$(dirname "$0")/../../.." && pwd)" +cd "$REPO_ROOT" +source contrib/lockfile.sh +use_lockfile Cargo-recent.lock + +cd "$REPO_ROOT/payjoin-ffi/csharp" echo "==> Generating FFI bindings..." bash ./scripts/generate_bindings.sh diff --git a/payjoin-ffi/csharp/scripts/generate_bindings.ps1 b/payjoin-ffi/csharp/scripts/generate_bindings.ps1 index 52e782508..801a93fe2 100644 --- a/payjoin-ffi/csharp/scripts/generate_bindings.ps1 +++ b/payjoin-ffi/csharp/scripts/generate_bindings.ps1 @@ -36,6 +36,20 @@ $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $payjoinFfiDir = Resolve-Path (Join-Path $scriptDir "..\..") Set-Location $payjoinFfiDir +# Build against the maintained lockfile instead of resolving the dependency +# graph fresh on every run; mirrors contrib/lockfile.sh for this Windows entry +# point. The previous lockfile state is restored before the script exits. +$repoRoot = Resolve-Path (Join-Path $payjoinFfiDir "..") +$lockFile = Join-Path $repoRoot "Cargo.lock" +$lockBackup = $null +if (Test-Path $lockFile) { + $lockBackup = "$lockFile.bak" + Move-Item $lockFile $lockBackup -Force +} +Copy-Item (Join-Path $repoRoot "Cargo-recent.lock") $lockFile -Force + +try { + Write-Host "Generating payjoin C#..." if ($null -ne $env:PAYJOIN_FFI_FEATURES) { $payjoinFfiFeatures = $env:PAYJOIN_FFI_FEATURES @@ -73,4 +87,12 @@ Write-Host "Copying native library..." New-Item -ItemType Directory -Force -Path "csharp/lib" | Out-Null Copy-Item "../target/debug/$libName" "csharp/lib/$libName" -Force +} +finally { + Remove-Item $lockFile -Force -ErrorAction SilentlyContinue + if ($null -ne $lockBackup) { + Move-Item $lockBackup $lockFile -Force + } +} + Write-Host "All done!" diff --git a/payjoin-ffi/dart/contrib/test.sh b/payjoin-ffi/dart/contrib/test.sh index 35b3c16bf..227491e50 100755 --- a/payjoin-ffi/dart/contrib/test.sh +++ b/payjoin-ffi/dart/contrib/test.sh @@ -1,7 +1,15 @@ #!/usr/bin/env bash set -euo pipefail -cd "$(dirname "$0")/.." +# Build against the maintained lockfile instead of resolving the dependency +# graph fresh on every run. use_lockfile copies Cargo-recent.lock into place +# and restores the previous state when this script exits. +REPO_ROOT="$(cd "$(dirname "$0")/../../.." && pwd)" +cd "$REPO_ROOT" +source contrib/lockfile.sh +use_lockfile Cargo-recent.lock + +cd "$REPO_ROOT/payjoin-ffi/dart" echo "==> Cleaning nested Cargo.lock..." rm -f native/Cargo.lock diff --git a/payjoin-ffi/javascript/contrib/test.sh b/payjoin-ffi/javascript/contrib/test.sh index 97166766e..4b91fbc59 100755 --- a/payjoin-ffi/javascript/contrib/test.sh +++ b/payjoin-ffi/javascript/contrib/test.sh @@ -1,7 +1,15 @@ #!/usr/bin/env bash set -euo pipefail -cd "$(dirname "$0")/.." +# Build against the maintained lockfile instead of resolving the dependency +# graph fresh on every run. use_lockfile copies Cargo-recent.lock into place +# and restores the previous state when this script exits. +REPO_ROOT="$(cd "$(dirname "$0")/../../.." && pwd)" +cd "$REPO_ROOT" +source contrib/lockfile.sh +use_lockfile Cargo-recent.lock + +cd "$REPO_ROOT/payjoin-ffi/javascript" echo "==> Installing JavaScript dependencies..." npm ci diff --git a/payjoin-ffi/python/contrib/test.sh b/payjoin-ffi/python/contrib/test.sh index 46f9a2871..ac43385d0 100755 --- a/payjoin-ffi/python/contrib/test.sh +++ b/payjoin-ffi/python/contrib/test.sh @@ -1,7 +1,15 @@ #!/usr/bin/env bash set -euo pipefail -cd "$(dirname "$0")/.." +# Build against the maintained lockfile instead of resolving the dependency +# graph fresh on every run. use_lockfile copies Cargo-recent.lock into place +# and restores the previous state when this script exits. +REPO_ROOT="$(cd "$(dirname "$0")/../../.." && pwd)" +cd "$REPO_ROOT" +source contrib/lockfile.sh +use_lockfile Cargo-recent.lock + +cd "$REPO_ROOT/payjoin-ffi/python" echo "==> Syncing Python dependencies with uv..." uv sync --all-extras