Per this discussion:
and this GH issue
I’ve got a setup for running my app, a Ruby on Rails app:
- Docker container for Postgres
- Docker container for Ruby + Node version + Yarn version
- Cached dependencies saved from prior build steps including the global ~/.cache
How do I start the server that Cypress will hit if the server depends on these dependencies? There doesn’t seem to be a way to leverage the caches and docker containers that I’ve set up.
Is using an Orb correct for my use case?
Or should I fork the orb?
Can I modify a docker setup and use my own docker image?
Here’s a rough idea of what I want to do without orbs:
aliases:
- &restore-global-cache
name: Restore global cache
key: ruby-2.5.3--node-10.11.0--yarn-1.13.0--v1--global-cache-{{ checksum "yarn.lock" }}-{{ checksum "client/yarn.lock" }}
defaults: &defaults
environment:
RAILS_ENV: test
RACK_ENV: test
NODE_ENV: test
rspec-defaults: &rspec-defaults
<<: *defaults
docker:
- image: &docker_image shakacode/hawaiichee-ci:ruby-2.5.3--node-10.11.0--yarn-1.13.0
environment:
PGHOST: localhost
PGUSER: blah
DATABASE_URL: postgres://blah@localhost:5432/blah_test
DISABLE_SPRING: true
- image: circleci/postgres:9.6.2-alpine
environment:
POSTGRES_USER: blah
POSTGRES_DB: blah
POSTGRES_PASSWORD: blah
rspec:
<<: *rspec-defaults
parallelism: 4
steps:
- checkout
- restore_cache: *restore-gem-cache
- restore_cache: *restore-webpack-bundles-cache
- restore_cache: *restore-global-cache
- run: *run-yarn
- run: *install-ruby-gems
- run: *wait-for-postgres-container
- run: *make-rspec-dir
- run: bundle exec rake db:setup
- run:
name: Run tests
environment:
CODECOV_FLAG: backend
command: |
bin/rspec --profile 10 \
--format RspecJunitFormatter \
--out ~/rspec/rspec.xml \
--format progress \
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
- store_test_results:
path: ~/rspec
- store_artifacts:
path: ~/rspec
- store_artifacts:
path: tmp/capybara
- store_artifacts:
path: tmp/screenshots
- store_artifacts:
path: log/test.log
- store_artifacts:
path: tmp/rspec_retry.csv
cypress:
<<: *rspec-defaults
docker:
- image: &docker_image shakacode/hawaiichee-ci:ruby-2.5.3--node-10.11.0--yarn-1.13.0
environment:
PGHOST: localhost
PGUSER: blah
DATABASE_URL: postgres://blah@localhost:5432/blah_test
DISABLE_SPRING: true
- image: circleci/postgres:9.6.2-alpine
environment:
POSTGRES_USER: blah
POSTGRES_DB: blah
POSTGRES_PASSWORD: blah
- image: cypress/base
parallelism: 4
steps:
- checkout
- restore_cache: *restore-global-cache
- run: *run-yarn
- restore_cache: *restore-gem-cache
- restore_cache: *restore-webpack-bundles-cache
- run: *install-ruby-gems
- run: *wait-for-postgres-container
- run: bundle exec rake db:setup
- run: yarn
- run: yarn cypress install
The last task is the one I need help…I know what’s documented for the orbs, but if I don’t want to use the orbs, what’s the way to set this up?
This is sort of what I wanted to do with an orb setup. Of course, I can’t change the docker container, etc. with the orbs, so this doesn’t work.
- cypress/run:
<<: *rspec-defaults
steps:
- restore_cache: *restore-gem-cache
- restore_cache: *restore-webpack-bundles-cache
- restore_cache: *restore-global-cache
- run: *run-yarn
- run: *install-ruby-gems
- run: *wait-for-postgres-container
- run: *make-rspec-dir
- run: bundle exec rake db:setup
start: RAILS_ENV=test bundle exec rails server -p 3000
wait-on: 'http://localhost:3000'
filters:
branches:
ignore: master
requires:
- cypress/install
- install-ruby-gems
- install-node-packages
- build-webpack-rspec-bundles
parallel: true
parallelism: 3
group: 3 machines