From fb601717a9e060ae76b18dabf2050e0f298126e1 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 10 Dec 2024 17:35:39 -0500 Subject: [PATCH 1/4] ci: extract the cruby-package job with the expectation that we can re-use it in upstream.yml to test against rake-compiler-dock snapshots. --- .github/workflows/_cruby_package.yml | 44 ++++++++++++++++++++++++++++ .github/workflows/ci.yml | 37 ++--------------------- 2 files changed, 47 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/_cruby_package.yml diff --git a/.github/workflows/_cruby_package.yml b/.github/workflows/_cruby_package.yml new file mode 100644 index 00000000000..bb0f1ea6b78 --- /dev/null +++ b/.github/workflows/_cruby_package.yml @@ -0,0 +1,44 @@ +on: + workflow_call: + inputs: + rcd_image_version: + description: The version of the rake-compiler-dock image to use + required: true + type: string + +jobs: + cruby-package: + name: ${{ matrix.plat }} + strategy: + fail-fast: false + matrix: + plat: + - "aarch64-linux" + - "arm-linux" + - "arm64-darwin" + - "x64-mingw-ucrt" + - "x64-mingw32" + - "x86-linux" + - "x86-mingw32" # github actions does not support this runtime as of 2022-12, but let's build anyway + - "x86_64-darwin" + - "x86_64-linux" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: actions/cache@v4 + with: + path: ports/archives + key: tarballs-ubuntu-${{ hashFiles('dependencies.yml', 'patches/**/*.patch') }} + - env: + DOCKER_IMAGE: "ghcr.io/rake-compiler/rake-compiler-dock-image:${{ inputs.rcd_image_version }}-mri-${{ matrix.plat }}" + run: | + docker run --rm -v "$(pwd):/nokogiri" -w /nokogiri \ + ${DOCKER_IMAGE} \ + ./scripts/test-gem-build gems ${{ matrix.plat }} + - uses: actions/upload-artifact@v4 + with: + name: "cruby-${{ matrix.plat }}-gem" + path: gems + retention-days: 1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d71bca53f5..e7ad6fe03b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -572,40 +572,9 @@ jobs: cruby-package: needs: ["rcd_image_version"] - name: "cruby-package" - strategy: - fail-fast: false - matrix: - plat: - - "aarch64-linux" - - "arm-linux" - - "arm64-darwin" - - "x64-mingw-ucrt" - - "x64-mingw32" - - "x86-linux" - - "x86-mingw32" # github actions does not support this runtime as of 2022-12, but let's build anyway - - "x86_64-darwin" - - "x86_64-linux" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - uses: actions/cache@v4 - with: - path: ports/archives - key: tarballs-ubuntu-${{hashFiles('dependencies.yml', 'patches/**/*.patch')}} - - env: - DOCKER_IMAGE: "ghcr.io/rake-compiler/rake-compiler-dock-image:${{needs.rcd_image_version.outputs.rcd_image_version}}-mri-${{matrix.plat}}" - run: | - docker run --rm -v "$(pwd):/nokogiri" -w /nokogiri \ - ${DOCKER_IMAGE} \ - ./scripts/test-gem-build gems ${{matrix.plat}} - - uses: actions/upload-artifact@v4 - with: - name: "cruby-${{matrix.plat}}-gem" - path: gems - retention-days: 1 + uses: ./.github/workflows/_cruby_package.yml + with: + rcd_image_version: ${{ needs.rcd_image_version.outputs.rcd_image_version }} cruby-x86-linux-install: needs: ["cruby-package"] From 4f4947109690902d2803cebf205c5e35eed367aa Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 10 Dec 2024 17:40:54 -0500 Subject: [PATCH 2/4] ci: test against upstream rake-compiler-dock --- .github/workflows/upstream.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 834f3d17937..945ea24f767 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -211,3 +211,8 @@ jobs: - run: bundle install --local || bundle install - run: bundle exec rake compile -- --disable-system-libraries - run: bundle exec rake test + + rake-compiler-dock: + uses: ./.github/workflows/_cruby_package.yml + with: + rcd_image_version: snapshot From aeb7ad12cf86275305b89caaa1fdeacf047b7cdb Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 10 Dec 2024 18:39:51 -0500 Subject: [PATCH 3/4] ci: test-gem-build detects snapshot builds and uses the edge version of the gem as well --- .github/workflows/_cruby_package.yml | 1 + scripts/test-gem-build | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/_cruby_package.yml b/.github/workflows/_cruby_package.yml index bb0f1ea6b78..3cc13fb6187 100644 --- a/.github/workflows/_cruby_package.yml +++ b/.github/workflows/_cruby_package.yml @@ -35,6 +35,7 @@ jobs: DOCKER_IMAGE: "ghcr.io/rake-compiler/rake-compiler-dock-image:${{ inputs.rcd_image_version }}-mri-${{ matrix.plat }}" run: | docker run --rm -v "$(pwd):/nokogiri" -w /nokogiri \ + -e RCD_VERSION=${{ inputs.rcd_image_version }} \ ${DOCKER_IMAGE} \ ./scripts/test-gem-build gems ${{ matrix.plat }} - uses: actions/upload-artifact@v4 diff --git a/scripts/test-gem-build b/scripts/test-gem-build index 3df73f038ab..ba440d46f11 100755 --- a/scripts/test-gem-build +++ b/scripts/test-gem-build @@ -19,7 +19,14 @@ set -u -x # avoid the pernicious "fatal: detected dubious ownership in repository" errors git config --global --add safe.directory $(realpath $(dirname $0)/..) +# RCD_VERSION is an env var that should be set in CI +if [[ "${RCD_VERSION:-}" = "snapshot" ]] ; then + bundle remove rake-compiler-dock + bundle add rake-compiler-dock --github rake-compiler/rake-compiler-dock --branch main --skip-install +fi + bundle +bundle show --paths bundle exec rake set-version-to-timestamp From 1b0d927b1e4279ee6c42def4e1a4b45cf4fb570c Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 10 Dec 2024 19:09:39 -0500 Subject: [PATCH 4/4] ext: work with rake-compiler-dock 1.6.0 which uses ubuntu images instead of manylinux images. --- rakelib/extensions.rake | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/rakelib/extensions.rake b/rakelib/extensions.rake index 3181dfed85d..de53a07cf66 100644 --- a/rakelib/extensions.rake +++ b/rakelib/extensions.rake @@ -72,9 +72,17 @@ CrossRuby = Struct.new(:version, :platform) do when "x86-mingw32" "i686-w64-mingw32-" when "x86_64-linux" - "x86_64-redhat-linux-gnu-" + if RakeCompilerDock::IMAGE_VERSION >= "1.6" + "x86_64-linux-gnu-" + else + "x86_64-redhat-linux-gnu-" + end when "x86-linux" - "i686-redhat-linux-gnu-" + if RakeCompilerDock::IMAGE_VERSION >= "1.6" + "i686-linux-gnu-" + else + "i686-redhat-linux-gnu-" + end when "aarch64-linux" "aarch64-linux-gnu-" when "x86_64-darwin" @@ -204,7 +212,11 @@ CrossRuby = Struct.new(:version, :platform) do def dll_ref_versions case platform when X86_LINUX_PLATFORM_REGEX - { "GLIBC" => "2.17" } + if RakeCompilerDock::IMAGE_VERSION >= "1.6" + { "GLIBC" => "2.29" } + else + { "GLIBC" => "2.17" } + end when AARCH_LINUX_PLATFORM_REGEX, ARM_LINUX_PLATFORM_REGEX { "GLIBC" => "2.29" } else