From 8fb84554b5b3a2db72921105564f83a2197b83ce Mon Sep 17 00:00:00 2001 From: Dani Smith Date: Tue, 11 Jun 2024 10:25:22 +0200 Subject: [PATCH] Add coverage (#18) * add coverage * add coveralls * add coveralls action to workflow * add badges * fix newline --- .github/workflows/ruby.yml | 6 ++++++ Gemfile | 7 ++++++- README.md | 2 ++ test/test_helper.rb | 8 ++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index e7903c0..207e57c 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -25,12 +25,18 @@ jobs: - uses: actions/checkout@v2 with: submodules: true + - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true # install and cache dependencies + - name: Build parser run: bundle exec racc lib/kdl/kdl.yy + - name: Run tests run: bundle exec rake test + + - name: Report Coveralls + uses: coverallsapp/github-action@v2 diff --git a/Gemfile b/Gemfile index 6cc8aab..a5184be 100644 --- a/Gemfile +++ b/Gemfile @@ -4,4 +4,9 @@ source "https://rubygems.org" gemspec gem "rake", "~> 12.0" -gem "minitest", "~> 5.0" + +group :test do + gem "minitest", "~> 5.0" + gem "simplecov", require: false + gem "coveralls_reborn", require: false +end diff --git a/README.md b/README.md index 41aac2c..3c6bc6b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # KDL +[![Gem Version](https://badge.fury.io/rb/kdl.svg)](https://badge.fury.io/rb/kdl) [![Actions Status](https://github.com/danini-the-panini/kdl-rb/workflows/Ruby/badge.svg)](https://github.com/danini-the-panini/kdl-rb/actions) +[![Coverage Status](https://coveralls.io/repos/github/danini-the-panini/kdl-rb/badge.svg?branch=main)](https://coveralls.io/github/danini-the-panini/kdl-rb?branch=main) This is a Ruby implementation of the [KDL Document Language](https://kdl.dev) diff --git a/test/test_helper.rb b/test/test_helper.rb index d2e7e6f..ebac34b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,11 @@ +require "simplecov" +require "coveralls" +SimpleCov.formatters = [ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter +] +SimpleCov.start + $LOAD_PATH.unshift File.expand_path("../lib", __dir__) require "kdl"