Skip to content

Commit

Permalink
⚗️ Try to get simplecov workflow permissions right
Browse files Browse the repository at this point in the history
  • Loading branch information
nevans committed Oct 8, 2024
1 parent 65c9f43 commit eda724f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 25 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:

build:
needs: ruby-versions
permissions:
contents: read
checks: write
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
strategy:
matrix:
Expand All @@ -29,3 +32,11 @@ jobs:
rubygems: 3.5.14
- name: Run test
run: bundle exec rake test

- uses: joshmfrankel/simplecov-check-action@main
if: contains(matrix.os, 'ubuntu')
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 }}
23 changes: 0 additions & 23 deletions .simplecov

This file was deleted.

9 changes: 7 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ gem "rdoc"
gem "test-unit"
gem "test-unit-ruby-core", git: "https://github.com/ruby/test-unit-ruby-core"

gem "benchmark-driver"
gem "simplecov"
gem "benchmark-driver", require: false

group :test do
gem "simplecov", require: false
gem "simplecov-html", require: false
gem "simplecov-json", require: false
end
27 changes: 27 additions & 0 deletions test/lib/helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
require "simplecov"

# Cannot use ".simplecov" file: simplecov-json triggers a circular require.
require "simplecov-json"
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
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
require "test/unit"
require "core_assertions"

Expand Down

0 comments on commit eda724f

Please sign in to comment.