diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 00000000..be86a893 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,25 @@ +BUILD_TEST_TASK_TEMPLATE: &BUILD_TEST_TASK_TEMPLATE + arch_check_script: | + uname -m + ffi_download_script: | + chmod +x build/download-native-libs.sh + build/download-native-libs.sh + restore_script: | + dotnet restore + build_script: | + dotnet build --no-restore + test_script: | + dotnet test --no-build --verbosity normal + pack_script: | + dotnet pack --verbosity normal -c Release --no-restore --include-source --version-suffix alpha.123 -o ./dist + +linux_arm64_task: + arm_container: + image: mcr.microsoft.com/dotnet/sdk:8.0 + << : *BUILD_TEST_TASK_TEMPLATE + +linux_arm64_alpine_task: + arm_container: + image: mcr.microsoft.com/dotnet/sdk:8.0-alpine + setup_alpine_script: apk add curl bash gzip + << : *BUILD_TEST_TASK_TEMPLATE \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42c6291e..2c6b50b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,8 +10,9 @@ env: jobs: build-dotnet: - name: "Build and Test (dotnet)" + name: ${{ matrix.arch }}-${{ matrix.os }}-build-dotnet strategy: + fail-fast: false matrix: os: - windows-latest @@ -43,8 +44,8 @@ jobs: build/windows - name: Pull interop dependencies - run: bash -c "build/download-native-libs.sh" if: ${{ steps.cache.outputs.cache-hit != 'true' }} + run: bash -c "build/download-native-libs.sh" - name: Restore run: dotnet restore @@ -66,8 +67,56 @@ jobs: name: nupkgs path: ./dist/*.* + build-dotnet-containers: + runs-on: ubuntu-latest + name: ${{ matrix.arch }}-${{ matrix.distro }}-build-dotnet-container + strategy: + fail-fast: false + matrix: + arch: + - amd64 + # - arm64 + distro: + - "mcr.microsoft.com/dotnet/sdk:8.0" + - "mcr.microsoft.com/dotnet/sdk:8.0-alpine" + + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + if: matrix.arch != 'amd64' + uses: docker/setup-qemu-action@v1 + with: + platforms: ${{ matrix.arch }} + + - name: Docker dependencies + id: docker_commands + shell: bash + run: | + if [[ ${{ matrix.distro }} == *"alpine"* ]]; then + echo "deps=apk add --no-cache curl bash gzip && " >> "$GITHUB_OUTPUT" + else + echo "deps=" >> "$GITHUB_OUTPUT" + fi + + - name: Restore, Build & Test + run: | + docker run \ + --rm \ + -v $(pwd):/${{ github.workspace }} \ + -w ${{ github.workspace }} \ + --platform linux/${{ matrix.arch }} \ + --entrypoint /bin/sh \ + ${{ matrix.distro }} \ + -c '${{ steps.docker_commands.outputs.deps }} \ + build/download-native-libs.sh && \ + dotnet restore && dotnet build --no-restore && \ + dotnet test --no-build --verbosity normal' + release: - needs: build-dotnet + needs: [ + build-dotnet, + build-dotnet-containers + ] if: github.ref_type == 'tag' runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index e257eb31..6da56993 100644 --- a/README.md +++ b/README.md @@ -235,14 +235,34 @@ Due to using a shared native library instead of C# for the main Pact logic only | OS | Arch | Support | | ------------ | ----------- | -------------------------------------------------------------------| | Windows | x86 | ❌ No | -| Windows | x64 | ✔️ Yes | -| Linux (libc) | ARM | ❌ No | +| Windows | x64 | ✔️ Yes | | Linux (libc) | x86 | ❌ No | -| Linux (libc) | x64 | ✔️ Yes | -| Linux (musl) | Any | ❌ [No](https://github.com/pact-foundation/pact-net/issues/374) | -| OSX | x64 | ✔️ Yes | -| OSX | ARM (M1/M2) | ✔️ Yes | - +| Linux (libc) | x64 | ✔️ Yes | +| Linux (musl) | x64 | ✔️ Yes (Tier 2)* | +| Linux (libc) | ARM | ✔️ Yes (Tier 3)* | +| Linux (musl) | ARM | ✔️ Yes (Tier 3)* | +| OSX | x64 | ✔️ Yes | +| OSX | ARM (M1/M2) | ✔️ Yes | + +#### Support + +- Tier 1 + - Established + - Full CI/CD support. + - Users should not encounter issues + - Full reproducible examples running in CI, should be provided by users raising issues + - If using musl targets, users should attempt the same test on a libc target (such as debian) +- Tier 2 + - Recently introduced + - Full CI/CD support. + - Users may encounter issues + - Full reproducible examples running in CI, should be provided by users raising issues + - If using musl targets, users should attempt the same test on a libc target (such as debian) +- Tier 3 + - Recently introduced, No/limited CI/CD support. + - Users may encounter issues + - Full reproducible examples which can be run by maintainers locally, should be provided by users raising issues + ### Pact Specification | Version | Status | [Spec] Compatibility | Install | diff --git a/build/download-native-libs.sh b/build/download-native-libs.sh index f09c28c6..58b3b991 100755 --- a/build/download-native-libs.sh +++ b/build/download-native-libs.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -FFI_VERSION="0.4.16" +FFI_VERSION="0.4.17" FFI_BASE_URL="https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v$FFI_VERSION" GREEN="\e[32m" @@ -42,11 +42,27 @@ download_native() { if [[ "$OSTYPE" == "darwin"* ]]; then # OSX requires an empty arg passed to -i, but this doesn't work on Lin/Win - sed -Ei '' "s|../release_artifacts/.+$|$path/$dest_file|" "$path/$dest_file.sha256" + sed -Ei '' "s|\*(.*)$|\*$path/$dest_file|" "$path/$dest_file.sha256" shasum -a 256 --check --quiet "$path/$dest_file.sha256" else - sed -Ei "s|../release_artifacts/.+$|$path/$dest_file|" "$path/$dest_file.sha256" - sha256sum --check --quiet "$path/$dest_file.sha256" + sed -Ei "s|\*(.*)$|\*$path/$dest_file|" "$path/$dest_file.sha256" + if [[ "$OSTYPE" == "linux"* ]]; then + if ldd /bin/ls >/dev/null 2>&1; then + ldd_output=$(ldd /bin/ls) + case "$ldd_output" in + *musl*) + sha256sum -c -s "$path/$dest_file.sha256" + ;; + *) + sha256sum --check --quiet "$path/$dest_file.sha256" + ;; + esac + else + sha256sum --check --quiet "$path/$dest_file.sha256" + fi + else + sha256sum --check --quiet "$path/$dest_file.sha256" + fi fi rm "$path/$dest_file.sha256" @@ -60,5 +76,8 @@ download_native() { 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" "linux" "x86_64-musl" "so" +download_native "libpact_ffi" "linux" "aarch64-musl" "so" download_native "libpact_ffi" "osx" "x86_64" "dylib" download_native "libpact_ffi" "osx" "aarch64-apple-darwin" "dylib" 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 50b68e5d..6f9f4dd6 100644 --- a/samples/OrdersApi/Consumer.Tests/pacts/Fulfilment API-Orders API.json +++ b/samples/OrdersApi/Consumer.Tests/pacts/Fulfilment API-Orders API.json @@ -158,7 +158,7 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.16", + "ffi": "0.4.17", "models": "1.1.19" }, "pactSpecification": { diff --git a/src/PactNet/PactNet.csproj b/src/PactNet/PactNet.csproj index 9085de5d..454b78df 100644 --- a/src/PactNet/PactNet.csproj +++ b/src/PactNet/PactNet.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -9,49 +9,91 @@ + + + + + + + + + + + + False + True + True + True + + + + + + + False + False + True + True + False + True + True + True + True + True + - - False - False - False - False - True - True - True - True - - - - - pact_ffi.dll - runtimes/win-x64/native - true - PreserveNewest - false - - - libpact_ffi.so - runtimes/linux-x64/native - true - PreserveNewest - false - - - libpact_ffi.dylib - runtimes/osx-x64/native - true - PreserveNewest - false - - - libpact_ffi.dylib - runtimes/osx-arm64/native - true - PreserveNewest - false - - - + + + pact_ffi.dll + runtimes/win-x64/native + true + PreserveNewest + false + + + libpact_ffi.so + runtimes/linux-x64/native + true + PreserveNewest + false + + + libpact_ffi.so + runtimes/linux-arm64/native + true + PreserveNewest + false + + + libpact_ffi.so + runtimes/linux-x64-musl/native + true + PreserveNewest + false + + + libpact_ffi.so + runtimes/linux-arm64-musl/native + true + PreserveNewest + false + + + libpact_ffi.dylib + runtimes/osx-x64/native + true + PreserveNewest + false + + + libpact_ffi.dylib + runtimes/osx-arm64/native + true + PreserveNewest + false + + + build/net462/ diff --git a/tests/PactNet.Tests/data/v2-consumer-integration.json b/tests/PactNet.Tests/data/v2-consumer-integration.json index 9f76184a..5e9fef1e 100644 --- a/tests/PactNet.Tests/data/v2-consumer-integration.json +++ b/tests/PactNet.Tests/data/v2-consumer-integration.json @@ -74,7 +74,7 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.16", + "ffi": "0.4.17", "models": "1.1.19" }, "pactSpecification": { diff --git a/tests/PactNet.Tests/data/v3-consumer-integration.json b/tests/PactNet.Tests/data/v3-consumer-integration.json index fa2df241..d45fd9ac 100644 --- a/tests/PactNet.Tests/data/v3-consumer-integration.json +++ b/tests/PactNet.Tests/data/v3-consumer-integration.json @@ -132,7 +132,7 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.16", + "ffi": "0.4.17", "models": "1.1.19" }, "pactSpecification": { diff --git a/tests/PactNet.Tests/data/v3-message-consumer-integration.json b/tests/PactNet.Tests/data/v3-message-consumer-integration.json index 0c02ff57..50834bda 100644 --- a/tests/PactNet.Tests/data/v3-message-consumer-integration.json +++ b/tests/PactNet.Tests/data/v3-message-consumer-integration.json @@ -36,7 +36,7 @@ "language": "C#" }, "pactRust": { - "ffi": "0.4.16", + "ffi": "0.4.17", "models": "1.1.19" }, "pactSpecification": { diff --git a/tests/PactNet.Tests/data/v3-message-integration.json b/tests/PactNet.Tests/data/v3-message-integration.json index 85ba4363..e5293499 100644 --- a/tests/PactNet.Tests/data/v3-message-integration.json +++ b/tests/PactNet.Tests/data/v3-message-integration.json @@ -16,7 +16,7 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.16", + "ffi": "0.4.17", "models": "1.1.19" }, "pactSpecification": { diff --git a/tests/PactNet.Tests/data/v3-server-integration.json b/tests/PactNet.Tests/data/v3-server-integration.json index c9b869c0..98c45635 100644 --- a/tests/PactNet.Tests/data/v3-server-integration.json +++ b/tests/PactNet.Tests/data/v3-server-integration.json @@ -46,7 +46,7 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.16", + "ffi": "0.4.17", "models": "1.1.19" }, "pactSpecification": { diff --git a/tests/PactNet.Tests/data/v4-combined-integration.json b/tests/PactNet.Tests/data/v4-combined-integration.json index d42e3ff5..60952d55 100644 --- a/tests/PactNet.Tests/data/v4-combined-integration.json +++ b/tests/PactNet.Tests/data/v4-combined-integration.json @@ -187,7 +187,7 @@ "language": "C#" }, "pactRust": { - "ffi": "0.4.16", + "ffi": "0.4.17", "models": "1.1.19" }, "pactSpecification": { diff --git a/tests/PactNet.Tests/data/v4-consumer-integration.json b/tests/PactNet.Tests/data/v4-consumer-integration.json index 11d15825..870b3659 100644 --- a/tests/PactNet.Tests/data/v4-consumer-integration.json +++ b/tests/PactNet.Tests/data/v4-consumer-integration.json @@ -152,7 +152,7 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.16", + "ffi": "0.4.17", "models": "1.1.19" }, "pactSpecification": { diff --git a/tests/PactNet.Tests/data/v4-message-consumer-integration.json b/tests/PactNet.Tests/data/v4-message-consumer-integration.json index f5124e0e..687d72a6 100644 --- a/tests/PactNet.Tests/data/v4-message-consumer-integration.json +++ b/tests/PactNet.Tests/data/v4-message-consumer-integration.json @@ -41,7 +41,7 @@ "language": "C#" }, "pactRust": { - "ffi": "0.4.16", + "ffi": "0.4.17", "models": "1.1.19" }, "pactSpecification": {