Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,3 @@ jobs:
- name: Run test
run: bundle exec rake test
timeout-minutes: 5 # _should_ finish in under a minute

- uses: joshmfrankel/simplecov-check-action@main
if: ${{ matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request' &&
!startsWith(matrix.ruby, 'truffleruby') && !startsWith(matrix.ruby, 'jruby') }}
with:
check_job_name: "SimpleCov - ${{ matrix.ruby }}"
minimum_suite_coverage: 90
minimum_file_coverage: 40 # TODO: increase this after switching to SASL::AuthenticationExchange
github_token: ${{ secrets.GITHUB_TOKEN }}
97 changes: 97 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::JSONFormatter,
]

SimpleCov.configure do
command_name "Net::IMAP tests"
enable_coverage :branch
enable_coverage :method
enable_coverage :eval
primary_coverage :branch

skip "/test/"
skip "/rakelib/"
cover "lib/**/*.rb"

group "Parser", %w[lib/net/imap/response_parser.rb
lib/net/imap/response_parser]

group "Client", %w[lib/net/imap.rb
lib/net/imap/connection_state.rb
lib/net/imap/deprecated_client_options.rb
lib/net/imap/errors.rb
lib/net/imap/response_reader.rb]

group "Config", %w[lib/net/imap/config.rb
lib/net/imap/config]

group "Data Types", %w[lib/net/imap/flags.rb
lib/net/imap/sequence_set.rb] +
[%r{lib/net/imap/\w*_data\.rb},
%r{lib/net/imap/\w*_result.rb},
%r{lib/net/imap/data_\w+\.rb}]

group "SASL", %w[lib/net/imap/sasl.rb
lib/net/imap/sasl
lib/net/imap/sasl_adapter.rb
lib/net/imap/authenticators.rb]

group "StringPrep", %w[lib/net/imap/stringprep.rb
lib/net/imap/stringprep]

if ENV.fetch("SIMPLECOV_DISABLE_MINIMUM_COVERAGE", "") == ""
coverage(:line) do
minimum 95

minimum_per_group 98, only: "Config"
minimum_per_group 97, only: "StringPrep"
minimum_per_group 97, only: "SASL"
minimum_per_group 95, only: "Data Types"
minimum_per_group 94, only: "Parser"
minimum_per_group 92, only: "Client"

minimum_per_file 90
minimum_per_file 87, only: "lib/net/imap/sasl/authenticators.rb"
minimum_per_file 86, only: "lib/net/imap/config/attr_type_coercion.rb"
minimum_per_file 84, only: "lib/net/imap/authenticators.rb"
minimum_per_file 80, only: "lib/net/imap/response_data.rb"
minimum_per_file 55, only: "lib/net/imap/search_result.rb"
end

coverage(:branch) do
minimum 80

minimum_per_group 92, only: "Data Types"
minimum_per_group 87, only: "Config"
minimum_per_group 83, only: "Client"
minimum_per_group 81, only: "Parser"
minimum_per_group 76, only: "SASL"
minimum_per_group 73, only: "StringPrep"

minimum_per_file 65
minimum_per_file 62, only: "lib/net/imap/sasl/scram_authenticator.rb"
minimum_per_file 50, only: "lib/net/imap/sasl/authenticators.rb"
minimum_per_file 50, only: "lib/net/imap/config/attr_accessors.rb"
end

coverage(:method) do
minimum 88

minimum_per_group 100, only: "Config"
minimum_per_group 92, only: "Data Types"
minimum_per_group 90, only: "StringPrep"
minimum_per_group 88, only: "Client"
minimum_per_group 83, only: "Parser"
minimum_per_group 82, only: "SASL"

minimum_per_file 66
minimum_per_file 64, only: "lib/net/imap/response_parser/parser_utils.rb"
minimum_per_file 57, only: "lib/net/imap/sasl/authenticators.rb"
minimum_per_file 50, only: "lib/net/imap/authenticators.rb"
minimum_per_file 50, only: "lib/net/imap/sasl/anonymous_authenticator.rb"
minimum_per_file 36, only: "lib/net/imap/sasl/protocol_adapters.rb"
minimum_per_file 20, only: "lib/net/imap/response_data.rb"
end
end
end
27 changes: 1 addition & 26 deletions test/lib/helper.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
if !(ENV["SIMPLECOV_DISABLE"] in /\A(1|y(es)?|t(rue)?)\z/i) &&
RUBY_ENGINE == "ruby" # C Ruby only

require "simplecov"

SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::JSONFormatter,
]

SimpleCov.start do
command_name "Net::IMAP tests"
enable_coverage :branch
primary_coverage :branch
enable_coverage_for_eval

add_filter "/test/"
add_filter "/rakelib/"

add_group "Parser", %w[lib/net/imap/response_parser.rb
lib/net/imap/response_parser]
add_group "Config", %w[lib/net/imap/config.rb
lib/net/imap/config]
add_group "SASL", %w[lib/net/imap/sasl.rb
lib/net/imap/sasl
lib/net/imap/authenticators.rb]
add_group "StringPrep", %w[lib/net/imap/stringprep.rb
lib/net/imap/stringprep]
end
SimpleCov.start
end

require "test/unit"
Expand Down
Loading