Skip to content

Build native libs for linux-musl-arm and linux-musl-arm64 #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

arturcic
Copy link
Contributor

Made the docker files use base images from multiarch/crossbuild and multiarch/alpine to make it easier to maintain.

Added support for linux-musl-arm and linux-musl-arm64.

Publishing the resulted nuget package only when it's manually run the workflow to GitHub Packages. (This allows to have the nuget package available to be consumed in other repository - libgit2sharp for example). I have a fork of libgit2sharp that does test the native libs with libgit2sharp on multiple linux distros and arm64/amd64 (check this out https://github.com/arturcic/libgit2sharp/actions/runs/1366916943). If this one gets merged I will also submit a PR to the libgit2sharp repo to include that worflow as well

@arturcic
Copy link
Contributor Author

@bording is there anything I can do to have a progress on this PR?

@bording
Copy link
Member

bording commented Oct 25, 2021

I took an initial look at this weekend (and let the CI run) but didn't have time to dig into the changes in-depth yet. It's on my todo list.

@@ -0,0 +1,3 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to keep the PR focused on just the required changes for the new libs, so let's get rid of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think I should create a separate PR for this one? I did the entire PR with the codespaces and this was the configuration

@@ -86,3 +93,7 @@ jobs:
with:
name: NuGet package
path: ./*.nupkg
- name: Publish nuget to GitHub Packages
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this. I don't immediately see a need for it, and it's not required to get the new libs building.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed a way to test the native libs without having to build locally on the dev machine, and it is used in the https://github.com/arturcic/libgit2sharp/actions/runs/1375914780 and it's a common practice I've seen on other dotnet repos to publish the nuget package previews on a nuget feed (previously myget, nowadays GH packages), but I can remove that if you don't think it's needed

@@ -1,7 +1,8 @@
FROM alpine:3.7
FROM multiarch/crossbuild
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really familiar with this. Can you explain a bit about how it works?

What distro is it based on? How do I know what version of libraries and tooling it comes with?

What if we need to add something that's not part of the base image? Does it have a package manager? For example, looking at the build output compared to older CI runs, it appears that pkg-config is not installed, and that's something that we had installed previously since libgit2 can use it to configure the build process.

The larger overall concern here is that in the past it's been a balancing act choosing which distro to use to build the linux-x64 lib because it needs to have versions of all the libraries/tooling old enough that it will be compatible with all the various linux distros that .NET Core supports.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the Dockerfile for multiarch/crossbuild.
As you can see its base image is buildpack-deps:stretch-curl. Is that old enough you can tell me.

The native artifacts I tested with these docker images https://github.com/arturcic/libgit2sharp/actions/runs/1375914780 - both amd64 and arm64. The exact same images I use to test GitVersion. As you can see it's tested with .netcoreapp 3.1 up to net 6.0 with some exceptions - https://github.com/arturcic/libgit2sharp/blob/5dc30c137586583dea54716f866966c3089b3ddd/.github/workflows/native-test.yml#L18

From the tests were excluded the arm64 tests for alpine 3.12, and for alpine 3.13-3.14 for netcoreapp3.1, as .net is not supported on this ones.

As far as I know (tell me if I'm wrong) .net core 3.1 is the latest supported version of .net core at the moment. .net core 2.1 ended support this august.
So took this in consideration when testing the native libs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we need to add something that's not part of the base image?

Sure we can install any needed lib on top of that multiarch/crossbuild image

@bording
Copy link
Member

bording commented Oct 30, 2021

In addition to the comments above, I noticed that you open this PR against the master branch of your fork. Would it be possible to instead create a branch and open a new PR using that instead?

@arturcic
Copy link
Contributor Author

arturcic commented Nov 1, 2021

In addition to the comments above, I noticed that you open this PR against the master branch of your fork. Would it be possible to instead create a branch and open a new PR using that instead?

I close this PR in favor of #133

@arturcic arturcic closed this Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants