diff --git a/.github/docker/rb-sys-protoc.Dockerfile b/.github/docker/rb-sys-protoc.Dockerfile index 45b9e494..a2a36c81 100644 --- a/.github/docker/rb-sys-protoc.Dockerfile +++ b/.github/docker/rb-sys-protoc.Dockerfile @@ -17,6 +17,24 @@ RUN case "$TARGETARCH" in \ FROM ${BASE_IMAGE} +ARG GCC_VERSION="" + +RUN if [ -n "$GCC_VERSION" ]; then \ + apt-get update && \ + apt-get install -y --no-install-recommends gcc-${GCC_VERSION} g++-${GCC_VERSION} && \ + rm -rf /var/lib/apt/lists/*; \ + fi + +RUN touch /etc/rubybashrc && \ + if [ -n "$GCC_VERSION" ]; then \ + echo "export CC=gcc-${GCC_VERSION}" >> /etc/rubybashrc; \ + echo "export CXX=g++-${GCC_VERSION}" >> /etc/rubybashrc; \ + echo "export AR=gcc-ar-${GCC_VERSION}" >> /etc/rubybashrc; \ + echo "export CC_x86_64_unknown_linux_gnu=gcc-${GCC_VERSION}" >> /etc/rubybashrc; \ + echo "export CXX_x86_64_unknown_linux_gnu=g++-${GCC_VERSION}" >> /etc/rubybashrc; \ + echo "export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=gcc-${GCC_VERSION}" >> /etc/rubybashrc; \ + fi + COPY --from=protoc /opt/protoc/bin/protoc /usr/local/bin/protoc COPY --from=protoc /opt/protoc/include /usr/local/include diff --git a/.github/workflows/build-gems.yml b/.github/workflows/build-gems.yml index 46a049e2..1f8c533d 100644 --- a/.github/workflows/build-gems.yml +++ b/.github/workflows/build-gems.yml @@ -17,7 +17,15 @@ jobs: matrix: # TODO(cretz): Enable x64-mingw-ucrt if we can figure out Windows issue, see # https://github.com/temporalio/sdk-ruby/issues/172 - rubyPlatform: ["aarch64-linux", "aarch64-linux-musl", "x86_64-linux", "x86_64-linux-musl", "arm64-darwin", "x86_64-darwin"] + include: + - rubyPlatform: aarch64-linux + - rubyPlatform: aarch64-linux-musl + # aws-lc-rs refuses to use GCC version included in image due to compiler bug + - rubyPlatform: x86_64-linux + gccVersion: "10" + - rubyPlatform: x86_64-linux-musl + - rubyPlatform: arm64-darwin + - rubyPlatform: x86_64-darwin steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 @@ -51,6 +59,7 @@ jobs: docker build \ --platform linux/amd64 \ --build-arg BASE_IMAGE="rbsys/${{ matrix.rubyPlatform }}:${rb_sys_version}" \ + --build-arg GCC_VERSION="${{ matrix.gccVersion || '' }}" \ --build-arg PROTOC_VERSION="${PROTOC_VERSION}" \ -t "$custom_image" \ -f ../.github/docker/rb-sys-protoc.Dockerfile \