Skip to content

Commit ec2a239

Browse files
committed
Update continuous integration and experimental ruby builds
1 parent f4d0e93 commit ec2a239

16 files changed

+181
-187
lines changed

.github/workflows/main.yml renamed to .github/workflows/continuous_integration.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
1-
name: Ruby
1+
name: Continuous Integration
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [main]
76

87
pull_request:
9-
branches: [ main ]
8+
branches: [main]
9+
10+
workflow_dispatch:
11+
12+
# Supported platforms / Ruby versions:
13+
# - Ubuntu: MRI (3.1, 3.2, 3.3), TruffleRuby (24), JRuby (9.4)
14+
# - Windows: MRI (3.1), JRuby (9.4)
1015

1116
jobs:
1217
build:
13-
runs-on: ubuntu-latest
14-
continue-on-error: ${{ matrix.ruby == 'head' }}
18+
name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}
19+
20+
runs-on: ${{ matrix.operating-system }}
21+
continue-on-error: true
22+
1523
strategy:
1624
fail-fast: false
1725
matrix:
18-
ruby: ['3.0', '3.1', '3.2', 'head']
19-
20-
name: Build on Ruby ${{ matrix.ruby }}
26+
ruby: ["3.1", "3.2", "3.3", "jruby-9.4", "truffleruby-24"]
27+
operating-system: [ubuntu-latest]
28+
include:
29+
- ruby: "3.1"
30+
operating-system: windows-latest
31+
- ruby: "jruby-9.4"
32+
operating-system: windows-latest
2133

2234
steps:
2335
- name: Checkout
24-
uses: actions/checkout@v3
36+
uses: actions/checkout@v4
2537

2638
- name: Initialize Ruby
2739
uses: ruby/setup-ruby@v1
@@ -33,22 +45,21 @@ jobs:
3345
run: bundle exec rake
3446

3547
coverage:
36-
needs: [ build ]
37-
runs-on: ubuntu-latest
38-
3948
name: Report test coverage to CodeClimate
4049

50+
needs: [build]
51+
runs-on: ubuntu-latest
52+
4153
steps:
4254
- name: Checkout
43-
uses: actions/checkout@v3
55+
uses: actions/checkout@v4
4456

4557
- name: Initialize Ruby
4658
uses: ruby/setup-ruby@v1
4759
with:
4860
ruby-version: 3.1
4961
bundler-cache: true
5062

51-
5263
- name: Report test coverage
5364
uses: paambaati/codeclimate-action@v9
5465
env:
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Experimental Ruby Builds
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
workflow_dispatch:
8+
9+
# Experimental platforms / Ruby versions:
10+
# - Ubuntu: MRI (head), TruffleRuby (head), JRuby (head)
11+
# - Windows: MRI (head), JRuby (head)
12+
13+
jobs:
14+
build:
15+
name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}
16+
17+
runs-on: ${{ matrix.operating-system }}
18+
continue-on-error: true
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- ruby: head
25+
operating-system: ubuntu-latest
26+
- ruby: head
27+
operating-system: windows-latest
28+
- ruby: truffleruby-head
29+
operating-system: ubuntu-latest
30+
- ruby: jruby-head
31+
operating-system: ubuntu-latest
32+
- ruby: jruby-head
33+
operating-system: windows-latest
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: Initialize Ruby
40+
uses: ruby/setup-ruby@v1
41+
with:
42+
ruby-version: ${{ matrix.ruby }}
43+
bundler-cache: true
44+
45+
- name: Run rake
46+
run: bundle exec rake

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ AllCops:
77
SuggestExtensions: false
88
# RuboCop enforces rules depending on the oldest version of Ruby which
99
# your project supports:
10-
TargetRubyVersion: 3.0
10+
TargetRubyVersion: 3.1
1111

1212
# The default max line length is 80 characters
1313
Layout/LineLength:

.solargraph.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

Rakefile

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
# The default task
44

55
desc 'Run the same tasks that the CI build will run'
6-
task default: %w[spec rubocop yard yard:audit yard:coverage bundle:audit build]
6+
if RUBY_PLATFORM == 'java'
7+
task default: %w[spec rubocop bundle:audit build]
8+
else
9+
task default: %w[spec rubocop yard bundle:audit build]
10+
end
711

812
# Bundler Audit
913

@@ -30,6 +34,11 @@ CLOBBER << 'Gemfile.lock'
3034

3135
require 'rspec/core/rake_task'
3236

37+
if RUBY_PLATFORM == 'java'
38+
ENV['JAVA_OPTS'] = '-Djdk.io.File.enableADS=true'
39+
ENV['JRUBY_OPTS'] = '--debug'
40+
end
41+
3342
RSpec::Core::RakeTask.new
3443

3544
CLEAN << 'coverage'
@@ -49,38 +58,40 @@ end
4958

5059
CLEAN << 'rubocop-report.json'
5160

52-
# YARD
61+
unless RUBY_PLATFORM == 'java'
62+
# yard:build
5363

54-
require 'yard'
55-
YARD::Rake::YardocTask.new do |t|
56-
t.files = %w[lib/**/*.rb examples/**/*]
57-
t.stats_options = ['--list-undoc']
58-
end
64+
require 'yard'
5965

60-
CLEAN << '.yardoc'
61-
CLEAN << 'doc'
66+
YARD::Rake::YardocTask.new('yard:build') do |t|
67+
t.files = %w[lib/**/*.rb examples/**/*]
68+
t.options = %w[--no-private]
69+
t.stats_options = %w[--list-undoc]
70+
end
6271

63-
# Yardstick
72+
CLEAN << '.yardoc'
73+
CLEAN << 'doc'
6474

65-
desc 'Run yardstick to show missing YARD doc elements'
66-
task :'yard:audit' do
67-
sh "yardstick 'lib/**/*.rb'"
68-
end
75+
# yard:audit
6976

70-
# Yardstick coverage
77+
desc 'Run yardstick to show missing YARD doc elements'
78+
task :'yard:audit' do
79+
sh "yardstick 'lib/**/*.rb'"
80+
end
7181

72-
require 'yardstick/rake/verify'
82+
# yard:coverage
7383

74-
Yardstick::Rake::Verify.new(:'yard:coverage') do |verify|
75-
verify.threshold = 100
76-
end
84+
require 'yardstick/rake/verify'
7785

78-
# # Solargraph typecheck
86+
Yardstick::Rake::Verify.new(:'yard:coverage') do |verify|
87+
verify.threshold = 100
88+
end
7989

80-
# desc 'Run the solargraph type checker'
81-
# task :'solargraph:typecheck' do
82-
# sh 'bundle exec solargraph typecheck --level=typed'
83-
# end
90+
# yard
91+
92+
desc 'Run all YARD tasks'
93+
task yard: %i[yard:build yard:audit yard:coverage]
94+
end
8495

8596
# Additional cleanup
8697

create_github_release.gemspec

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
1515
DESCRIPTION
1616
spec.homepage = 'https://github.com/main-branch/create_github_release'
1717
spec.license = 'MIT'
18-
spec.required_ruby_version = '>= 3.0.0'
18+
spec.required_ruby_version = '>= 3.1.0'
1919

2020
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
2121

@@ -34,23 +34,28 @@ Gem::Specification.new do |spec|
3434
spec.bindir = 'exe'
3535
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
3636
spec.require_paths = ['lib']
37+
spec.requirements = [
38+
'Platform: Mac, Linux, or Windows',
39+
'Ruby: MRI 3.1 or later, TruffleRuby 24 or later, or JRuby 9.4 or later'
40+
]
3741

3842
spec.add_dependency 'version_boss', '~> 0.1'
3943

4044
spec.add_development_dependency 'bundler-audit', '~> 0.9'
41-
spec.add_development_dependency 'debug', '~> 1.9'
45+
# spec.add_development_dependency 'debug', '~> 1.9'
4246
spec.add_development_dependency 'rake', '~> 13.2'
43-
spec.add_development_dependency 'redcarpet', '~> 3.6'
4447
spec.add_development_dependency 'rspec', '~> 3.13'
45-
spec.add_development_dependency 'rubocop', '~> 1.63'
48+
spec.add_development_dependency 'rubocop', '~> 1.66'
4649
spec.add_development_dependency 'simplecov', '~> 0.22'
4750
spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
51+
spec.add_development_dependency 'simplecov-rspec', '~> 0.2'
4852
spec.add_development_dependency 'timecop', '~> 0.9'
49-
spec.add_development_dependency 'yard', '~> 0.9'
50-
spec.add_development_dependency 'yardstick', '~> 0.9'
5153

52-
# For more information and examples about making a new gem, check out our
53-
# guide at: https://bundler.io/guides/creating_gem.html
54+
unless RUBY_PLATFORM == 'java'
55+
spec.add_development_dependency 'redcarpet', '~> 3.6'
56+
spec.add_development_dependency 'yard', '~> 0.9', '>= 0.9.28'
57+
spec.add_development_dependency 'yardstick', '~> 0.9'
58+
end
5459

5560
spec.metadata['rubygems_mfa_required'] = 'true'
5661
end

spec/create_github_release/assertions/bundle_is_up_to_date_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
let(:mocked_commands) do
3030
[
31-
MockedCommand.new('bundle update --quiet', exitstatus: exitstatus)
31+
MockedCommand.new('bundle update --quiet', exitstatus:)
3232
]
3333
end
3434

@@ -55,7 +55,7 @@
5555

5656
let(:mocked_commands) do
5757
[
58-
MockedCommand.new('bundle install --quiet', exitstatus: exitstatus)
58+
MockedCommand.new('bundle install --quiet', exitstatus:)
5959
]
6060
end
6161

spec/create_github_release/assertions/gh_authenticated_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
let(:mocked_commands) do
2525
[
26-
MockedCommand.new('gh auth status 2>&1', stdout: stdout, exitstatus: exitstatus)
26+
MockedCommand.new('gh auth status 2>&1', stdout:, exitstatus:)
2727
]
2828
end
2929

spec/create_github_release/assertions/gh_command_exists_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
let(:mocked_commands) do
2525
[
26-
MockedCommand.new('which gh > /dev/null 2>&1', exitstatus: exitstatus)
26+
MockedCommand.new('which gh > /dev/null 2>&1', exitstatus:)
2727
]
2828
end
2929

spec/create_github_release/assertions/git_command_exists_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
let(:mocked_commands) do
2525
[
26-
MockedCommand.new('which git > /dev/null 2>&1', exitstatus: exitstatus)
26+
MockedCommand.new('which git > /dev/null 2>&1', exitstatus:)
2727
]
2828
end
2929

spec/create_github_release/assertions/in_git_repo_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
let(:mocked_commands) do
2525
[
26-
MockedCommand.new('git rev-parse --is-inside-work-tree --quiet > /dev/null 2>&1', exitstatus: exitstatus)
26+
MockedCommand.new('git rev-parse --is-inside-work-tree --quiet > /dev/null 2>&1', exitstatus:)
2727
]
2828
end
2929

spec/create_github_release/assertions/local_and_remote_on_same_commit_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
MockedCommand.new(
3333
'git rev-parse HEAD',
3434
stdout: "#{local_commit}\n",
35-
exitstatus: exitstatus
35+
exitstatus:
3636
),
3737
MockedCommand.new(
3838
"git ls-remote 'origin' 'default-branch' | cut -f 1",
3939
stdout: "#{remote_commit}\n",
40-
exitstatus: exitstatus
40+
exitstatus:
4141
)
4242
]
4343
end

spec/create_github_release/backtick_debug_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ def backtick_debug?
4747
end
4848
end
4949

50+
require 'rbconfig'
51+
5052
context 'when the command fails' do
51-
let(:command) { 'echo foo; exit 1' }
53+
let(:command) { "#{RbConfig.ruby} -e \"puts 'foo'; exit 1\"" }
5254

5355
let(:including_class) do
5456
Class.new do
@@ -61,7 +63,7 @@ def backtick_debug?
6163

6264
let(:expected_output) { <<~EXPECTED_OUTPUT }
6365
COMMAND
64-
echo foo; exit 1
66+
#{command}
6567
OUTPUT
6668
foo
6769
EXITSTATUS

spec/create_github_release/change_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
describe '#initialize' do
99
subject { change }
1010

11-
it { is_expected.to(have_attributes(sha: sha, subject: subject_string)) }
11+
it { is_expected.to(have_attributes(sha:, subject: subject_string)) }
1212
end
1313
end

spec/create_github_release/changelog_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
it do
2222
is_expected.to(
2323
have_attributes(
24-
existing_changelog: existing_changelog,
25-
next_release_description: next_release_description
24+
existing_changelog:,
25+
next_release_description:
2626
)
2727
)
2828
end

0 commit comments

Comments
 (0)