Skip to content

Commit

Permalink
chore: fix test coverage (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
saiqulhaq authored Nov 6, 2021
1 parent 63da574 commit f237cd6
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 10 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Audit

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
audit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Ruby and install gems
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
with:
ruby-version: 2.7
bundler-cache: true
- name: Run security checks
run: |
bin/bundler-audit --update
32 changes: 32 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test Coverage

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
with:
ruby-version: 2.7
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Install cc-test-reporter and prebuild notification
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Run tests
env:
COVERAGE: 1
run: bundle exec rspec
- name: CodeClimate Post-build upload
env:
CC_TEST_REPORTER_ID: 945dfb58a832d233a3caeb84e3e6d3be212e8c7abcb48117fce63b9adcb43647
run: ./cc-test-reporter -d -t simplecov after-build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Ruby
name: Test

on:
- push
Expand All @@ -14,9 +14,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
with:
ruby-version: ${{ matrix.ruby-version }}
Expand Down
14 changes: 10 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
bundle-audit (0.1.0)
bundler-audit
bundler-audit (0.9.0.1)
bundler (>= 1.2.0, < 3)
thor (~> 1.0)
coderay (1.1.3)
diff-lcs (1.3)
docile (1.3.0)
diff-lcs (1.4.4)
docile (1.4.0)
ffi (1.15.4)
formatador (0.3.0)
guard (2.18.0)
Expand Down Expand Up @@ -77,7 +82,7 @@ GEM
rubocop (~> 1.19)
ruby-progressbar (1.11.0)
shellany (0.0.1)
simplecov (0.16.1)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
Expand All @@ -89,6 +94,7 @@ PLATFORMS
ruby

DEPENDENCIES
bundle-audit
bundler (>= 2.2.30)
case_transform2!
guard
Expand All @@ -98,7 +104,7 @@ DEPENDENCIES
rspec (~> 3.7.0)
rubocop (~> 1.22)
rubocop-rspec
simplecov (~> 0.16.1)
simplecov (~> 0.17.1)

BUNDLED WITH
2.2.30
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# case_transform2

[![Build Status](https://travis-ci.org/saiqulhaq/case_transform.svg?branch=master)](https://travis-ci.org/saiqulhaq/case_transform)
![Test Workflow](https://github.com/saiqulhaq/case_transform/actions/workflows/github-actions.yml/badge.svg)
[![Test Coverage](https://api.codeclimate.com/v1/badges/0050890b14e7f9165680/test_coverage)](https://codeclimate.com/github/saiqulhaq/case_transform/test_coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/0050890b14e7f9165680/maintainability)](https://codeclimate.com/github/saiqulhaq/case_transform/maintainability)

Expand Down
29 changes: 29 additions & 0 deletions bin/brakeman
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'brakeman' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path('bundle', __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('brakeman', 'brakeman')
29 changes: 29 additions & 0 deletions bin/bundler-audit
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'bundler-audit' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path('bundle', __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('bundler-audit', 'bundler-audit')
3 changes: 2 additions & 1 deletion case_transform2.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Gem::Specification.new do |s|

s.test_files = s.files.grep(%r{^(test|spec|features)/})

s.add_development_dependency 'bundle-audit'
s.add_development_dependency 'bundler', '>= 2.2.30'
s.add_development_dependency 'guard'
s.add_development_dependency 'guard-rspec'
Expand All @@ -34,5 +35,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rspec', '~> 3.7.0'
s.add_development_dependency 'rubocop', '~> 1.22'
s.add_development_dependency 'rubocop-rspec'
s.add_development_dependency 'simplecov', '~> 0.16.1'
s.add_development_dependency 'simplecov', '~> 0.17.1'
end

0 comments on commit f237cd6

Please sign in to comment.