diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e18b5204..aa688ca5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,8 +66,52 @@ 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-alpine3.20" + - "mcr.microsoft.com/dotnet/sdk:8.0-alpine3.19" + + 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 }} \ + --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 ee15ef05..ffeba204 100644 --- a/README.md +++ b/README.md @@ -239,7 +239,7 @@ Due to using a shared native library instead of C# for the main Pact logic only | Linux (libc) | ARM | ❌ No | | Linux (libc) | x86 | ❌ No | | Linux (libc) | x64 | ✔️ Yes | -| Linux (musl) | Any | ❌ [No](https://github.com/pact-foundation/pact-net/issues/374) | +| Linux (musl) | Any | ✔️ Yes | | OSX | x64 | ✔️ Yes | | OSX | ARM (M1/M2) | ✔️ Yes | diff --git a/build/download-native-libs.sh b/build/download-native-libs.sh index d39a379d..95a6dc3b 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}" @@ -66,5 +82,7 @@ download_native "pact_ffi" "windows" "x86_64" "dll" download_native "libpact_ffi" "linux" "x86_64" "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 e62463af..fde9e1cf 100644 --- a/src/PactNet/PactNet.csproj +++ b/src/PactNet/PactNet.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -9,49 +9,84 @@ + + + + + + + + + + + + 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-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/