jedisct1 / libsodium

A modern, portable, easy to use crypto library.
https://libsodium.org
Other
12.22k stars 1.74k forks source link

Add linux-arm64 binary to the generated nuget package #1067

Closed enclave-alistair closed 3 years ago

enclave-alistair commented 3 years ago

Uses cross-compilation to run make; make check uses qemu to execute the tests on virtualised ARM64.

Note that I couldn't get the qemu-run make check to execute when running inside a docker container, so the arm64 job runs directly on the runner.

I've tested this process works on stable (see last run at https://github.com/enclave-alistair/libsodium/actions/runs/874111971).

Once the existing Autoconf build failure on master is resolved, I will test on master.

jedisct1 commented 3 years ago

Thank you!

enclave-alistair commented 3 years ago

@jedisct1, can I ask if you have an anticipated approx date for a 1.0.19 push of the NuGet package onto nuget.org that might include the new binary? The 1.0.18 version is from 2020, and I'd prefer to use a released package if possible.

Not sure what your release process looks like (and happy to help if needed).

ektrah commented 3 years ago

It's also possible to push a 1.0.18.1. I can help with that; @jedisct1 would just need to hit the button at the end.

jedisct1 commented 3 years ago

How do I push the button?

I must confess that I didn't follow what had to be done now that we don't use the Docker image any more.

I thought the NuGet things were automatically following the stable branch. But apparently not?

What should I do?

enclave-alistair commented 3 years ago

Without being too forward @jedisct1 / @ektrah, if you update the package version in https://github.com/jedisct1/libsodium/blob/stable/packaging/dotnet-core/libsodium.pkgproj#L12, GitHub Actions will build you a new .nupkg file with the right version and contents, available in the build artifacts.

The manual part should just involve uploading the released package to nuget.org (I couldn't see an automated step for that in your workflow).

ektrah commented 3 years ago

Yes, right. In addition to https://github.com/jedisct1/libsodium/blob/master/packaging/dotnet-core/libsodium.pkgproj#L12 the version needs to be updated in https://github.com/jedisct1/libsodium/blob/master/.github/workflows/dotnet-core.yml#L184 (and maybe some other place I forgot?) and the resulting .nupkg artifact built by GitHub Actions uploaded to nuget.org.

ektrah commented 3 years ago

@enclave-alistair Would it be possible to also include linux-arm32 with low effort?

And it would be really great if we could test the nupkg on both linux-arm64 and linux-arm32 as we do for linux-x64.

enclave-alistair commented 3 years ago

@ektrah, might be worth wildcarding out the version number in the dotnet-core.yml, just to save changing it in one place.

I can take a look at the linux-arm support (.net have used -arm for the 32-bit suffix), which would really be an armhf make target for libsodium itself, yes?

I'm not certain in my head on how we build and run the dotnet test project on ARM; with any luck the QEMU emulator might be able to run the dotnet SDK on an ARM architecture, but a bit unsure exactly.

enclave-alistair commented 3 years ago

OK, raised another PR with the armhf changes, pretty straightforward.

If it's OK, I'll take a look at executing the nupkg tests on those platforms separately, because I suspect there'll be some annoyances there.

ektrah commented 3 years ago

might be worth wildcarding out the version number in the dotnet-core.yml, just to save changing it in one place.

That would be nice to have. Last time I checked, GitHub Actions didn't support wildcards in that position.

I can take a look at the linux-arm support (.net have used -arm for the 32-bit suffix), which would really be an armhf make target for libsodium itself, yes?

Awesome, thanks! I guess .NET on linux-arm means a Raspberry Pi in practice? Is that armhf?

If it's OK, I'll take a look at executing the nupkg tests on those platforms separately, because I suspect there'll be some annoyances there.

Sure. I think it would be good to test the nupkg in some way before uploading it to nuget.org (e.g. just once manually). Unfortunately, the only ARM device I have is a Cortex-M0, so I'm afraid I'm not much help here.

enclave-alistair commented 3 years ago

Since there'll only be one .nupkg file in the Release folder, you can just specify .libsodium-pack/bin/Release/*.nupkg, and it'll work I believe.

Yeah, linux-arm is mostly just Raspberry Pi ARMv7 and some IoT devices.

I'll spin up an AWS Graviton instance tomorrow for the ARM64 test, that should be pretty straightforward. A bit trickier for the 32-bit, but I may have a spare raspberry pi available, I'll figure something out.