diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 00000000..1d0b602a --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,36 @@ +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:7.0 + << : *BUILD_TEST_TASK_TEMPLATE + +linux_amd64_task: + container: + image: mcr.microsoft.com/dotnet/sdk:7.0 + << : *BUILD_TEST_TASK_TEMPLATE + +linux_arm64_alpine_task: + arm_container: + image: mcr.microsoft.com/dotnet/sdk:7.0-alpine + setup_alpine_script: apk add --no-cache curl bash gzip + << : *BUILD_TEST_TASK_TEMPLATE + +linux_amd64_alpine_task: + container: + image: mcr.microsoft.com/dotnet/sdk:7.0-alpine + setup_alpine_script: apk add --no-cache 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..b09ff335 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,7 @@ jobs: build-dotnet: name: "Build and Test (dotnet)" strategy: + fail-fast: false matrix: os: - windows-latest @@ -22,6 +23,14 @@ jobs: - arch: x64 - arch: ARM64 os: macos-14 + - os: ubuntu-latest + alpine: true + arch: x86_64 + # - os: ubuntu-latest + # alpine: true + # arch: aarch64 + ## Skipped as .NET does not work with QEMU https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md#qemu + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -42,19 +51,39 @@ jobs: build/osx build/windows + - name: Set up QEMU + if: matrix.alpine == true + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + if: matrix.alpine == true + uses: docker/setup-buildx-action@v3 - name: Pull interop dependencies + if: matrix.alpine != true && ${{ steps.cache.outputs.cache-hit != 'true' }} run: bash -c "build/download-native-libs.sh" - if: ${{ steps.cache.outputs.cache-hit != 'true' }} - name: Restore + if: matrix.alpine != true run: dotnet restore - name: Build + if: matrix.alpine != true run: dotnet build --no-restore - name: Test - run: dotnet test --no-build --verbosity normal -- RunConfiguration.TargetPlatform=${{matrix.arch}} + if: matrix.alpine != true + run: dotnet test --no-build --verbosity normal + - name: test linux amd64 musl + if: matrix.alpine == true && matrix.arch == 'x86_64' + run: | + docker run --platform=linux/amd64 --rm -v $PWD:/app mcr.microsoft.com/dotnet/sdk:8.0-alpine /bin/sh -c 'apk add --no-cache curl bash gzip && cd /app && build/download-native-libs.sh && dotnet restore && dotnet build --no-restore && dotnet test --no-build --verbosity normal' + + ## Skipped as .NET does not work with QEMU https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md#qemu + # - name: test linux arm64 musl + # if: matrix.alpine == true && matrix.arch == 'aarch64' + # run: | + # docker run --platform=linux/arm64 --rm -v $PWD:/app mcr.microsoft.com/dotnet/sdk:8.0-alpine /bin/sh -c 'apk add --no-cache curl bash gzip && cd /app && build/download-native-libs.sh && dotnet restore && dotnet build --no-restore && dotnet test --no-build --verbosity normal' + - name: Pack if: matrix.os == 'windows-latest' run: dotnet pack --verbosity normal -c Release --no-restore --include-source --version-suffix alpha.${{ github.run_number }} -o ./dist diff --git a/build/download-native-libs.sh b/build/download-native-libs.sh index f09c28c6..bf4d51a8 100755 --- a/build/download-native-libs.sh +++ b/build/download-native-libs.sh @@ -46,7 +46,23 @@ download_native() { 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" + 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/src/PactNet/PactNet.csproj b/src/PactNet/PactNet.csproj index 9085de5d..9a67c967 100644 --- a/src/PactNet/PactNet.csproj +++ b/src/PactNet/PactNet.csproj @@ -16,7 +16,10 @@ False False True - True + True + True + True + True True True @@ -33,7 +36,28 @@ libpact_ffi.so runtimes/linux-x64/native true - PreserveNewest + 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 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": {