tlsuv icon indicating copy to clipboard operation
tlsuv copied to clipboard

Cross-compilation CI for multi-platform testing of tlsuv

Open plajjan opened this issue 4 months ago • 0 comments

I think it would be nice with a CI workflow for this repo that would cross-compile for different platforms to ensure compatibility. I've recently opened #202 and #203 to fix issues around macos & ios support. I think that could have been avoided with more extensive testing.

I spent some time contributing to the Boehm GC repo (https://github.com/ivmai/bdwgc) of which cross-compilation was one part. We ported the CMake config to the Zig build system and then used zig's excellent cross-compilation support to run cross-compilation test jobs for multiple platform. Quite cool IMHO. We're also using zig as part of the Acton programming language (where tlsuv is also used). As part of that, I wrote a basic build.zig (https://github.com/actonlang/tlsuv/blob/zig-build-rebase20240211/build.zig), it is not fully fledged but builds the basic parts that are used in Acton. It can be used to do this kind of cross-compilation. I'm saying not fully fledged because I was really only interested in the TLS bits of tlsuv and not in a HTTP client with the dependency of llhttp and in turn node.js that I think it depends on, so the build.zig takes certain shortcuts.

If you agree this is a good idea, the plan forward could be something like

  • put basic build.zig in place
  • add github actions job to do cross-compile using build.zig for a number of platforms
  • expand build.zig to reach feature parity with CMake
    • or potentially reduce tlsuv as suggested in #169

plajjan avatar Feb 11 '24 21:02 plajjan