Skip to content

Commit 9515907

Browse files
excid3claude
authored andcommitted
ci(ruby): Publish precompiled native gems
Cross-compile native gems for six platforms (Ruby 3.2-4.0) via oxidize-rb/actions/cross-gem and push them to RubyGems alongside the source gem. Bump rb_sys to 0.9.130 for Ruby 4.0 support and add Ruby 4.0 to the test matrices. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent dbe9b13 commit 9515907

3 files changed

Lines changed: 56 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ jobs:
624624
fail-fast: false
625625
matrix:
626626
os: [ubuntu-22.04, macos-15, windows-2022]
627-
ruby-version: ["3.2", "3.3", "3.4"]
627+
ruby-version: ["3.2", "3.3", "3.4", "4.0"]
628628

629629
name: Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
630630
runs-on: ${{ matrix.os }}
@@ -672,7 +672,7 @@ jobs:
672672
fail-fast: false
673673
matrix:
674674
os: [ubuntu-22.04, macos-15, windows-2022]
675-
ruby-version: ["3.2", "3.3", "3.4"]
675+
ruby-version: ["3.2", "3.3", "3.4", "4.0"]
676676

677677
steps:
678678
- uses: actions/checkout@v7

.github/workflows/ruby-release.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,47 @@ on:
66
- ruby-v*
77

88
jobs:
9+
cross-gem:
10+
name: Compile native gem for ${{ matrix.platform }}
11+
runs-on: ubuntu-22.04
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
platform:
17+
- aarch64-linux
18+
- arm64-darwin
19+
- x64-mingw-ucrt
20+
- x86_64-darwin
21+
- x86_64-linux
22+
- x86_64-linux-musl
23+
24+
steps:
25+
- uses: actions/checkout@v7
26+
27+
- name: Set up Ruby
28+
uses: ruby/setup-ruby@v1
29+
with:
30+
ruby-version: "3.2"
31+
bundler-cache: true
32+
working-directory: ./bindings/ruby
33+
34+
- name: Compile native gem
35+
id: cross-gem
36+
uses: oxidize-rb/actions/cross-gem@v1.4.4
37+
with:
38+
platform: ${{ matrix.platform }}
39+
ruby-versions: "3.2,3.3,3.4,4.0"
40+
working-directory: ./bindings/ruby
41+
42+
- uses: actions/upload-artifact@v7
43+
with:
44+
name: cross-gem-${{ matrix.platform }}
45+
path: ${{ steps.cross-gem.outputs.gem-path }}
46+
if-no-files-found: error
47+
948
ruby-release:
49+
needs: cross-gem
1050
runs-on: ubuntu-22.04
1151

1252
steps:
@@ -22,12 +62,20 @@ jobs:
2262
- name: Extract Version
2363
run: echo "version=${GITHUB_REF#refs/tags/ruby-v}" >> $GITHUB_ENV
2464

65+
- name: Download native gems
66+
uses: actions/download-artifact@v8
67+
with:
68+
pattern: cross-gem-*
69+
merge-multiple: true
70+
path: ./bindings/ruby/pkg
71+
2572
- name: GitHub Release
2673
uses: softprops/action-gh-release@v3
2774
with:
2875
make_latest: false
2976
draft: true
3077
name: "[Ruby] Release ${{ env.version }}"
78+
files: ./bindings/ruby/pkg/*.gem
3179

3280
- name: Publish to RubyGems
3381
run: |
@@ -37,6 +85,8 @@ jobs:
3785
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
3886
cd ./bindings/ruby
3987
gem build *.gemspec
40-
gem push *.gem
88+
for gem in *.gem pkg/*.gem; do
89+
gem push "$gem"
90+
done
4191
env:
4292
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_API_KEY }}"

bindings/ruby/Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ GEM
4343
rake (13.3.1)
4444
rake-compiler (1.3.1)
4545
rake
46-
rake-compiler-dock (1.10.0)
47-
rb_sys (0.9.123)
48-
rake-compiler-dock (= 1.10.0)
46+
rake-compiler-dock (1.12.0)
47+
rb_sys (0.9.130)
48+
rake-compiler-dock (= 1.12.0)
4949
roadie (5.2.1)
5050
css_parser (~> 1.4)
5151
nokogiri (~> 1.15)

0 commit comments

Comments
 (0)