Skip to content

Commit

Permalink
feat: add musl targets and remove build patch
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Feb 22, 2024
1 parent 450355e commit afaf864
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
10 changes: 5 additions & 5 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ 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
patch_cs_proj_script: |
# cat src/PactNet/PactNet.csproj | grep musl
sed -Ei "s|aarch64\\\libpact_ffi.so|aarch64-musl\\\libpact_ffi.so|" src/PactNet/PactNet.csproj
cat src/PactNet/PactNet.csproj | grep musl
# patch_cs_proj_script: |
# # cat src/PactNet/PactNet.csproj | grep musl
# sed -Ei "s|aarch64\\\libpact_ffi.so|aarch64-musl\\\libpact_ffi.so|" src/PactNet/PactNet.csproj
# cat src/PactNet/PactNet.csproj | grep musl
<< : *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
patch_cs_proj_script: sed -Ei "s|x86_64\\\libpact_ffi.so|x86_64-musl\\\libpact_ffi.so|" src/PactNet/PactNet.csproj
# patch_cs_proj_script: sed -Ei "s|x86_64\\\libpact_ffi.so|x86_64-musl\\\libpact_ffi.so|" src/PactNet/PactNet.csproj
<< : *BUILD_TEST_TASK_TEMPLATE
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ jobs:
if: matrix.alpine != true
run: dotnet test --no-build --verbosity normal

- name: Patch PactNet.csproj
if: matrix.alpine == true
run: sed -Ei "s|${{ matrix.arch }}\\\libpact_ffi.so|${{ matrix.arch }}-musl\\\libpact_ffi.so|" src/PactNet/PactNet.csproj
# - name: Patch PactNet.csproj
# if: matrix.alpine == true
# run: sed -Ei "s|${{ matrix.arch }}\\\libpact_ffi.so|${{ matrix.arch }}-musl\\\libpact_ffi.so|" src/PactNet/PactNet.csproj

- name: test linux amd64 musl
if: matrix.alpine == true && matrix.arch == 'x86_64'
Expand Down
23 changes: 20 additions & 3 deletions src/PactNet/PactNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
<IsOSX>False</IsOSX>
<IsArm64>False</IsArm64>
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'True'">True</IsWindows>
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'True'">True</IsLinux>
<IsLinuxX64 Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'True' And $([System.IO.File]::Exists('/lib/libc.musl-x86_64.so.1')) == 'False' And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' != 'Arm64'">True</IsLinuxX64>
<IsLinuxArm64 Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'True' And $([System.IO.File]::Exists('/lib/libc.musl-aarch64.so.1')) == 'False' And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'Arm64'">True</IsLinuxArm64>
<IsLinuxMuslX64 Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'True' And $([System.IO.File]::Exists('/lib/libc.musl-x86_64.so.1')) == 'True' And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' != 'Arm64'">True</IsLinuxMuslX64>
<IsLinuxMuslArm64 Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'True' And $([System.IO.File]::Exists('/lib/libc.musl-aarch64.so.1')) == 'True' And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'Arm64'">True</IsLinuxMuslArm64>
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'True'">True</IsOSX>
<IsArm64 Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'Arm64'">True</IsArm64>
</PropertyGroup>
Expand All @@ -33,14 +36,28 @@
<Link>libpact_ffi.so</Link>
<PackagePath>runtimes/linux-arm64/native</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory Condition="'$(IsLinux)' And '$(IsArm64)' == 'True'">PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory Condition="'$(IsLinuxArm64)' == 'True'">PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</Content>
<Content Include="$(MSBuildProjectDirectory)\..\..\build\linux\x86_64\libpact_ffi.so">
<Link>libpact_ffi.so</Link>
<PackagePath>runtimes/linux-x64/native</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory Condition="'$(IsLinux)' And '$(IsArm64)' == 'False'">PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory Condition="'$(IsLinuxX64)' == 'True'">PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</Content>
<Content Include="$(MSBuildProjectDirectory)\..\..\build\linux\aarch64-musl\libpact_ffi.so">
<Link>libpact_ffi.so</Link>
<PackagePath>runtimes/linux-arm64-musl/native</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory Condition="'$(IsLinuxMuslArm64)' == 'True'">PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</Content>
<Content Include="$(MSBuildProjectDirectory)\..\..\build\linux\x86_64-musl\libpact_ffi.so">
<Link>libpact_ffi.so</Link>
<PackagePath>runtimes/linux-x64-musl/native</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory Condition="'$(IsLinuxMuslX64)' == 'True'">PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</Content>
<Content Include="$(MSBuildProjectDirectory)\..\..\build\osx\x86_64\libpact_ffi.dylib">
Expand Down

0 comments on commit afaf864

Please sign in to comment.