Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions .github/workflows/csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,54 @@ on:
pull_request:
paths:
- payjoin-ffi/**
env:
RUSTUP_TOOLCHAIN: 1.85

jobs:
build-csharp-and-test:
build-csharp-and-test-unix:
name: "Build and test csharp"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- name: "Install nix"
uses: DeterminateSystems/determinate-nix-action@main
- name: "Use nix cache"
uses: DeterminateSystems/magic-nix-cache-action@main
- name: "Build and test"
run: nix develop .#csharp -c ./payjoin-ffi/csharp/contrib/test.sh

build-csharp-and-test-windows:
name: "Build and test csharp (windows)"
runs-on: windows-latest
env:
RUSTUP_TOOLCHAIN: 1.85
defaults:
run:
working-directory: payjoin-ffi/csharp
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust 1.85.0
uses: dtolnay/rust-toolchain@1.85.0

- name: Use cache
uses: Swatinem/rust-cache@v2

- name: Install .NET 8 SDK
- name: Install .NET 10 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
dotnet-version: "10.0.x"

- name: Verify .NET SDK
run: |
dotnet --version
dotnet --list-sdks

- name: Generate bindings and binaries (unix)
if: matrix.os != 'windows-latest'
run: bash ./scripts/generate_bindings.sh

- name: Generate bindings and binaries (windows)
if: matrix.os == 'windows-latest'
- name: Generate bindings and binaries
shell: pwsh
run: ./scripts/generate_bindings.ps1

Expand Down
21 changes: 8 additions & 13 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,22 @@ on:
pull_request:
paths:
- payjoin-ffi/**
env:
# Override the value from the rust-toolchain file
# This is necessary because even though the correct toolchain
# is explicitly specified for the rust-toolchain action,
# rustup honors the rust-toolchain file over the default
RUSTUP_TOOLCHAIN: 1.85

jobs:
build-dart-and-test:
name: "Build and test dart"
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: payjoin-ffi/dart
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Build and test
run: nix develop --command bash ./contrib/test.sh
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- name: "Install nix"
uses: DeterminateSystems/determinate-nix-action@main
- name: "Use nix cache"
uses: DeterminateSystems/magic-nix-cache-action@main
- name: "Build and test"
run: nix develop .#dart -c bash ./payjoin-ffi/dart/contrib/test.sh
9 changes: 1 addition & 8 deletions .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,17 @@ jobs:
build-js-and-test:
name: "Build and test javascript"
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: payjoin-ffi/javascript
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: "Use cache"
uses: Swatinem/rust-cache@v2

- name: "Install nix"
uses: DeterminateSystems/determinate-nix-action@main

- name: "Use nix cache"
uses: DeterminateSystems/magic-nix-cache-action@main

- name: "Build and test"
run: nix develop .#msrv -c ./contrib/test.sh
run: nix develop .#javascript -c ./payjoin-ffi/javascript/contrib/test.sh
16 changes: 7 additions & 9 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ on:
pull_request:
paths:
- payjoin-ffi/**
env:
# Override the value from the rust-toolchain file
# This is necessary because even though the correct toolchain
# is explicitly specified for the rust-toolchain action,
# rustup honors the rust-toolchain file over the default
RUSTUP_TOOLCHAIN: 1.85

jobs:
build-python-and-test:
Expand All @@ -25,7 +19,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Build and test
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- name: "Install nix"
uses: DeterminateSystems/determinate-nix-action@main
- name: "Use nix cache"
uses: DeterminateSystems/magic-nix-cache-action@main
- name: "Build and test"
run: nix develop .#python --command bash ./payjoin-ffi/python/contrib/test.sh
127 changes: 95 additions & 32 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,6 @@
"rustfmt"
"llvm-tools-preview"
];
# Targets needed by payjoin-ffi/{python,javascript}/scripts/generate_bindings.sh
# so cargo can build per-arch artifacts under nix (rustup target add
# is a no-op against a nix-provided toolchain).
targets = [
"wasm32-unknown-unknown"
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
"aarch64-apple-darwin"
"x86_64-apple-darwin"
]
++ pkgs.lib.optionals pkgs.stdenv.isLinux [
"x86_64-unknown-linux-gnu"
];
}
)
{
Expand Down Expand Up @@ -272,10 +259,7 @@
"payjoin-mailroom-image" = mkContainerImage "payjoin-mailroom" packages.payjoin-mailroom tag;
};

dotnetSdk = pkgs.dotnetCorePackages.combinePackages [
pkgs.dotnetCorePackages.sdk_10_0
pkgs.dotnetCorePackages.runtime_8_0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if we stick to dotnet 10? The previous PR touching this file assumed we needed to have donnet 8 compatibility, but we're gonna upgrade BTCPay and the Plugin to use dotnet 10 from now on....

I'm wondering if this had to be brought back because of a regression?

Copy link
Copy Markdown
Collaborator Author

@benalleng benalleng May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error I was getting was due to the inability to find the net_8 apphost file while using the he 1.0 sdk when running ./payjoin-ffi/csharp/contrib/test.sh I think it must have to do with some build step misconfiguration on my end.

/nix/store/60wblmm28bvni14276vvmi3p77hmxw79-dotnet-sdk-10.0.203/share/dotnet/sdk/10.0.203/Microsoft.Common.CurrentVersion.targets(5395,5): error MSB3030: Could not copy the file "/home/runner/work/rust-payjoin/rust-payjoin/payjoin-ffi/csharp/obj/Debug/net8.0/apphost" because it was not found. [/home/runner/work/rust-payjoin/rust-payjoin/payjoin-ffi/csharp/Payjoin.Tests.csproj]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed we can avoid bringing back .NET 8 entirely. I tested the stricter path: move the C# test project to net10.0, drop runtime_8_0 from the Nix shell, and update CI to install .NET 10.

Suggested change:

diff --git a/flake.nix b/flake.nix
@@
-        dotnetSdk = pkgs.dotnetCorePackages.combinePackages [
-          pkgs.dotnetCorePackages.sdk_10_0
-          pkgs.dotnetCorePackages.runtime_8_0
-        ];
+        dotnetSdk = pkgs.dotnetCorePackages.sdk_10_0;

diff --git a/payjoin-ffi/csharp/Payjoin.Tests.csproj b/payjoin-ffi/csharp/Payjoin.Tests.csproj
@@
-    <TargetFramework>net8.0</TargetFramework>
+    <TargetFramework>net10.0</TargetFramework>

diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml
@@
-      - name: Install .NET 8 SDK
+      - name: Install .NET 10 SDK
         uses: actions/setup-dotnet@v4
         with:
-          dotnet-version: "8.0.x"
+          dotnet-version: "10.0.x"

Local verification passes:

  • nix develop -c dotnet --info shows only .NET 10 SDK/runtime
  • nix develop -c bash payjoin-ffi/csharp/contrib/test.sh passes: 27 tests under net10.0
  • git diff --check
  • nix fmt -- --ci

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, the last missing step was the global.json config specifying the sdk version as 8.0.100

];
dotnetSdk = pkgs.dotnetCorePackages.sdk_10_0;

devShells = builtins.mapAttrs (
_name: craneLib:
Expand All @@ -287,29 +271,15 @@
cargo-nextest
cargo-watch
rust-analyzer
dart
dotnetSdk
cargo-fuzz
bzip2 # needed for some machines to have access to libzip at runtime
codespell
# secp256k1-sys build.rs invokes cc-rs for the wasm32-unknown-unknown
# target; cc-rs defaults to clang for wasm and needs llvm-ar.
llvmPackages.clang-unwrapped
llvmPackages.bintools-unwrapped
lld
# Version must match the wasm-bindgen crate locked in
# payjoin-ffi/javascript/rust_modules/wasm/Cargo.lock.
wasm-bindgen-cli_0_2_108
]
++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [
cargo-llvm-cov
];
BITCOIND_EXE = pkgs.lib.getExe' pkgs.bitcoind "bitcoind";
BITCOIND_SKIP_DOWNLOAD = 1;
DOTNET_ROOT = "${dotnetSdk}/share/dotnet";
DOTNET_CLI_TELEMETRY_OPTOUT = "1";
CC_wasm32_unknown_unknown = "${pkgs.llvmPackages.clang-unwrapped}/bin/clang";
AR_wasm32_unknown_unknown = "${pkgs.llvmPackages.bintools-unwrapped}/bin/llvm-ar";
}
) craneLibVersions;

Expand Down Expand Up @@ -338,14 +308,104 @@
builtins.removeAttrs pythonWorkspace.deps.all [ "payjoin" ]
);

# Rust toolchain for the javascript dev shell: msrv pinned to match
# payjoin-ffi/javascript build requirements, with wasm32 target added
# so cargo can build per-arch artifacts under nix (rustup target add
# is a no-op against a nix-provided toolchain).
jsRustToolchain = pkgs.rust-bin.stable.${msrv-version}.default.override {
extensions = [
"rust-src"
"rustfmt"
"llvm-tools-preview"
];
targets = [ "wasm32-unknown-unknown" ];
};

javascriptDevShell = pkgs.mkShell {
name = "javascript-dev";
packages = with pkgs; [
jsRustToolchain
nodejs
# Version must match the wasm-bindgen crate locked in
# payjoin-ffi/javascript/rust_modules/wasm/Cargo.lock.
wasm-bindgen-cli_0_2_108
# secp256k1-sys build.rs invokes cc-rs for the wasm32-unknown-unknown
# target; cc-rs defaults to clang for wasm and needs llvm-ar.
llvmPackages.clang-unwrapped
llvmPackages.bintools-unwrapped
lld
bzip2 # needed for some machines to have access to libzip at runtime
];
CC_wasm32_unknown_unknown = "${pkgs.llvmPackages.clang-unwrapped}/bin/clang";
AR_wasm32_unknown_unknown = "${pkgs.llvmPackages.bintools-unwrapped}/bin/llvm-ar";
};

dartDevShell = pkgs.mkShell {
name = "dart-dev";
packages =
with pkgs;
[
rustVersions.msrv
dart
bzip2
]
++ lib.optionals pkgs.stdenv.isLinux [
pkg-config
openssl
clang
];
BITCOIND_EXE = pkgs.lib.getExe' pkgs.bitcoind "bitcoind";
BITCOIND_SKIP_DOWNLOAD = 1;
};

csharpDevShell = pkgs.mkShell {
name = "csharp-dev";
packages =
with pkgs;
[
rustVersions.msrv
dotnetSdk
bzip2
]
++ lib.optionals pkgs.stdenv.isLinux [
pkg-config
openssl
clang
];
DOTNET_ROOT = "${dotnetSdk}/share/dotnet";
DOTNET_CLI_TELEMETRY_OPTOUT = "1";
BITCOIND_EXE = pkgs.lib.getExe' pkgs.bitcoind "bitcoind";
BITCOIND_SKIP_DOWNLOAD = 1;
};

# Rust toolchain for the python dev shell: msrv pinned to match
# payjoin-ffi/python build requirements, with per-arch targets added
# so cargo can build artifacts under nix for payjoin-ffi/python/scripts/generate_bindings.sh
# (rustup target add is a no-op against a nix-provided toolchain).
pythonRustToolchain = pkgs.rust-bin.stable.${msrv-version}.default.override {
extensions = [
"rust-src"
"rustfmt"
"llvm-tools-preview"
];
targets =
pkgs.lib.optionals pkgs.stdenv.isDarwin [
"aarch64-apple-darwin"
"x86_64-apple-darwin"
]
++ pkgs.lib.optionals pkgs.stdenv.isLinux [
"x86_64-unknown-linux-gnu"
];
};

pythonDevShell = pkgs.mkShell {
name = "python-dev";
packages =
with pkgs;
[
pythonVenv
uv
rustVersions.msrv
pythonRustToolchain
bzip2 # needed for some machines to have access to libzip at runtime
]
++ lib.optionals pkgs.stdenv.isLinux [
Expand Down Expand Up @@ -398,6 +458,9 @@
devShells = devShells // {
default = devShells.nightly;
python = pythonDevShell;
javascript = javascriptDevShell;
csharp = csharpDevShell;
dart = dartDevShell;
};
formatter = treefmtEval.config.build.wrapper;
checks =
Expand Down
2 changes: 1 addition & 1 deletion payjoin-ffi/csharp/Payjoin.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- Required by UniFFI-generated interop code (pointer usage in payjoin.cs); disabling /unsafe fails with CS0227. -->
Expand Down
Loading