Skip to content

Commit 70b5ee1

Browse files
committed
build: Adjust ruby release process
Signed-off-by: Dmitry Dygalo <dmitry@dygalo.dev>
1 parent 45f9c94 commit 70b5ee1

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

.github/workflows/ruby-release.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
cross-gem:
2020
name: Compile native gem for ${{ matrix.platform }}
2121
runs-on: ubuntu-22.04
22+
env:
23+
RUBY_VERSIONS: "3.2,3.3,3.4,4.0"
2224

2325
strategy:
2426
fail-fast: false
@@ -42,19 +44,31 @@ jobs:
4244
bundler-cache: true
4345
working-directory: ./bindings/ruby
4446

45-
# `cross-gem` reads `rb_sys` version from the root `Gemfile.lock`, and
46-
# falls back to the newest published one when it is missing.
47-
- name: Expose Gemfile.lock for rb-sys-dock version detection
48-
run: cp bindings/ruby/Gemfile.lock Gemfile.lock
47+
# `cross-gem` picks the toolchain from the first `rb_sys` line of the root
48+
# `Gemfile.lock`. Copying the file wholesale hands it the `PATH` section's
49+
# `~>` constraint instead of the resolved version, so pass only the latter.
50+
- name: Expose rb_sys version for rb-sys-dock
51+
run: grep -E '^ +rb_sys \([0-9]' bindings/ruby/Gemfile.lock > Gemfile.lock
4952

5053
- name: Compile native gem
5154
id: cross-gem
5255
uses: oxidize-rb/actions/cross-gem@v1.4.4
5356
with:
5457
platform: ${{ matrix.platform }}
55-
ruby-versions: "3.2,3.3,3.4,4.0"
58+
ruby-versions: ${{ env.RUBY_VERSIONS }}
5659
working-directory: ./bindings/ruby
5760

61+
# rake-compiler only warns when the image lacks a requested Ruby, and still
62+
# exits 0 with that ABI silently absent from the gem.
63+
- name: Verify every Ruby ABI was built
64+
working-directory: ./bindings/ruby
65+
run: |
66+
for version in ${RUBY_VERSIONS//,/ }; do
67+
tar -xOf pkg/*.gem data.tar.gz | tar -tzf - \
68+
| grep -q "lib/css_inline/$version/" \
69+
|| { echo "::error::Ruby $version missing from $(ls pkg/*.gem)"; exit 1; }
70+
done
71+
5872
# Pushes to RubyGems are irreversible.
5973
- name: Smoke test
6074
if: matrix.platform == 'x86_64-linux'

0 commit comments

Comments
 (0)