Skip to content

Commit

Permalink
Merge pull request #68 from RAR1741/add_cc_coverage
Browse files Browse the repository at this point in the history
Add CodeClimate coverage
  • Loading branch information
dracco1993 authored May 15, 2024
2 parents c210902 + f8f3df9 commit 0c4e0cb
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [ master ]

jobs:
test:
run-rspec-tests:
runs-on: ubuntu-latest

services:
Expand Down Expand Up @@ -38,14 +38,30 @@ jobs:
ruby-version: .ruby-version
bundler-cache: true

- name: Setup Code Climate test-reporter
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
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:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432
# REDIS_URL: redis://localhost:6379/0
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
run: bin/rails spec
# run: bin/rails db:test:prepare spec

- name: Publish code coverage
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
run: |
export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
./cc-test-reporter after-build --coverage-input-type simplecov
# - name: Keep screenshots from failed system tests
# uses: actions/upload-artifact@v4
# if: failure()
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

# Other random stuff
spec/examples.txt
coverage/*
!coverage/.keep

/app/assets/builds/*
!/app/assets/builds/.keep
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ group :development, :test do
gem "rspec-rails", "~> 6.1.0"

gem "fuubar"

gem "simplecov"
end

group :development do
Expand Down
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ GEM
irb (~> 1.10)
reline (>= 0.3.8)
diff-lcs (1.5.1)
docile (1.4.0)
drb (2.2.1)
erubi (1.12.0)
foreman (0.88.1)
Expand Down Expand Up @@ -269,6 +270,12 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
Expand Down Expand Up @@ -339,6 +346,7 @@ DEPENDENCIES
rubocop-rails
rubocop-rspec
selenium-webdriver
simplecov
sprockets-rails
stimulus-rails
tailwindcss-rails
Expand Down
Empty file added coverage/.keep
Empty file.
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration

require "capybara/rspec"
require "simplecov"
SimpleCov.start

RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
Expand Down
14 changes: 14 additions & 0 deletions spec/system/system_spec.rb
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
require "rails_helper"

# RSpec.describe "Homepage" do
# it "passes" do
# visit root_path

# expect(page).to have_content "Hello world!"
# end

# it "fails (and takes a screenshot)" do
# visit root_path

# expect(page).to have_no_content "Hello world!"
# end
# end

0 comments on commit 0c4e0cb

Please sign in to comment.