Skip to content

Commit

Permalink
[types/ci] simplecov + rspec-retry
Browse files Browse the repository at this point in the history
  • Loading branch information
0exp committed Dec 2, 2024
1 parent f4bbb87 commit 5526aea
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
- (steep + rbs) officialy supported `RBS` with a `Steep` integration that works
in **strict mode** (see `sig` directory, `Steepfile` config, `sig/manifest.yml` and `rbs_collection.yml` for dependencies);
- Added `TypeCheck` step to CI/CD;
- Test coverage checks (via `simplecov` with `html` and `lcov` formats).
Temporary locked on `~95%` and without CI integration cuz we need to refactor tests in first;
- CI: `rspec-retry` is temporary added until the tests are fully refactored;

## [1.12.1]
### Changed
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ gem 'pry', require: false
gem 'rake', require: false
gem 'rbs', require: false
gem 'rspec', require: false
gem 'rspec-retry', require: false # NOTE: temporary decision for non-refactored tests
gem 'simplecov', require: false
gem 'simplecov-lcov', require: false
gem 'steep', require: false
13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ GEM
connection_pool (2.4.1)
csv (3.3.0)
diff-lcs (1.5.1)
docile (1.4.1)
drb (2.2.1)
ffi (1.17.0)
ffi (1.17.0-aarch64-linux-gnu)
Expand Down Expand Up @@ -94,6 +95,8 @@ GEM
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-support (3.13.1)
rubocop (1.68.0)
json (~> 2.3)
Expand Down Expand Up @@ -128,6 +131,13 @@ GEM
rubocop-rspec (~> 3, >= 3.0.1)
ruby-progressbar (1.13.0)
securerandom (0.4.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.1)
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
steep (1.8.3)
activesupport (>= 5.1)
concurrent-ruby (>= 1.1.10)
Expand Down Expand Up @@ -173,6 +183,9 @@ DEPENDENCIES
rbs
redis_queued_locks!
rspec
rspec-retry
simplecov
simplecov-lcov
steep

BUNDLED WITH
Expand Down
2 changes: 1 addition & 1 deletion spec/redis_queued_locks_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# NOTE:
# - these specs will be totally reworked;
# - these specs will be totally reworked (this is a reason of using rspec-retry);
# - this code is not ideal and final,
# it is written only for behavior testing and funcionality checking;
RSpec.describe RedisQueuedLocks do
Expand Down
25 changes: 25 additions & 0 deletions spec/setup_simplecov.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

require 'simplecov'
require 'simplecov-lcov'

SimpleCov::Formatter::LcovFormatter.config do |config|
config.report_with_single_file = true
config.output_directory = 'coverage'
config.lcov_file_name = 'lcov.info'
end

SimpleCov.configure do
enable_coverage :line
enable_coverage :branch
primary_coverage :line

# NOTE: temporary percents which are based on non-refactored tests
minimum_coverage line: 93, branch: 69 # TODO: { line: 100, branch: 100 }

formatter SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::LcovFormatter
])
add_filter '/spec/'
end
13 changes: 11 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# frozen_string_literal: true

require 'redis_queued_locks'
require_relative 'setup_simplecov'

SimpleCov.start

require 'rspec/retry'
require 'pry'
require 'securerandom'
require 'redis_queued_locks'

RSpec.configure do |config|
# NOTE: (github-ci) (rspec-retry) temporary decision for non-refactored tests
config.verbose_retry = true # (rspec-retry)
config.display_try_failure_messages = true # (rspec-retry)
config.default_retry_count = 5 # (rsec-retry)

Kernel.srand config.seed
config.order = :random
config.filter_run_when_matching :focus
Expand Down

0 comments on commit 5526aea

Please sign in to comment.