Skip to content
Snippets Groups Projects
Unverified Commit 5438346d authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

circle + coverage

parent 5fa730ea
No related branches found
No related tags found
No related merge requests found
version: 2
jobs:
build:
docker:
- image: cimg/ruby:3.1.3-node
environment:
RAILS_ENV: test
RACK_ENV: test
PGHOST: localhost
PGUSER: osuny
- image: cimg/postgres:14.4
environment:
POSTGRES_PASSWORD: ""
POSTGRES_USER: osuny
POSTGRES_DB: osuny_test
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# Install binaries for Active Storage Previews
- run:
name: Install binaries for Active Storage Previews
command: |
sudo apt-get update
sudo apt-get install ffmpeg poppler-utils -y
# Bundler configuration
- run:
name: Configure Bundler
command: |
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
source $BASH_ENV
gem install bundler
# Restore yarn cache
- restore_cache:
keys:
- app-yarn-{{ checksum "yarn.lock" }}
# Install gem dependencies
- run:
name: install dependencies
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
# Install yarn dependencies
- run: bin/yarn install
# Store bundle cache
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
# Store yarn cache
- save_cache:
paths:
- ~/.yarn-cache
key: app-yarn-{{ checksum "yarn.lock" }}
# Database setup
- run: bundle exec rake db:create db:schema:load
# Code Climate setup
- run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- run: chmod +x ./cc-test-reporter
# run tests!
- run:
name: run tests
command: |
bundle exec rake test $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)
# CodeClimate coverage
- run: ./cc-test-reporter format-coverage --output "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
- deploy:
command: |
./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --input -
\ No newline at end of file
......@@ -45,3 +45,6 @@ yarn-debug.log*
# Ignore db dump
/db/latest.dump
# Ignore coverage report
coverage
\ No newline at end of file
......@@ -78,6 +78,7 @@ group :test do
gem 'capybara', '>= 3.26'
gem 'selenium-webdriver'
gem 'webdrivers'
gem "simplecov", require: false
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
......@@ -172,6 +172,7 @@ GEM
warden (~> 1.2.3)
devise-i18n (1.10.2)
devise (>= 4.8.0)
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
encryptor (3.0.0)
......@@ -436,6 +437,12 @@ GEM
simple_form_password_with_hints (0.0.7)
rails
simple_form
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sinatra (3.0.4)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
......@@ -558,6 +565,7 @@ DEPENDENCIES
simple_form
simple_form_bs5_file_input
simple_form_password_with_hints
simplecov
spring
sprockets-rails (~> 3.4)
summernote-rails!
......
require 'simplecov'
SimpleCov.start 'rails'
ENV['RAILS_ENV'] ||= 'test'
require_relative "../config/environment"
require "rails/test_help"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment