Skip to content

Commit 6dada1a

Browse files
Add release workflow and update Ruby versions (#49)
* Add release workflow and update Ruby version requirements - Add release.yml for automated gem publishing via trusted publishing - Drop Ruby 3.2 (EOL), set minimum to 3.3 - Add Ruby 4.0 to CI test matrix - Widen native gem upper bound to < 4.1.dev * Upgrade minitest to 6.0 and drop unused minitest-reporters minitest ~> 5.25 has required_ruby_version < 4.0, blocking CI on Ruby 4.0. minitest 6.0+ removes that upper bound. minitest-reporters was never configured so it's dead weight.
1 parent 94dfec4 commit 6dada1a

File tree

5 files changed

+138
-5
lines changed

5 files changed

+138
-5
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
fail-fast: false
4747
matrix:
4848
os: [ubuntu-latest]
49-
ruby: ['3.2', '3.3', '3.4']
49+
ruby: ['3.3', '3.4', '4.0']
5050

5151
steps:
5252
- uses: actions/checkout@v6

.github/workflows/release.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags: ["v*"]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: false
11+
12+
jobs:
13+
source-gem:
14+
name: Build source gem
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v6
18+
19+
- uses: dtolnay/rust-toolchain@stable
20+
21+
- uses: ruby/setup-ruby@v1
22+
with:
23+
ruby-version: "3.4"
24+
bundler-cache: true
25+
26+
- run: bundle exec rake build
27+
28+
- uses: actions/upload-artifact@v4
29+
with:
30+
name: source-gem
31+
path: pkg/*.gem
32+
if-no-files-found: error
33+
34+
cross-compile:
35+
name: Build native gem (${{ matrix.platform }})
36+
runs-on: ubuntu-latest
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
platform:
41+
- x86_64-linux
42+
- aarch64-linux
43+
- arm64-darwin
44+
steps:
45+
- uses: actions/checkout@v6
46+
47+
- uses: ruby/setup-ruby@v1
48+
with:
49+
ruby-version: "3.4"
50+
bundler-cache: true
51+
52+
- run: bundle exec rb-sys-dock --ruby-versions 4.0,3.4,3.3 --platform ${{ matrix.platform }} --build
53+
54+
- uses: actions/upload-artifact@v4
55+
with:
56+
name: cross-gem-${{ matrix.platform }}
57+
path: pkg/*.gem
58+
if-no-files-found: error
59+
60+
smoke-test:
61+
name: Smoke test (Ruby ${{ matrix.ruby }})
62+
needs: [cross-compile]
63+
runs-on: ubuntu-latest
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
ruby: ["3.3", "3.4"]
68+
steps:
69+
- uses: ruby/setup-ruby@v1
70+
with:
71+
ruby-version: ${{ matrix.ruby }}
72+
73+
- uses: actions/download-artifact@v4
74+
with:
75+
name: cross-gem-x86_64-linux
76+
path: pkg/
77+
78+
- name: Install native gem
79+
run: gem install pkg/wreq-*-x86_64-linux.gem
80+
81+
- name: Verify gem loads and prints version
82+
run: ruby -rwreq -e "puts Wreq::VERSION"
83+
84+
release:
85+
name: Release
86+
needs: [source-gem, cross-compile, smoke-test]
87+
runs-on: ubuntu-latest
88+
if: startsWith(github.ref, 'refs/tags/v')
89+
permissions:
90+
id-token: write
91+
steps:
92+
- uses: actions/checkout@v6
93+
94+
- uses: dtolnay/rust-toolchain@stable
95+
96+
- uses: ruby/setup-ruby@v1
97+
with:
98+
ruby-version: "3.4"
99+
bundler-cache: true
100+
101+
- uses: actions/download-artifact@v4
102+
with:
103+
path: pkg/
104+
pattern: "{cross-gem-*,source-gem}"
105+
merge-multiple: true
106+
107+
- name: List gems
108+
run: ls -la pkg/*.gem
109+
110+
- name: Verify version matches tag
111+
run: |
112+
GEM_VERSION=$(bundle exec rake version)
113+
if [ "v${GEM_VERSION}" != "${{ github.ref_name }}" ]; then
114+
echo "::error::Gem version v${GEM_VERSION} does not match tag ${{ github.ref_name }}"
115+
exit 1
116+
fi
117+
118+
- name: Configure trusted publishing credentials
119+
uses: rubygems/configure-rubygems-credentials@v1
120+
121+
- name: Push all gems to RubyGems.org
122+
run: |
123+
failed=0
124+
for gem in pkg/*.gem; do
125+
echo "Pushing $(basename $gem)..."
126+
if ! gem push "$gem"; then
127+
echo "::warning::Failed to push $(basename $gem)"
128+
failed=1
129+
fi
130+
done
131+
if [ "$failed" -eq 1 ]; then
132+
echo "::error::Some gems failed to push"
133+
exit 1
134+
fi

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ group :development, :test do
77
gem "rake", ">= 13.2"
88
gem "rb_sys", "~> 0.9.110" # for Makefile generation in extconf.rb
99
gem "rake-compiler", "~> 1.2.9" # to build a debug build
10-
gem "minitest", "~> 5.25.0" # test library
11-
gem "minitest-reporters", "~> 1.7.1" # better test output
10+
gem "minitest", "~> 6.0" # test library
1211
gem "activesupport", "~> 8.0.1" # testing support
1312
gem "standard", "~> 1.52" # linter with pre-specified rules
1413
gem "redcarpet", "~> 3.6" # for documentation markdown parsing

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RbSys::ExtensionTask.new(CRATE_PACKAGE_NAME, GEMSPEC) do |ext|
2626

2727
# Override Ruby version for native gems (keep in sync with wreq.gemspec)
2828
ext.cross_compiling do |spec|
29-
spec.required_ruby_version = ">= 3.2", "< 3.5.dev"
29+
spec.required_ruby_version = ">= 3.3", "< 4.1.dev"
3030
end
3131
end
3232

wreq.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Gem::Specification.new do |spec|
5959
# - not end of life
6060
#
6161
# keep in sync with `Rakefile`.
62-
spec.required_ruby_version = ">= 3.2"
62+
spec.required_ruby_version = ">= 3.3"
6363

6464
# intentionally skipping rb_sys gem because newer Rubygems will be present
6565
end

0 commit comments

Comments
 (0)