chore: parallel runs in circle (#2810)
- Enable parallel runs in circle Co-authored-by: Tejaswini <tejaswini@chatwoot.com> Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
parent
cf7dac5bab
commit
afe31a3156
2 changed files with 64 additions and 17 deletions
|
@ -15,8 +15,11 @@ defaults: &defaults
|
||||||
- image: cimg/postgres:14.1
|
- image: cimg/postgres:14.1
|
||||||
- image: cimg/redis:6.2.6
|
- image: cimg/redis:6.2.6
|
||||||
environment:
|
environment:
|
||||||
- CC_TEST_REPORTER_ID: b1b5c4447bf93f6f0b06a64756e35afd0810ea83649f03971cbf303b4449456f
|
|
||||||
- RAILS_LOG_TO_STDOUT: false
|
- RAILS_LOG_TO_STDOUT: false
|
||||||
|
- COVERAGE: true
|
||||||
|
- LOG_LEVEL: warn
|
||||||
|
parallelism: 4
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
|
@ -88,6 +91,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar > ~/tmp/openapi-generator-cli-5.3.0.jar
|
curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar > ~/tmp/openapi-generator-cli-5.3.0.jar
|
||||||
java -jar ~/tmp/openapi-generator-cli-5.3.0.jar validate -i swagger/swagger.json
|
java -jar ~/tmp/openapi-generator-cli-5.3.0.jar validate -i swagger/swagger.json
|
||||||
|
|
||||||
# Database setup
|
# Database setup
|
||||||
- run: yarn install --check-files
|
- run: yarn install --check-files
|
||||||
- run: bundle exec rake db:create
|
- run: bundle exec rake db:create
|
||||||
|
@ -113,34 +117,77 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Run backend tests
|
name: Run backend tests
|
||||||
command: |
|
command: |
|
||||||
bundle exec rspec $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) --profile=10 --format documentation
|
mkdir -p ~/tmp/test-results/rspec
|
||||||
~/tmp/cc-test-reporter format-coverage -t simplecov -o ~/tmp/codeclimate.backend.json coverage/backend/.resultset.json
|
mkdir -p ~/tmp/test-artifacts
|
||||||
- persist_to_workspace:
|
mkdir -p coverage
|
||||||
root: ~/tmp
|
~/tmp/cc-test-reporter before-build
|
||||||
paths:
|
TESTFILES=$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
|
||||||
- codeclimate.backend.json
|
bundle exec rspec --profile 10 \
|
||||||
|
--out test-results/rspec/rspec.xml \
|
||||||
|
-- ${TESTFILES}
|
||||||
|
- run:
|
||||||
|
name: Code Climate Test Coverage
|
||||||
|
command: |
|
||||||
|
~/tmp/cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: Run frontend tests
|
name: Run frontend tests
|
||||||
command: |
|
command: |
|
||||||
yarn test:coverage
|
mkdir -p ~/tmp/test-results/frontend_specs
|
||||||
~/tmp/cc-test-reporter format-coverage -t lcov -o ~/tmp/codeclimate.frontend.json buildreports/lcov.info
|
~/tmp/cc-test-reporter before-build
|
||||||
- persist_to_workspace:
|
TESTFILES=$(circleci tests glob **/specs/*.spec.js | circleci tests split --split-by=timings)
|
||||||
root: ~/tmp
|
yarn test:coverage --profile 10 \
|
||||||
paths:
|
--out test-results/frontend_specs/rspec.xml \
|
||||||
- codeclimate.frontend.json
|
-- ${TESTFILES}
|
||||||
|
- run:
|
||||||
|
name: Code Climate Test Coverage
|
||||||
|
command: |
|
||||||
|
~/tmp/cc-test-reporter format-coverage -t lcov -o coverage/codeclimate.frontend_$CIRCLE_NODE_INDEX.json buildreports/lcov.info
|
||||||
|
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: coverage
|
||||||
|
paths:
|
||||||
|
- codeclimate.*.json
|
||||||
# collect reports
|
# collect reports
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: ~/tmp/test-results
|
path: ~/tmp/test-results
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: ~/tmp/test-results
|
path: ~/tmp/test-artifacts
|
||||||
destination: test-results
|
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: log
|
path: log
|
||||||
|
|
||||||
|
upload-coverage:
|
||||||
|
working_directory: ~/build
|
||||||
|
docker:
|
||||||
|
# specify the version you desire here
|
||||||
|
- image: circleci/ruby:3.0.2-node-browsers
|
||||||
|
environment:
|
||||||
|
- CC_TEST_REPORTER_ID: caf26a895e937974a90860cfadfded20891cfd1373a5aaafb3f67406ab9d433f
|
||||||
|
steps:
|
||||||
|
- attach_workspace:
|
||||||
|
at: ~/build
|
||||||
|
- 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
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: ~/tmp
|
||||||
|
paths:
|
||||||
|
- cc-test-reporter
|
||||||
- run:
|
- run:
|
||||||
name: Upload coverage results to Code Climate
|
name: Upload coverage results to Code Climate
|
||||||
command: |
|
command: |
|
||||||
~/tmp/cc-test-reporter sum-coverage ~/tmp/codeclimate.*.json -p 2 -o ~/tmp/codeclimate.total.json
|
~/tmp/cc-test-reporter sum-coverage --output - codeclimate.*.json | ~/tmp/cc-test-reporter upload-coverage --debug --input -
|
||||||
~/tmp/cc-test-reporter upload-coverage -i ~/tmp/codeclimate.total.json
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
commit:
|
||||||
|
jobs:
|
||||||
|
- build
|
||||||
|
- upload-coverage:
|
||||||
|
requires:
|
||||||
|
- build
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
___
|
___
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://codeclimate.com/github/chatwoot/chatwoot/maintainability"><img src="https://api.codeclimate.com/v1/badges/80f9e1a7c72d186289ad/maintainability" alt="Maintainability"></a>
|
<a href="https://codeclimate.com/github/chatwoot/chatwoot/maintainability"><img src="https://api.codeclimate.com/v1/badges/e6e3f66332c91e5a4c0c/maintainability" alt="Maintainability"></a>
|
||||||
<img src="https://img.shields.io/circleci/build/github/chatwoot/chatwoot" alt="CircleCI Badge">
|
<img src="https://img.shields.io/circleci/build/github/chatwoot/chatwoot" alt="CircleCI Badge">
|
||||||
<a href="https://hub.docker.com/r/chatwoot/chatwoot/"><img src="https://img.shields.io/docker/pulls/chatwoot/chatwoot" alt="Docker Pull Badge"></a>
|
<a href="https://hub.docker.com/r/chatwoot/chatwoot/"><img src="https://img.shields.io/docker/pulls/chatwoot/chatwoot" alt="Docker Pull Badge"></a>
|
||||||
<a href="https://hub.docker.com/r/chatwoot/chatwoot/"><img src="https://img.shields.io/docker/cloud/build/chatwoot/chatwoot" alt="Docker Build Badge"></a>
|
<a href="https://hub.docker.com/r/chatwoot/chatwoot/"><img src="https://img.shields.io/docker/cloud/build/chatwoot/chatwoot" alt="Docker Build Badge"></a>
|
||||||
|
|
Loading…
Reference in a new issue