headcrab icon indicating copy to clipboard operation
headcrab copied to clipboard

Setup CI infrastructure to run non-x86 builds

Open nbaksalyar opened this issue 4 years ago • 8 comments

We can run non-x86 builds with qemu (like e.g. rust-lang/libc does) in order to ensure that Headcrab can still be built without errors on non-x86 platforms (even if it's not entirely functional).

This will help us to prepare for introducing more target_archs in the future.

nbaksalyar avatar Nov 25 '20 23:11 nbaksalyar

https://github.com/rust-embedded/cross is easy to use. It runs tests using qemu.

philipc avatar Nov 26 '20 00:11 philipc

Great suggestion, thank you!

nbaksalyar avatar Nov 26 '20 00:11 nbaksalyar

@nbaksalyar parhaps all you need to do is copy and paste https://gist.github.com/pro465/a33a080d82d2ea28725a5956abb57871

it should be noted that i basically copied and pasted https://github.com/actions-rs/example/blob/master/.github/workflows/cross_compile.yml with some changes to make it cross-test instead of cross-compile without knowing if it will work, and the last time the example was updated was two years ago, so I'm not sure if that will work.

pro465 avatar Apr 05 '22 09:04 pro465

QEMU user mode doesn't support ptrace so using cross won't help unfortunately. A VM will likely be needed.

bjorn3 avatar Apr 05 '22 09:04 bjorn3

oh that's unfortunate :(

pro465 avatar Apr 05 '22 09:04 pro465

@bjorn3 but wait, does libc not contain ptrace too? then how do they run/test it in QEMU?

pro465 avatar Apr 05 '22 13:04 pro465

The libc crate doesn't contain any tests at all AFAIK. They only check that it matches the C header files I believe.

bjorn3 avatar Apr 05 '22 13:04 bjorn3

Yes, it's a matter of actually executing cross-arch code, whether it's cross-compilated or built natively.

It seems that the simplest option to execute tests would be to run CI on a dedicated server (e.g. there are arm-based nodes) - but we don't support any ISAs apart from x86_64 yet, so I would consider this more of a long-term goal.

nbaksalyar avatar Apr 05 '22 14:04 nbaksalyar