Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds coverage reporting for Coveralls #1

Merged
merged 9 commits into from
Nov 10, 2022
29 changes: 29 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on: pull_request

name: Test Coveralls

jobs:

build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Checkout copy
uses: actions/checkout@v3
- name: Install system dependencies for gem
run: sudo apt -y install poppler-utils tesseract-ocr
- name: Add OEM english LSTM model
run: sudo wget https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata -O $(sudo find /usr -name tessdata -type d)/eng.traineddata
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install dependencies
run: bundle install
- name: Run tests
run: bundle exec rspec
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ source "https://rubygems.org"
# Specify your gem's dependencies in ocr4pdf.gemspec
gemspec

gem "simplecov", ">= 0.18.1", "< 0.22.0"
gem "simplecov-lcov", "~> 0.8.0"

gem "rake", "~> 13.0"

gem "rspec", "~> 3.0"
Expand Down
18 changes: 18 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# frozen_string_literal: true

require "simplecov"

SimpleCov.start do
require "simplecov-lcov"

SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = "coverage/lcov.info"
end

formatter SimpleCov::Formatter::LcovFormatter

add_filter do |source_file|
source_file.filename.include?("spec") && !source_file.filename.include?("fixture")
end
add_filter %r{/.bundle/}
end

require "ocr4pdf"

RSpec.configure do |config|
Expand Down