diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32770601..abcf48d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,8 +72,53 @@ jobs: name: nupkgs path: ./dist/*.* + build-dotnet-containers: + runs-on: ubuntu-latest + name: ${{ matrix.os }}-${{ matrix.distro }}-build-dotnet-container + strategy: + fail-fast: false + matrix: + os: + - ubuntu-24.04 + - ubuntu-24.04-arm + distro: + - "mcr.microsoft.com/dotnet/sdk:8.0" + - "mcr.microsoft.com/dotnet/sdk:8.0-alpine3.21" + - "mcr.microsoft.com/dotnet/sdk:8.0-alpine3.20" + - "mcr.microsoft.com/dotnet/sdk:8.0-alpine3.19" + - "mcr.microsoft.com/dotnet/sdk:8.0-alpine3.18" + + steps: + - uses: actions/checkout@v4 + + - 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 }} \ + --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 c70c541b..0bfa3a55 100644 --- a/README.md +++ b/README.md @@ -232,16 +232,16 @@ For writing messaging pacts instead of requests/response pacts, see the [messagi Due to using a shared native library instead of C# for the main Pact logic only certain OSs are supported: -| OS | Arch | Support | -| ------------ | ------------ | -------------------------------------------------------------------| -| Windows | x86 | ❌ No | -| Windows | x64 | ✔️ Yes | -| Linux (libc) | ARM64 | ✔️ Yes | -| Linux (libc) | x64 | ✔️ Yes | -| Linux (libc) | x86 | ❌ No | -| Linux (musl) | Any | ❌ [No](https://github.com/pact-foundation/pact-net/issues/374) | -| OSX | x64 | ✔️ Yes | -| OSX | ARM64 (M1/M2)| ✔️ Yes | +| OS | Arch | Support | +| ------------ | ----------- | -------------------------------------------------------------------| +| Windows | x86 | ❌ No | +| Windows | x64 | ✔️ Yes | +| Linux (libc) | ARM | ✔️ Yes | +| Linux (libc) | x86 | ❌ No | +| Linux (libc) | x64 | ✔️ Yes | +| Linux (musl) | Any | ✔️ Yes | +| OSX | x64 | ✔️ Yes | +| OSX | ARM (M1/M2) | ✔️ Yes | ### Pact Specification diff --git a/build/download-native-libs.sh b/build/download-native-libs.sh index 90a94d11..ad3d1be9 100755 --- a/build/download-native-libs.sh +++ b/build/download-native-libs.sh @@ -46,7 +46,23 @@ download_native() { if [[ "$OSTYPE" == "darwin"* ]]; then shasum -a 256 --check --quiet "$src_sha" else - sha256sum --check --quiet "$src_sha" + 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 "$src_sha" + ;; + *) + sha256sum --check --quiet "$src_sha" + ;; + esac + else + sha256sum --check --quiet "$src_sha" + fi + else + sha256sum --check --quiet "$src_sha" + fi fi echo -e "${GREEN}OK${CLEAR}" @@ -67,5 +83,7 @@ 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" +download_native "libpact_ffi" "linux" "x86_64-musl" "so" +download_native "libpact_ffi" "linux" "aarch64-musl" "so" echo "Successfully downloaded FFI libraries" \ No newline at end of file diff --git a/src/PactNet/PactNet.csproj b/src/PactNet/PactNet.csproj index 3cb10197..6bc16e2e 100644 --- a/src/PactNet/PactNet.csproj +++ b/src/PactNet/PactNet.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -9,56 +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.so - runtimes/linux-arm64/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/