2019-08-21 07:29:56 +00:00
|
|
|
# Ruby CircleCI 2.0 configuration file
|
|
|
|
#
|
|
|
|
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
|
|
|
#
|
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
docker:
|
|
|
|
# specify the version you desire here
|
2019-11-18 03:37:48 +00:00
|
|
|
- image: circleci/ruby:2.6.5-node-browsers
|
2019-08-21 07:29:56 +00:00
|
|
|
|
|
|
|
# Specify service dependencies here if necessary
|
|
|
|
# CircleCI maintains a library of pre-built images
|
|
|
|
# documented at https://circleci.com/docs/2.0/circleci-images/
|
|
|
|
- image: circleci/postgres:9.4
|
|
|
|
|
|
|
|
working_directory: ~/build
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Which bundler?
|
|
|
|
command: bundle -v
|
|
|
|
|
|
|
|
# Restore bundle cache
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
|
|
|
- chatwoot-bundle-v2-{{ checksum "Gemfile.lock" }}
|
|
|
|
- chatwoot-bundle-v2-
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Bundle Install
|
|
|
|
command: bundle check || bundle install
|
|
|
|
|
2019-11-22 07:23:57 +00:00
|
|
|
- run:
|
|
|
|
name: Bundle audit
|
|
|
|
command: bundle exec bundle audit update && bundle exec bundle audit check -v
|
|
|
|
|
2019-10-21 05:48:47 +00:00
|
|
|
- run:
|
|
|
|
name: Rubocop
|
|
|
|
command: bundle exec rubocop
|
|
|
|
|
2019-08-21 07:29:56 +00:00
|
|
|
# Store bundle cache
|
|
|
|
- save_cache:
|
|
|
|
key: chatwoot-bundle-v2-{{ checksum "Gemfile.lock" }}
|
|
|
|
paths:
|
|
|
|
- vendor/bundle
|
|
|
|
|
|
|
|
# Only necessary if app uses webpacker or yarn in some other way
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
|
|
|
- chatwoot-yarn-{{ checksum "yarn.lock" }}
|
|
|
|
- chatwoot-yarn-
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: yarn
|
|
|
|
command: yarn install --cache-folder ~/.cache/yarn
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: eslint
|
|
|
|
command: yarn run eslint
|
|
|
|
|
2019-10-14 18:48:46 +00:00
|
|
|
- run:
|
|
|
|
name: test
|
|
|
|
command: yarn test
|
2019-08-25 14:29:28 +00:00
|
|
|
|
2019-08-26 03:12:18 +00:00
|
|
|
- run:
|
|
|
|
name: Copy files
|
|
|
|
command: |
|
|
|
|
cp shared/config/database.yml config/database.yml
|
|
|
|
cp shared/config/application.yml config/application.yml
|
2019-08-21 07:29:56 +00:00
|
|
|
|
|
|
|
# Store yarn / webpacker cache
|
|
|
|
- save_cache:
|
|
|
|
key: chatwoot-yarn-{{ checksum "yarn.lock" }}
|
|
|
|
paths:
|
|
|
|
- ~/.cache/yarn
|
|
|
|
|
|
|
|
# Database setup
|
|
|
|
- run: yarn install --check-files
|
|
|
|
- run: bundle exec rake db:create
|
|
|
|
- run: bundle exec rake db:schema:load
|
|
|
|
|
|
|
|
|
|
|
|
# Run rails tests
|
|
|
|
- type: shell
|
|
|
|
command: |
|
2019-08-31 06:41:10 +00:00
|
|
|
bundle exec rspec $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
|
2019-08-21 07:29:56 +00:00
|
|
|
|
|
|
|
# collect reports
|
|
|
|
- store_test_results:
|
|
|
|
path: /tmp/test-results
|
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/test-results
|
|
|
|
destination: test-results
|