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'

0 commit comments

Comments
 (0)