Skip to content

Commit c8d1489

Browse files
committed
Updated for Ruby 3.3 & Custom coverage task
1 parent 8bbedbe commit c8d1489

16 files changed

+146
-97
lines changed
Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
22
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
33

4-
name: TestSpace Coverage
4+
name: 100% Coverage
55

66
on:
77
push:
@@ -14,30 +14,28 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
17-
BUNDLE_GEMFILE: ${{ github.workspace }}/ruby_3_2.gemfile
17+
BUNDLE_GEMFILE: ${{ github.workspace }}/ruby_3_3.gemfile
18+
GITHUB_ACTION: true
1819

1920
steps:
20-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2122
with:
2223
fetch-depth: 50
2324

2425
- name: Set up Ruby
2526
uses: ruby/setup-ruby@v1
2627
with:
27-
ruby-version: '3.2' # Not needed with a .ruby-version file
28+
ruby-version: '3.3' # Not needed with a .ruby-version file
2829
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
2930

3031
- name: Install Appraisal Gems
3132
run: bundle exec rake install
3233

3334
- name: Run tests
34-
run: FOR_TESTSPACE=true bundle exec rake latest
35-
36-
- uses: testspace-com/setup-testspace@v1
37-
with:
38-
domain: ${{ github.repository_owner }}
39-
- name: Push result to TestSpace server
40-
run: |
41-
testspace coverage/coverage.xml
42-
if: always()
35+
run: bundle exec rake latest
4336

37+
- name: Assert 100% Test Coverage
38+
run: >
39+
ruby -e "require('json') &&
40+
(rate = JSON.parse(File.read('coverage/.last_run.json'))['result']['line'].to_i) &&
41+
(rate == 100 ? exit(0) : exit(rate))"

.github/workflows/ruby_2_5.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
BUNDLE_GEMFILE: ${{ github.workspace }}/ruby_2_5.gemfile
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- name: Set up Ruby
2323
uses: ruby/setup-ruby@v1
2424
with:

.github/workflows/ruby_2_6.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
BUNDLE_GEMFILE: ${{ github.workspace }}/ruby_2_6.gemfile
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- name: Set up Ruby
2323
uses: ruby/setup-ruby@v1
2424
with:

.github/workflows/ruby_2_7.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
BUNDLE_GEMFILE: ${{ github.workspace }}/ruby_2_7.gemfile
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- name: Set up Ruby
2323
uses: ruby/setup-ruby@v1
2424
with:

.github/workflows/ruby_3_0.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
BUNDLE_GEMFILE: ${{ github.workspace }}/ruby_3_0.gemfile
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- name: Set up Ruby
2323
uses: ruby/setup-ruby@v1
2424
with:

.github/workflows/ruby_3_1.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
BUNDLE_GEMFILE: ${{ github.workspace }}/ruby_3_1.gemfile
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- name: Set up Ruby
2323
uses: ruby/setup-ruby@v1
2424
with:

.github/workflows/ruby_3_2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
BUNDLE_GEMFILE: ${{ github.workspace }}/ruby_3_2.gemfile
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- name: Set up Ruby
2323
uses: ruby/setup-ruby@v1
2424
with:

.github/workflows/ruby_3_3.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
2+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
3+
4+
name: Ruby 3.3
5+
6+
on:
7+
push:
8+
branches: [ main, dev ]
9+
pull_request:
10+
branches: [ main, dev ]
11+
12+
jobs:
13+
test:
14+
15+
runs-on: ubuntu-latest
16+
17+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
18+
BUNDLE_GEMFILE: ${{ github.workspace }}/ruby_3_3.gemfile
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up Ruby
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: '3.3' # Not needed with a .ruby-version file
26+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
27+
28+
- name: Install Appraisal Gems
29+
run: bundle exec rake install
30+
31+
- name: Run tests
32+
run: bundle exec rake test_all

Rakefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ task :test_latest do
1616
puts "=====================================\n"
1717

1818
latest = `BUNDLE_GEMFILE=#{RubyVersion.gemfile} bundle _2.3.26_ exec appraisal list`.split("\n").first
19-
system "BUNDLE_GEMFILE=#{RubyVersion.gemfile} bundle _2.3.26_ exec appraisal #{latest} rspec spec"
19+
system "WITH_COVERAGE=true BUNDLE_GEMFILE=#{RubyVersion.gemfile} bundle _2.3.26_ exec appraisal #{latest} rspec spec"
2020
end
2121

2222

@@ -80,7 +80,7 @@ task :install do
8080
# system "gem update bundler"
8181
system "gem install bundler:2.3.26"
8282

83-
83+
8484

8585
puts "\n\n"
8686
puts "=================\n"
@@ -148,7 +148,7 @@ desc "Opens the coverage results in the default brwoser."
148148
task :coverage do
149149
Rake::Task["test_latest"].invoke
150150

151-
unless ENV['FOR_TESTSPACE']
151+
unless ENV['GITHUB_ACTION']
152152
`open coverage/index.html`
153153
end
154154
end
@@ -184,4 +184,3 @@ task :bundler do
184184
puts "BUNDLE_GEMFILE=#{RubyVersion.gemfile} bundle _2.3.26_ "
185185
puts "\n\n"
186186
end
187-

ruby_3_1.gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,3 @@ gem 'appraisal'
77
gem 'byebug'
88
gem 'rake', '~> 13.0'
99
gem 'rspec', '~> 3.0'
10-
gem 'rubocop'
11-
gem 'yard'

ruby_3_1.gemfile.lock

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,9 @@ GEM
66
bundler
77
rake
88
thor (>= 0.14.0)
9-
ast (2.4.2)
109
byebug (11.1.3)
1110
diff-lcs (1.5.0)
12-
json (2.6.3)
13-
language_server-protocol (3.17.0.3)
14-
parallel (1.23.0)
15-
parser (3.2.2.3)
16-
ast (~> 2.4.1)
17-
racc
18-
racc (1.7.1)
19-
rainbow (3.1.1)
2011
rake (13.0.6)
21-
regexp_parser (2.8.1)
22-
rexml (3.2.5)
2312
rspec (3.12.0)
2413
rspec-core (~> 3.12.0)
2514
rspec-expectations (~> 3.12.0)
@@ -33,23 +22,7 @@ GEM
3322
diff-lcs (>= 1.2.0, < 2.0)
3423
rspec-support (~> 3.12.0)
3524
rspec-support (3.12.0)
36-
rubocop (1.53.0)
37-
json (~> 2.3)
38-
language_server-protocol (>= 3.17.0)
39-
parallel (~> 1.10)
40-
parser (>= 3.2.2.3)
41-
rainbow (>= 2.2.2, < 4.0)
42-
regexp_parser (>= 1.8, < 3.0)
43-
rexml (>= 3.2.5, < 4.0)
44-
rubocop-ast (>= 1.28.0, < 2.0)
45-
ruby-progressbar (~> 1.7)
46-
unicode-display_width (>= 2.4.0, < 3.0)
47-
rubocop-ast (1.29.0)
48-
parser (>= 3.2.1.0)
49-
ruby-progressbar (1.13.0)
5025
thor (1.2.2)
51-
unicode-display_width (2.4.2)
52-
yard (0.9.34)
5326

5427
PLATFORMS
5528
arm64-darwin-21
@@ -63,8 +36,6 @@ DEPENDENCIES
6336
byebug
6437
rake (~> 13.0)
6538
rspec (~> 3.0)
66-
rubocop
67-
yard
6839

6940
BUNDLED WITH
70-
2.3.14
41+
2.3.26

ruby_3_2.gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ gem 'appraisal'
77
gem 'byebug'
88
gem 'rake', '~> 13.0'
99
gem 'rspec', '~> 3.0'
10-
gem 'rubocop'
11-
gem 'yard'
10+

ruby_3_2.gemfile.lock

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,9 @@ GEM
66
bundler
77
rake
88
thor (>= 0.14.0)
9-
ast (2.4.2)
109
byebug (11.1.3)
1110
diff-lcs (1.5.0)
12-
json (2.6.3)
13-
language_server-protocol (3.17.0.3)
14-
parallel (1.23.0)
15-
parser (3.2.2.3)
16-
ast (~> 2.4.1)
17-
racc
18-
racc (1.7.1)
19-
rainbow (3.1.1)
2011
rake (13.0.6)
21-
regexp_parser (2.8.1)
22-
rexml (3.2.5)
2312
rspec (3.12.0)
2413
rspec-core (~> 3.12.0)
2514
rspec-expectations (~> 3.12.0)
@@ -33,23 +22,7 @@ GEM
3322
diff-lcs (>= 1.2.0, < 2.0)
3423
rspec-support (~> 3.12.0)
3524
rspec-support (3.12.0)
36-
rubocop (1.53.0)
37-
json (~> 2.3)
38-
language_server-protocol (>= 3.17.0)
39-
parallel (~> 1.10)
40-
parser (>= 3.2.2.3)
41-
rainbow (>= 2.2.2, < 4.0)
42-
regexp_parser (>= 1.8, < 3.0)
43-
rexml (>= 3.2.5, < 4.0)
44-
rubocop-ast (>= 1.28.0, < 2.0)
45-
ruby-progressbar (~> 1.7)
46-
unicode-display_width (>= 2.4.0, < 3.0)
47-
rubocop-ast (1.29.0)
48-
parser (>= 3.2.1.0)
49-
ruby-progressbar (1.13.0)
5025
thor (1.2.2)
51-
unicode-display_width (2.4.2)
52-
yard (0.9.34)
5326

5427
PLATFORMS
5528
arm64-darwin-22
@@ -61,8 +34,6 @@ DEPENDENCIES
6134
byebug
6235
rake (~> 13.0)
6336
rspec (~> 3.0)
64-
rubocop
65-
yard
6637

6738
BUNDLED WITH
6839
2.3.26

ruby_3_3.gemfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Needed for github actions: bundle lock --add-platform x86_64-linux
2+
3+
source 'https://rubygems.org'
4+
5+
gem 'amazing_print'
6+
gem 'appraisal'
7+
gem 'byebug'
8+
gem 'rake', '~> 13.0'
9+
gem 'rspec', '~> 3.0'
10+
gem 'rubocop'
11+
gem 'yard'

ruby_3_3.gemfile.lock

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
amazing_print (1.5.0)
5+
appraisal (2.5.0)
6+
bundler
7+
rake
8+
thor (>= 0.14.0)
9+
ast (2.4.2)
10+
byebug (11.1.3)
11+
diff-lcs (1.5.1)
12+
json (2.7.1)
13+
language_server-protocol (3.17.0.3)
14+
parallel (1.24.0)
15+
parser (3.3.0.5)
16+
ast (~> 2.4.1)
17+
racc
18+
racc (1.7.3)
19+
rainbow (3.1.1)
20+
rake (13.1.0)
21+
regexp_parser (2.9.0)
22+
rexml (3.2.6)
23+
rspec (3.13.0)
24+
rspec-core (~> 3.13.0)
25+
rspec-expectations (~> 3.13.0)
26+
rspec-mocks (~> 3.13.0)
27+
rspec-core (3.13.0)
28+
rspec-support (~> 3.13.0)
29+
rspec-expectations (3.13.0)
30+
diff-lcs (>= 1.2.0, < 2.0)
31+
rspec-support (~> 3.13.0)
32+
rspec-mocks (3.13.0)
33+
diff-lcs (>= 1.2.0, < 2.0)
34+
rspec-support (~> 3.13.0)
35+
rspec-support (3.13.1)
36+
rubocop (1.61.0)
37+
json (~> 2.3)
38+
language_server-protocol (>= 3.17.0)
39+
parallel (~> 1.10)
40+
parser (>= 3.3.0.2)
41+
rainbow (>= 2.2.2, < 4.0)
42+
regexp_parser (>= 1.8, < 3.0)
43+
rexml (>= 3.2.5, < 4.0)
44+
rubocop-ast (>= 1.30.0, < 2.0)
45+
ruby-progressbar (~> 1.7)
46+
unicode-display_width (>= 2.4.0, < 3.0)
47+
rubocop-ast (1.31.1)
48+
parser (>= 3.3.0.4)
49+
ruby-progressbar (1.13.0)
50+
thor (1.3.1)
51+
unicode-display_width (2.5.0)
52+
yard (0.9.36)
53+
54+
PLATFORMS
55+
arm64-darwin-22
56+
x86_64-linux
57+
58+
DEPENDENCIES
59+
amazing_print
60+
appraisal
61+
byebug
62+
rake (~> 13.0)
63+
rspec (~> 3.0)
64+
rubocop
65+
yard
66+
67+
BUNDLED WITH
68+
2.3.26

0 commit comments

Comments
 (0)