diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index e9e2e7a..1d5c3f2 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -13,10 +13,15 @@ jobs: BUNDLE_JOBS: 4 BUNDLE_RETRY: 3 CI: true + COVERAGE: ${{ matrix.coverage }} strategy: fail-fast: false matrix: ruby: ["2.7", "3.0", "3.1"] + coverage: ["false"] + include: + - ruby: "3.2" + coverage: "true" steps: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 @@ -26,3 +31,9 @@ jobs: - name: Run RSpec run: | bundle exec rspec + - name: Coveralls + if: ${{ matrix.coverage == 'true' }} + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + coveralls-endpoint: ${{ secrets.COVERALLS_ENDPOINT }} diff --git a/Gemfile b/Gemfile index b0feda1..efd3d42 100644 --- a/Gemfile +++ b/Gemfile @@ -14,3 +14,8 @@ local_gemfile = "#{File.dirname(__FILE__)}/Gemfile.local" if File.exist?(local_gemfile) eval(File.read(local_gemfile)) # rubocop:disable Security/Eval end + +if ENV["COVERAGE"] == "true" + gem "simplecov" + gem "simplecov-lcov" +end diff --git a/LICENSE.txt b/LICENSE.txt index a37e096..a3654d9 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 Vladimir Dementyev, Ruslan Shakirov +Copyright (c) 2021-2023 Vladimir Dementyev, Ruslan Shakirov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c38f474..a83c9f9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,17 @@ # frozen_string_literal: true +if ENV["COVERAGE"] == "true" + require "simplecov" + require "simplecov-lcov" + SimpleCov::Formatter::LcovFormatter.config do |c| + c.report_with_single_file = true + c.single_report_path = "coverage/lcov.info" + end + + SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter + SimpleCov.start +end + require "debug" unless ENV["CI"] require "active_support"