mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-29 10:12:34 +00:00
ci(circleci): switch coverage reporting to Qlty orb (#12337)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
version: 2.1
|
version: 2.1
|
||||||
orbs:
|
orbs:
|
||||||
node: circleci/node@6.1.0
|
node: circleci/node@6.1.0
|
||||||
|
qlty-orb: qltysh/qlty-orb@0.0
|
||||||
|
|
||||||
defaults: &defaults
|
defaults: &defaults
|
||||||
working_directory: ~/build
|
working_directory: ~/build
|
||||||
@@ -89,14 +90,6 @@ jobs:
|
|||||||
command: |
|
command: |
|
||||||
source ~/.rvm/scripts/rvm
|
source ~/.rvm/scripts/rvm
|
||||||
bundle install
|
bundle install
|
||||||
# pnpm install
|
|
||||||
|
|
||||||
- run:
|
|
||||||
name: Download cc-test-reporter
|
|
||||||
command: |
|
|
||||||
mkdir -p ~/tmp
|
|
||||||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ~/tmp/cc-test-reporter
|
|
||||||
chmod +x ~/tmp/cc-test-reporter
|
|
||||||
|
|
||||||
# Swagger verification
|
# Swagger verification
|
||||||
- run:
|
- run:
|
||||||
@@ -108,10 +101,11 @@ jobs:
|
|||||||
echo "ERROR: The swagger.json file is not in sync with the yaml specification. Run 'rake swagger:build' and commit 'swagger/swagger.json'."
|
echo "ERROR: The swagger.json file is not in sync with the yaml specification. Run 'rake swagger:build' and commit 'swagger/swagger.json'."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
mkdir -p ~/tmp
|
||||||
curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar > ~/tmp/openapi-generator-cli-6.3.0.jar
|
curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar > ~/tmp/openapi-generator-cli-6.3.0.jar
|
||||||
java -jar ~/tmp/openapi-generator-cli-6.3.0.jar validate -i swagger/swagger.json
|
java -jar ~/tmp/openapi-generator-cli-6.3.0.jar validate -i swagger/swagger.json
|
||||||
|
|
||||||
# we remove the FRONTED_URL from the .env before running the tests
|
# Configure environment and database
|
||||||
- run:
|
- run:
|
||||||
name: Database Setup and Configure Environment Variables
|
name: Database Setup and Configure Environment Variables
|
||||||
command: |
|
command: |
|
||||||
@@ -149,17 +143,11 @@ jobs:
|
|||||||
command: pnpm run eslint
|
command: pnpm run eslint
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: Run frontend tests
|
name: Run frontend tests (with coverage)
|
||||||
command: |
|
command: |
|
||||||
mkdir -p ~/build/coverage/frontend
|
mkdir -p ~/build/coverage/frontend
|
||||||
~/tmp/cc-test-reporter before-build
|
|
||||||
pnpm run test:coverage
|
pnpm run test:coverage
|
||||||
|
|
||||||
- run:
|
|
||||||
name: Code Climate Test Coverage (Frontend)
|
|
||||||
command: |
|
|
||||||
~/tmp/cc-test-reporter format-coverage -t lcov -o "~/build/coverage/frontend/codeclimate.frontend_$CIRCLE_NODE_INDEX.json"
|
|
||||||
|
|
||||||
# Run backend tests
|
# Run backend tests
|
||||||
- run:
|
- run:
|
||||||
name: Run backend tests
|
name: Run backend tests
|
||||||
@@ -167,18 +155,18 @@ jobs:
|
|||||||
mkdir -p ~/tmp/test-results/rspec
|
mkdir -p ~/tmp/test-results/rspec
|
||||||
mkdir -p ~/tmp/test-artifacts
|
mkdir -p ~/tmp/test-artifacts
|
||||||
mkdir -p ~/build/coverage/backend
|
mkdir -p ~/build/coverage/backend
|
||||||
~/tmp/cc-test-reporter before-build
|
|
||||||
TESTFILES=$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
|
TESTFILES=$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
|
||||||
bundle exec rspec --format progress \
|
bundle exec rspec -I ./spec --require coverage_helper --require spec_helper --format progress \
|
||||||
--format RspecJunitFormatter \
|
--format RspecJunitFormatter \
|
||||||
--out ~/tmp/test-results/rspec.xml \
|
--out ~/tmp/test-results/rspec.xml \
|
||||||
-- ${TESTFILES}
|
-- ${TESTFILES}
|
||||||
no_output_timeout: 30m
|
no_output_timeout: 30m
|
||||||
|
|
||||||
- run:
|
# Qlty coverage publish
|
||||||
name: Code Climate Test Coverage (Backend)
|
- qlty-orb/coverage_publish:
|
||||||
command: |
|
files: |
|
||||||
~/tmp/cc-test-reporter format-coverage -t simplecov -o "~/build/coverage/backend/codeclimate.$CIRCLE_NODE_INDEX.json"
|
coverage/coverage.json
|
||||||
|
coverage/lcov.info
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: List coverage directory contents
|
name: List coverage directory contents
|
||||||
@@ -189,3 +177,7 @@ jobs:
|
|||||||
root: ~/build
|
root: ~/build
|
||||||
paths:
|
paths:
|
||||||
- coverage
|
- coverage
|
||||||
|
|
||||||
|
- store_artifacts:
|
||||||
|
path: coverage
|
||||||
|
destination: coverage
|
||||||
|
|||||||
3
Gemfile
3
Gemfile
@@ -227,6 +227,7 @@ group :test do
|
|||||||
gem 'webmock'
|
gem 'webmock'
|
||||||
# test profiling
|
# test profiling
|
||||||
gem 'test-prof'
|
gem 'test-prof'
|
||||||
|
gem 'simplecov_json_formatter', require: false
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
@@ -251,7 +252,7 @@ group :development, :test do
|
|||||||
gem 'rubocop-factory_bot', require: false
|
gem 'rubocop-factory_bot', require: false
|
||||||
gem 'seed_dump'
|
gem 'seed_dump'
|
||||||
gem 'shoulda-matchers'
|
gem 'shoulda-matchers'
|
||||||
gem 'simplecov', '0.17.1', require: false
|
gem 'simplecov', '>= 0.21', require: false
|
||||||
gem 'spring'
|
gem 'spring'
|
||||||
gem 'spring-watcher-listen'
|
gem 'spring-watcher-listen'
|
||||||
end
|
end
|
||||||
|
|||||||
16
Gemfile.lock
16
Gemfile.lock
@@ -219,7 +219,7 @@ GEM
|
|||||||
diff-lcs (1.5.1)
|
diff-lcs (1.5.1)
|
||||||
digest-crc (0.6.5)
|
digest-crc (0.6.5)
|
||||||
rake (>= 12.0.0, < 14.0.0)
|
rake (>= 12.0.0, < 14.0.0)
|
||||||
docile (1.4.0)
|
docile (1.4.1)
|
||||||
domain_name (0.5.20190701)
|
domain_name (0.5.20190701)
|
||||||
unf (>= 0.0.5, < 1.0.0)
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
dotenv (3.1.2)
|
dotenv (3.1.2)
|
||||||
@@ -447,7 +447,7 @@ GEM
|
|||||||
rails-dom-testing (>= 1, < 3)
|
rails-dom-testing (>= 1, < 3)
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
json (2.12.0)
|
json (2.13.2)
|
||||||
json_refs (0.1.8)
|
json_refs (0.1.8)
|
||||||
hana
|
hana
|
||||||
json_schemer (0.2.24)
|
json_schemer (0.2.24)
|
||||||
@@ -857,11 +857,12 @@ GEM
|
|||||||
faraday (>= 0.17.5, < 3.a)
|
faraday (>= 0.17.5, < 3.a)
|
||||||
jwt (>= 1.5, < 3.0)
|
jwt (>= 1.5, < 3.0)
|
||||||
multi_json (~> 1.10)
|
multi_json (~> 1.10)
|
||||||
simplecov (0.17.1)
|
simplecov (0.22.0)
|
||||||
docile (~> 1.1)
|
docile (~> 1.1)
|
||||||
json (>= 1.8, < 3)
|
simplecov-html (~> 0.11)
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov_json_formatter (~> 0.1)
|
||||||
simplecov-html (0.10.2)
|
simplecov-html (0.13.2)
|
||||||
|
simplecov_json_formatter (0.1.4)
|
||||||
slack-ruby-client (2.5.2)
|
slack-ruby-client (2.5.2)
|
||||||
faraday (>= 2.0)
|
faraday (>= 2.0)
|
||||||
faraday-mashify
|
faraday-mashify
|
||||||
@@ -1085,7 +1086,8 @@ DEPENDENCIES
|
|||||||
sidekiq (>= 7.3.1)
|
sidekiq (>= 7.3.1)
|
||||||
sidekiq-cron (>= 1.12.0)
|
sidekiq-cron (>= 1.12.0)
|
||||||
sidekiq_alive
|
sidekiq_alive
|
||||||
simplecov (= 0.17.1)
|
simplecov (>= 0.21)
|
||||||
|
simplecov_json_formatter
|
||||||
slack-ruby-client (~> 2.5.2)
|
slack-ruby-client (~> 2.5.2)
|
||||||
spring
|
spring
|
||||||
spring-watcher-listen
|
spring-watcher-listen
|
||||||
|
|||||||
8
spec/coverage_helper.rb
Normal file
8
spec/coverage_helper.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
require 'simplecov'
|
||||||
|
require 'simplecov_json_formatter'
|
||||||
|
|
||||||
|
# Configure SimpleCov to emit JSON for Qlty and HTML locally if needed
|
||||||
|
SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
|
||||||
|
SimpleCov.start 'rails' do
|
||||||
|
SimpleCov.coverage_dir 'coverage'
|
||||||
|
end
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
require 'simplecov'
|
|
||||||
require 'webmock/rspec'
|
require 'webmock/rspec'
|
||||||
|
|
||||||
SimpleCov.start 'rails'
|
|
||||||
WebMock.disable_net_connect!(allow_localhost: true)
|
WebMock.disable_net_connect!(allow_localhost: true)
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
ENV['RAILS_ENV'] ||= 'test'
|
ENV['RAILS_ENV'] ||= 'test'
|
||||||
require 'simplecov'
|
|
||||||
SimpleCov.start 'rails'
|
|
||||||
|
|
||||||
require File.expand_path('../config/environment', __dir__)
|
require File.expand_path('../config/environment', __dir__)
|
||||||
require 'rails/test_help'
|
require 'rails/test_help'
|
||||||
|
|||||||
Reference in New Issue
Block a user