From e3be58b51c2d569db0403c953427ee592f59a49d Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 13 Nov 2026 10:56:43 +0000 Subject: [PATCH 1/4] feat: add windows arm64 support - download pact_ffi-windows-aarch64.dll from libpact_ffi v0.4.27 - pack it under runtimes/win-arm64/native so the .NET host picks it on Windows on ARM - copy the arm64 dll to the output dir for in-repo builds on arm64 Windows hosts - .NET Framework targets: use win-arm64 when PlatformTarget is ARM64, otherwise win-x64 - CI: build and test on the windows-11-arm runner - docs: list Windows ARM64 as supported --- .github/workflows/ci.yml | 2 ++ CONTRIBUTING.md | 2 ++ README.md | 1 + build/PactNet.targets | 16 ++++++++++++++-- build/download-native-libs.sh | 1 + src/PactNet/PactNet.csproj | 9 ++++++++- 6 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca135af57..74a5429f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,8 @@ jobs: os: macos-15 - arch: ARM64 os: ubuntu-24.04-arm + - arch: ARM64 + os: windows-11-arm runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v7 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a8aa3f7a8..7ca094bcb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,6 +75,8 @@ build/ x86_64/ libpact_ffi.dylib windows/ + aarch64/ + pact_ffi.dll x86_64/ pact_ffi.dll ``` diff --git a/README.md b/README.md index c70c541bb..0e1d14dc2 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,7 @@ Due to using a shared native library instead of C# for the main Pact logic only | ------------ | ------------ | -------------------------------------------------------------------| | Windows | x86 | ❌ No | | Windows | x64 | ✔️ Yes | +| Windows | ARM64 | ✔️ Yes | | Linux (libc) | ARM64 | ✔️ Yes | | Linux (libc) | x64 | ✔️ Yes | | Linux (libc) | x86 | ❌ No | diff --git a/build/PactNet.targets b/build/PactNet.targets index 0b3218e56..f475bbc28 100644 --- a/build/PactNet.targets +++ b/build/PactNet.targets @@ -1,7 +1,19 @@ - - + + + + pact_ffi.dll + PreserveNewest + false + + + pact_ffi.dll PreserveNewest diff --git a/build/download-native-libs.sh b/build/download-native-libs.sh index c3ace8918..d12cd5f39 100755 --- a/build/download-native-libs.sh +++ b/build/download-native-libs.sh @@ -63,6 +63,7 @@ download_native() { } download_native "pact_ffi" "windows" "x86_64" "dll" +download_native "pact_ffi" "windows" "aarch64" "dll" download_native "libpact_ffi" "linux" "x86_64" "so" download_native "libpact_ffi" "linux" "aarch64" "so" download_native "libpact_ffi" "macos" "x86_64" "dylib" diff --git a/src/PactNet/PactNet.csproj b/src/PactNet/PactNet.csproj index 3cb10197c..5e748041c 100644 --- a/src/PactNet/PactNet.csproj +++ b/src/PactNet/PactNet.csproj @@ -26,7 +26,14 @@ pact_ffi.dll runtimes/win-x64/native true - PreserveNewest + PreserveNewest + false + + + pact_ffi.dll + runtimes/win-arm64/native + true + PreserveNewest false From e6e98f37c354aa0b0aeef1da39fa97ae1eb3a12b Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 13 Nov 2026 17:37:05 +0000 Subject: [PATCH 2/4] feat(ffi): upgrade to libpact_ffi 0.5.13 Updates the underlying Rust core from libpact_ffi 0.4.27 to 0.5.13, which moves the mock server to pact_mock_server v2 and brings a suite of improvements and bug fixes, including repeated custom headers continuing to match (pact-foundation/pact-reference#602). - Download pact_ffi from the cargo-dist `pact_ffi-v` release: per-target .tar.xz/.zip archives, sha256 verified, with the shared library extracted to the same build/// paths. - Refresh pact metadata to ffi 0.5.13 / models 1.3.18. --- CONTRIBUTING.md | 10 +-- build/download-native-libs.sh | 71 +++++++++++-------- .../pacts/Fulfilment API-Orders API.json | 4 +- .../data/v2-consumer-integration.json | 4 +- .../data/v3-consumer-integration.json | 4 +- .../data/v3-message-consumer-integration.json | 4 +- .../data/v3-message-integration.json | 4 +- .../data/v3-server-integration.json | 4 +- .../data/v4-combined-integration.json | 4 +- .../data/v4-consumer-integration.json | 4 +- .../data/v4-message-consumer-integration.json | 4 +- 11 files changed, 67 insertions(+), 50 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a8aa3f7a8..689458a2e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,14 +53,16 @@ Building PactNet ---------------- In order to build PactNet you must first download the native Rust FFI libraries. You can pull the current supported -version by executing the script in Bash (or Git Bash on Windows): +version by executing the script in Bash (or Git Bash on Windows). The script needs `curl`, `tar` with xz support, and +`unzip` (or `7z`) on the path, and verifies each archive against its `.sha256` file: ```bash build/download-native-libs.sh ``` -Alternatively you can download a particular FFI version from the [pact-reference] releases or build your own version -locally, and then copy the artifacts into the folders: +Alternatively you can download a particular FFI version from the [pact-reference] `pact_ffi-v` releases (one +archive per Rust target, e.g. `pact_ffi-aarch64-apple-darwin.tar.xz`) or build your own version locally, and then copy +the shared libraries into the folders: ``` build/ @@ -69,7 +71,7 @@ build/ libpact_ffi.so aarch64/ libpact_ffi.so - osx/ + macos/ aarch64/ libpact_ffi.dylib x86_64/ diff --git a/build/download-native-libs.sh b/build/download-native-libs.sh index c3ace8918..46d492cd5 100755 --- a/build/download-native-libs.sh +++ b/build/download-native-libs.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -euo pipefail -FFI_VERSION="0.4.27" -FFI_BASE_URL="https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v$FFI_VERSION" +FFI_VERSION="0.5.13" +FFI_BASE_URL="https://github.com/pact-foundation/pact-reference/releases/download/pact_ffi-v$FFI_VERSION" GREEN="\e[32m" YELLOW="\e[33m" @@ -12,60 +12,75 @@ CLEAR="\e[0m" base_path=$(dirname "$0") download_native() { - file="$1" - os="$2" - platform="$3" - extension="$4" + os="$1" + platform="$2" + target="$3" + archive_ext="$4" + lib="$5" # e.g. - # pact_ffi-windows-x86_64.dll.gz - # libpact_ffi-linux-x86_64.so.gz - # libpact_ffi-macos-x86_64.dylib.gz - src_file="$file-$os-$platform.$extension" - src_archive="$src_file.gz" + # pact_ffi-x86_64-pc-windows-msvc.zip (pact_ffi.dll at the archive root) + # pact_ffi-x86_64-unknown-linux-gnu.tar.xz (pact_ffi-/libpact_ffi.so) + # pact_ffi-aarch64-apple-darwin.tar.xz (pact_ffi-/libpact_ffi.dylib) + src_archive="pact_ffi-$target.$archive_ext" src_sha="$src_archive.sha256" - dest_file="$file.$extension" url="$FFI_BASE_URL/$src_archive" sha="$url.sha256" path="$base_path/$os/$platform" mkdir -p "$path" - pushd $path > /dev/null + pushd "$path" > /dev/null echo -e "Downloading FFI library for ${YELLOW}$os/$platform${CLEAR}" - echo -e " Destination: ${BLUE}$path/$src_archive${CLEAR}" + echo -e " Destination: ${BLUE}$path/$lib${CLEAR}" echo -e " URL: ${BLUE}$url${CLEAR}" echo -n " Downloading... " - curl --silent -L "$url" -o "$src_archive" - curl --silent -L "$sha" -o "$src_archive.sha256" + curl --silent --show-error --fail -L "$url" -o "$src_archive" + curl --silent --show-error --fail -L "$sha" -o "$src_sha" echo -e "${GREEN}OK${CLEAR}" echo -n " Verifying... " if [[ "$OSTYPE" == "darwin"* ]]; then - shasum -a 256 --check --quiet "$src_sha" + sed '/^$/d' "$src_sha" | shasum -a 256 --check --quiet - else - sha256sum --check --quiet "$src_sha" + sed '/^$/d' "$src_sha" | sha256sum --check --quiet - fi echo -e "${GREEN}OK${CLEAR}" echo -n " Extracting... " - gunzip -f "$src_archive" + extract_dir=$(mktemp -d) + if [[ "$archive_ext" == "zip" ]]; then + extract_zip "$src_archive" "$extract_dir" + extracted="$extract_dir/$lib" + else + tar -xJf "$src_archive" -C "$extract_dir" + extracted="$extract_dir/pact_ffi-$target/$lib" + fi + mv -f "$extracted" "$lib" + rm -rf "$extract_dir" "$src_archive" "$src_sha" echo -e "${GREEN}OK${CLEAR}" echo "" - mv "$src_file" "$dest_file" - rm "$src_sha" - popd > /dev/null } -download_native "pact_ffi" "windows" "x86_64" "dll" -download_native "libpact_ffi" "linux" "x86_64" "so" -download_native "libpact_ffi" "linux" "aarch64" "so" -download_native "libpact_ffi" "macos" "x86_64" "dylib" -download_native "libpact_ffi" "macos" "aarch64" "dylib" +extract_zip() { + if command -v unzip > /dev/null; then + unzip -q -o "$1" -d "$2" + elif command -v 7z > /dev/null; then + 7z x -y -o"$2" "$1" > /dev/null + else + tar -xf "$1" -C "$2" + fi +} + +download_native "windows" "x86_64" "x86_64-pc-windows-msvc" "zip" "pact_ffi.dll" +download_native "linux" "x86_64" "x86_64-unknown-linux-gnu" "tar.xz" "libpact_ffi.so" +download_native "linux" "aarch64" "aarch64-unknown-linux-gnu" "tar.xz" "libpact_ffi.so" +download_native "macos" "x86_64" "x86_64-apple-darwin" "tar.xz" "libpact_ffi.dylib" +download_native "macos" "aarch64" "aarch64-apple-darwin" "tar.xz" "libpact_ffi.dylib" -echo "Successfully downloaded FFI libraries" \ No newline at end of file +echo "Successfully downloaded FFI libraries" diff --git a/samples/OrdersApi/Consumer.Tests/pacts/Fulfilment API-Orders API.json b/samples/OrdersApi/Consumer.Tests/pacts/Fulfilment API-Orders API.json index b6f1a702c..70cb05f7e 100644 --- a/samples/OrdersApi/Consumer.Tests/pacts/Fulfilment API-Orders API.json +++ b/samples/OrdersApi/Consumer.Tests/pacts/Fulfilment API-Orders API.json @@ -158,8 +158,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "4.0" diff --git a/tests/PactNet.Tests/data/v2-consumer-integration.json b/tests/PactNet.Tests/data/v2-consumer-integration.json index 9484eef44..83b46b987 100644 --- a/tests/PactNet.Tests/data/v2-consumer-integration.json +++ b/tests/PactNet.Tests/data/v2-consumer-integration.json @@ -74,8 +74,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "2.0.0" diff --git a/tests/PactNet.Tests/data/v3-consumer-integration.json b/tests/PactNet.Tests/data/v3-consumer-integration.json index b220eb497..7244aa1ba 100644 --- a/tests/PactNet.Tests/data/v3-consumer-integration.json +++ b/tests/PactNet.Tests/data/v3-consumer-integration.json @@ -130,8 +130,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "3.0.0" diff --git a/tests/PactNet.Tests/data/v3-message-consumer-integration.json b/tests/PactNet.Tests/data/v3-message-consumer-integration.json index 494ea2258..5e44b239f 100644 --- a/tests/PactNet.Tests/data/v3-message-consumer-integration.json +++ b/tests/PactNet.Tests/data/v3-message-consumer-integration.json @@ -36,8 +36,8 @@ "language": "C#" }, "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "3.0.0" diff --git a/tests/PactNet.Tests/data/v3-message-integration.json b/tests/PactNet.Tests/data/v3-message-integration.json index 4a3ace22b..07786942d 100644 --- a/tests/PactNet.Tests/data/v3-message-integration.json +++ b/tests/PactNet.Tests/data/v3-message-integration.json @@ -16,8 +16,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "3.0.0" diff --git a/tests/PactNet.Tests/data/v3-server-integration.json b/tests/PactNet.Tests/data/v3-server-integration.json index c5050bd5b..10db5b914 100644 --- a/tests/PactNet.Tests/data/v3-server-integration.json +++ b/tests/PactNet.Tests/data/v3-server-integration.json @@ -46,8 +46,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "3.0.0" diff --git a/tests/PactNet.Tests/data/v4-combined-integration.json b/tests/PactNet.Tests/data/v4-combined-integration.json index 618085116..4739dcf1a 100644 --- a/tests/PactNet.Tests/data/v4-combined-integration.json +++ b/tests/PactNet.Tests/data/v4-combined-integration.json @@ -185,8 +185,8 @@ "language": "C#" }, "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "4.0" diff --git a/tests/PactNet.Tests/data/v4-consumer-integration.json b/tests/PactNet.Tests/data/v4-consumer-integration.json index 87ef562b3..409bc40c9 100644 --- a/tests/PactNet.Tests/data/v4-consumer-integration.json +++ b/tests/PactNet.Tests/data/v4-consumer-integration.json @@ -150,8 +150,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "4.0" diff --git a/tests/PactNet.Tests/data/v4-message-consumer-integration.json b/tests/PactNet.Tests/data/v4-message-consumer-integration.json index 8861180b5..ddd378f10 100644 --- a/tests/PactNet.Tests/data/v4-message-consumer-integration.json +++ b/tests/PactNet.Tests/data/v4-message-consumer-integration.json @@ -41,8 +41,8 @@ "language": "C#" }, "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "4.0" From 7b66e62697fd0e7fb9859e524038c21ca1a2c47f Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 13 Nov 2026 17:47:58 +0000 Subject: [PATCH 3/4] fix(ci): disable hot reload browser tools in Provider.Tests for .NET SDK 11 The ubuntu-24.04-arm runner image now ships .NET SDK 11.0.100, which is picked over the setup-dotnet 8.0.x install. SDK 11 generates hot reload browser-tools static web assets for Web SDK projects in Debug, and the build then fails with "scoped css bundles do not have matching endpoints". --- samples/OrdersApi/Provider.Tests/Provider.Tests.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj b/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj index 1517e0f40..dbae7d988 100644 --- a/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj +++ b/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj @@ -2,6 +2,9 @@ net8.0 false + + false From f8dc451b4dd302f41ff92be8e936c2436f51062e Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 13 Nov 2026 17:47:58 +0000 Subject: [PATCH 4/4] fix(ci): disable hot reload browser tools in Provider.Tests for .NET SDK 11 The ubuntu-24.04-arm runner image now ships .NET SDK 11.0.100, which is picked over the setup-dotnet 8.0.x install. SDK 11 generates hot reload browser-tools static web assets for Web SDK projects in Debug, and the build then fails with "scoped css bundles do not have matching endpoints". --- samples/OrdersApi/Provider.Tests/Provider.Tests.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj b/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj index 1517e0f40..dbae7d988 100644 --- a/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj +++ b/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj @@ -2,6 +2,9 @@ net8.0 false + + false