From ddf5608c609cbfdd92d13cd75f4f7499ae355d28 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 23 Jan 2024 15:16:52 -0500 Subject: [PATCH 1/5] ci: run native gem tests on both alpine 3.18 and 3.19 to reproduce the issue from #434 --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 652700f6..a62c1ac4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -345,8 +345,11 @@ jobs: include: - { ruby: "3.0", flavor: "alpine" } - { ruby: "3.1", flavor: "alpine3.18" } + - { ruby: "3.1", flavor: "alpine3.19" } - { ruby: "3.2", flavor: "alpine3.18" } + - { ruby: "3.2", flavor: "alpine3.19" } - { ruby: "3.3", flavor: "alpine3.18" } + - { ruby: "3.3", flavor: "alpine3.19" } runs-on: ubuntu-latest container: image: ruby:${{matrix.ruby}}-${{matrix.flavor}} From 3012ba7b9304af35cf9eba9f81c07082b6ea8697 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 25 Jan 2024 16:33:48 -0500 Subject: [PATCH 2/5] ci: consistently separate compile and test steps --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a62c1ac4..16f0d355 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,8 @@ jobs: ruby-version: "3.3" bundler-cache: true apt-get: libsqlite3-dev - - run: bundle exec rake compile test -- --enable-system-libraries + - run: bundle exec rake compile -- --enable-system-libraries + - run: bundle exec rake test test: needs: basic From 5c6335a3ec005466fefc3815eecaa0fa47a7cc43 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 25 Jan 2024 17:00:35 -0500 Subject: [PATCH 3/5] ci: update rubygems in test containers Rubygems 3.3.22 is the minimum needed to correctly detect and use `-linux-musl` and `-linux-gnu` native gems. https://github.com/rake-compiler/rake-compiler/pull/236 introduced a minimum rubygems version for these native platform gems to provide a sensible error message. --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16f0d355..d43108aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -297,7 +297,10 @@ jobs: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes docker run --rm -v $PWD:/work -w /work \ ${{ matrix.docker_platform}} ruby:${{ matrix.ruby }} \ - ./bin/test-gem-install ./gems + sh -c " + gem update --system && + ./bin/test-gem-install ./gems + " test_the_rest: name: "${{ matrix.platform }} ${{ matrix.ruby }}" @@ -361,4 +364,6 @@ jobs: name: cruby-x86_64-linux-gem path: gems - run: apk add bash build-base + - if: matrix.ruby == '3.0' # https://github.com/rake-compiler/rake-compiler/pull/236 + run: gem update --system - run: ./bin/test-gem-install ./gems From 0f43d39019b8ea71392573fdd0a37c6e73457235 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 25 Jan 2024 17:20:58 -0500 Subject: [PATCH 4/5] ci: use sh instead of bash on scripts run on alpine --- .github/workflows/ci.yml | 6 +++--- bin/test-gem-install | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d43108aa..7ce0a76b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -216,7 +216,7 @@ jobs: name: source-gem path: gems - run: ./bin/test-gem-install gems -- --${{ matrix.syslib }}-system-libraries ${{ matrix.compile_flags }} - shell: bash + shell: sh build_native_gem: needs: native_setup @@ -339,7 +339,7 @@ jobs: name: cruby-${{ matrix.platform }}-gem path: gems - run: ./bin/test-gem-install gems - shell: bash + shell: sh cruby-x86_64-linux-musl-install: needs: build_native_gem @@ -363,7 +363,7 @@ jobs: with: name: cruby-x86_64-linux-gem path: gems - - run: apk add bash build-base + - run: apk add build-base - if: matrix.ruby == '3.0' # https://github.com/rake-compiler/rake-compiler/pull/236 run: gem update --system - run: ./bin/test-gem-install ./gems diff --git a/bin/test-gem-install b/bin/test-gem-install index bc5c47ad..e22b2915 100755 --- a/bin/test-gem-install +++ b/bin/test-gem-install @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#! /usr/bin/env sh # # run as part of CI # @@ -15,14 +15,14 @@ test -e /etc/os-release && cat /etc/os-release set -e -x -u -pushd $GEMS_DIR +cd $GEMS_DIR gemfile=$(ls *.gem | head -n1) ls -l ${gemfile} gem install --no-document ${gemfile} -- ${INSTALL_FLAGS} gem list -d sqlite3 -popd +cd .. bundle install --local || bundle install From aba0c06ad194deb380ae968e1184feee245cfc49 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 24 Jan 2024 21:39:21 -0500 Subject: [PATCH 5/5] ext: ship separate linux native gems for GNU and Musl updating to rake-compiler-dock 1.5.0 --- .github/workflows/ci.yml | 70 +++++++++++++++++++--------------------- Gemfile | 2 +- rakelib/native.rake | 12 ++++--- 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ce0a76b..2ae0740a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -225,14 +225,18 @@ jobs: fail-fast: false matrix: platform: - - "aarch64-linux" - - "arm-linux" - - "arm64-darwin" - - "x64-mingw-ucrt" - - "x64-mingw32" - - "x86-linux" - - "x86_64-darwin" - - "x86_64-linux" + - aarch64-linux-gnu + - aarch64-linux-musl + - arm-linux-gnu + - arm-linux-musl + - arm64-darwin + - x64-mingw-ucrt + - x64-mingw32 + - x86-linux-gnu + - x86-linux-musl + - x86_64-darwin + - x86_64-linux-gnu + - x86_64-linux-musl runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -257,35 +261,28 @@ jobs: fail-fast: false matrix: platform: - - aarch64-linux - # - aarch64-linux-gnu - # - aarch64-linux-musl - - arm-linux - # - arm-linux-gnu - # - arm-linux-musl - - x86-linux - # - x86-linux-gnu - # - x86-linux-musl - - x86_64-linux - # - x86_64-linux-gnu - # - x86_64-linux-musl + - aarch64-linux-gnu + - aarch64-linux-musl + - arm-linux-gnu + - arm-linux-musl + - x86-linux-gnu + - x86-linux-musl + - x86_64-linux-gnu + - x86_64-linux-musl ruby: ["3.3", "3.2", "3.1", "3.0"] include: - # # declare docker image for each platform - # - { platform: aarch64-linux-musl, docker_tag: "-alpine" } - # - { platform: arm-linux-musl, docker_tag: "-alpine" } - # - { platform: x86-linux-musl, docker_tag: "-alpine" } - # - { platform: x86_64-linux-musl, docker_tag: "-alpine" } + # declare docker image for each platform + - { platform: aarch64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" } + - { platform: arm-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" } + - { platform: x86-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" } + - { platform: x86_64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" } # declare docker platform for each platform - - { platform: aarch64-linux, docker_platform: "--platform=linux/arm64" } - # - { platform: aarch64-linux-gnu, docker_platform: "--platform=linux/arm64" } - # - { platform: aarch64-linux-musl, docker_platform: "--platform=linux/arm64" } - - { platform: arm-linux, docker_platform: "--platform=linux/arm/v7" } - # - { platform: arm-linux-gnu, docker_platform: "--platform=linux/arm/v7" } - # - { platform: arm-linux-musl, docker_platform: "--platform=linux/arm/v7" } - - { platform: x86-linux, docker_platform: "--platform=linux/386" } - # - { platform: x86-linux-gnu, docker_platform: "--platform=linux/386" } - # - { platform: x86-linux-musl, docker_platform: "--platform=linux/386" } + - { platform: aarch64-linux-gnu, docker_platform: "--platform=linux/arm64" } + - { platform: aarch64-linux-musl, docker_platform: "--platform=linux/arm64" } + - { platform: arm-linux-gnu, docker_platform: "--platform=linux/arm/v7" } + - { platform: arm-linux-musl, docker_platform: "--platform=linux/arm/v7" } + - { platform: x86-linux-gnu, docker_platform: "--platform=linux/386" } + - { platform: x86-linux-musl, docker_platform: "--platform=linux/386" } runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -296,8 +293,9 @@ jobs: - run: | docker run --rm --privileged multiarch/qemu-user-static --reset -p yes docker run --rm -v $PWD:/work -w /work \ - ${{ matrix.docker_platform}} ruby:${{ matrix.ruby }} \ + ${{ matrix.docker_platform}} ruby:${{ matrix.ruby }}${{ matrix.docker_tag }} \ sh -c " + ${{ matrix.bootstrap }} gem update --system && ./bin/test-gem-install ./gems " @@ -361,7 +359,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/download-artifact@v3 with: - name: cruby-x86_64-linux-gem + name: cruby-x86_64-linux-musl-gem path: gems - run: apk add build-base - if: matrix.ruby == '3.0' # https://github.com/rake-compiler/rake-compiler/pull/236 diff --git a/Gemfile b/Gemfile index bc036939..a2e4b7bc 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ group :development do gem "minitest", "5.22.3" gem "rake-compiler", "1.2.7" - gem "rake-compiler-dock", "1.4.0" + gem "rake-compiler-dock", "1.5.0" gem "ruby_memcheck", "2.3.0" if Gem::Platform.local.os == "linux" diff --git a/rakelib/native.rake b/rakelib/native.rake index 9e0f4006..ff9177a8 100644 --- a/rakelib/native.rake +++ b/rakelib/native.rake @@ -8,14 +8,18 @@ require "yaml" cross_rubies = ["3.3.0", "3.2.0", "3.1.0", "3.0.0"] cross_platforms = [ - "aarch64-linux", - "arm-linux", + "aarch64-linux-gnu", + "aarch64-linux-musl", + "arm-linux-gnu", + "arm-linux-musl", "arm64-darwin", "x64-mingw-ucrt", "x64-mingw32", - "x86-linux", + "x86-linux-gnu", + "x86-linux-musl", "x86_64-darwin", - "x86_64-linux" + "x86_64-linux-gnu", + "x86_64-linux-musl" ] ENV["RUBY_CC_VERSION"] = cross_rubies.join(":")