Skip to content

Commit

Permalink
Merge pull request #1 from blarosen95/test/coverage
Browse files Browse the repository at this point in the history
Adds coverage reporting for Coveralls
  • Loading branch information
blarosen95 committed Nov 10, 2022
2 parents 3d50e4e + 3166180 commit 24c6b9e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
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

0 comments on commit 24c6b9e

Please sign in to comment.