Skip to content
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

Multi-architecture Linux & macOS builds #44

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bradgessler
Copy link

@bradgessler bradgessler commented Jan 16, 2025

Context

I'm working on a CI build matrix for a project. For it I need:

  • macos-x86_64
  • macos-arm64
  • ubuntu-x86_64
  • ubuntu-arm64

Since qemu builds on macOS arm hardware doesn't quite work, I'm running all intel builds on a macOS intel host and all arm builds on a macOS arm host.

I'm pleased to say that I have that working with the changes in this PR.

Changes

For this PR, I've done a few things to the Ubuntu docker image:

Named layers so the test wouldn't leave files in the image.

The test runs, but it's not included in the production image.

Removed the ARCH variable so that it can detect the architecture and install the appropriate version of CMAKE.

This means I can build arm64 macOS and Ubuntu images on an M2 Mac.

It also means I can build x86_64 macOS and Ubuntu images on an Intel Mac.

This does not fix the QEMU jmalloc issue at tamatebako/tebako#229

Sets a TEBAKO_RUBY_VERSION variable in the contianer

This is needed because ARG can't persist across layers.

Consequences

This should drop-in to the current CI images; however the removal of the ARCH that was hard coded means it might need to be moved into the yaml files for the runner if an override is needed for any reason (it shouldn't).

Considerations

I think the tebako press CLI should run via ENV vars. I set TEBAKO_RUBY_VERSION=3.3.6, so this should be possible and it should run:

TEBAKO_RUBY_VERSION=3.3.6 TEBAKO_ENTRPOINT=foo TEBAKO_ROOT=/mnt/w TEBAKO_OUTPUT=/mnt/w tebako press

That means I could set the TEBAKO_RUBY_VERSION in the container and it would run the pre-installed version without the user specifying anything. This might also mean if tebako wants to maintain an image repository for prebuilt compilers, they'd have to start maintaining versions like ubuntu-ruby:3.3.6, etc.

…macOS hosts.

If the image is built with `docker build --build-arg macos_hsot_arch=arm64` and the image detects `x86_64`, it will know its emulated and set the correct LG_VADDR variable.

If the argument is not passed then its completely ignored, so it remains compatible with existing build pipelines.

Based on the problem at tamatebako/tebako#178
@bradgessler bradgessler marked this pull request as draft January 16, 2025 01:02
@bradgessler bradgessler changed the title macos qemu Multi-architecture Ubuntu builds Jan 16, 2025
@bradgessler bradgessler changed the title Multi-architecture Ubuntu builds Multi-architecture Linux & macOS builds Jan 16, 2025
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.

1 participant