.circleci/config.yml
version: 2.1
orbs:
browser-tools: circleci/browser-tools@1.2.3
node: circleci/node@5.0.0
jobs:
build:
parallelism: 1
docker:
- image: cimg/ruby:3.3.5-browsers
environment:
BUNDLE_JOBS: 3
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
PGHOST: 127.0.0.1
PGUSER: postgres
RACK_ENV: test
RAILS_ENV: test
- image: cimg/postgres:10.18
environment:
POSTGRES_USER: postgres
POSTGRES_DB: app_test
POSTGRES_PASSWORD:
working_directory: ~/app
steps:
- checkout
- browser-tools/install-browser-tools:
install-chrome: false
install-chromedriver: false
# - node/install:
# node-version: 16.13.1
# install-yarn: true
- run:
name: Which bundler?
command: bundle -v
# https://circleci.com/docs/2.0/caching/
- restore_cache:
keys:
- bundle-v1-{{ checksum "Gemfile.lock" }}
- bundle-v1-
- run: # Install Ruby dependencies
name: Bundle Install
command: |
bundle config set --local frozen 'true'
bundle install
bundle clean
- save_cache:
key: bundle-v1-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
# - restore_cache:
# keys:
# - yarn-{{ checksum "yarn.lock" }}
# - yarn-
# - run:
# name: Yarn Install
# command: yarn install --cache-folder ~/.cache/yarn
# - save_cache:
# key: yarn-{{ checksum "yarn.lock" }}
# paths:
# - ~/.cache/yarn
- run:
name: Wait for DB
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Database setup
command: bundle exec rake db:create db:schema:load --trace
# - run:
# name: Brakeman
# command: bundle exec brakeman
# - run:
# name: Stylelint
# command: yarn stylelint
- run:
name: Rubocop
command: bundle exec rubocop
- run:
name: Run rspec in parallel
command: |
bundle exec rspec --exclude-pattern "spec/system/*_spec.rb"
# bundle exec rspec --profile 10 \
# --format RspecJunitFormatter \
# --out test_results/rspec.xml \
# --format progress \
# $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
- store_test_results: # https://circleci.com/docs/2.0/collect-test-data/
path: test_results
- run:
name: Run system tests
command: |
COVERAGE=false bundle exec rspec spec/system/
workflows:
build:
jobs:
- build
# https://circleci.com/docs/2.0/workflows/#nightly-example
# https://circleci.com/docs/2.0/configuration-reference/#filters-1
repeat:
jobs:
- build
triggers:
- schedule:
cron: "0,20,40 * * * *"
filters:
branches:
only:
- /.*ci-repeat.*/