this app is Rails 6.1.4.1 and is tested with Rspec
I’m getting this error when getting to the final step (which is ruby/test)
Error reading historical timing data: file does not exist
Requested weighting by historical based timing, but they are not present. Falling back to weighting by name.
No examples found.
bundler: failed to load command: rspec (/home/circleci/project/vendor/bundle/ruby/2.6.0/bin/rspec)
My circle ci config.yml file is:
version: 2.1
orbs:
ruby: circleci/ruby@0.1.2
references:
default_ruby_version: &default_ruby_version 2.6.6-stretch-node
default_postgress_version: &default_postgress_version 9.5-alpine
ruby_envs: &ruby_envs
environment:
BUNDLE_JOBS: 3
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
PGHOST: 127.0.0.1
PGUSER: circleci-demo-ruby
PGPASSWORD: ""
RAILS_ENV: test
postgres_envs: &postgres_envs
environment:
POSTGRES_USER: circleci-demo-ruby
POSTGRES_DB: verso-commerce-test2
POSTGRES_PASSWORD: ""
executors:
default:
parameters:
ruby_tag:
description: "The `circleci/ruby` Docker image version tag."
type: string
default: *default_ruby_version
docker:
- image: circleci/ruby:<< parameters.ruby_tag >>
<<: *ruby_envs
ruby_with_postgres:
parameters:
ruby_tag:
description: "The `circleci/postgres` Docker image version tag."
type: string
default: *default_ruby_version
postgres_tag:
description: "The `circleci/postgres` Docker image version tag."
type: string
default: *default_postgress_version
docker:
- image: circleci/ruby:<< parameters.ruby_tag >>
<<: *ruby_envs
- image: circleci/postgres:<< parameters.postgres_tag >>
<<: *postgres_envs
commands:
yarn-install:
description: "Install node_modules in your build."
parameters:
cache-folder-path:
description: "The path of cache-folder"
type: string
default: "~/.cache/yarn"
steps:
- run:
name: Yarn Install
command: yarn install --cache-folder << parameters.cache-folder-path >>
yarn-load-cache:
description: "Load node_modules cached"
parameters:
key:
description: "The cache key to use. The key is immutable."
type: string
default: "rails-demo-yarn-v1"
steps:
- restore_cache:
keys:
- << parameters.key >>-{{ checksum "yarn.lock" }}
yarn-save-cache:
description: "Save node_modules to cache."
parameters:
key:
description: "The cache key to use. The key is immutable."
type: string
default: "rails-demo-yarn-v1"
steps:
- save_cache:
key: << parameters.key >>-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
jobs:
build:
executor: default
steps:
- run:
name: Force Bundler Version
command: |
sudo gem update --system
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
source $BASH_ENV
gem install bundler
- checkout
# Which version of bundler?
- run:
name: Which bundler?
command: bundle -v
- ruby/load-cache:
key: rails-demo-bundle
- ruby/bundle-install
- ruby/save-cache:
key: rails-demo-bundle
# restore, install and save node_packages
- yarn-load-cache
- yarn-install
- yarn-save-cache
test:
parallelism: 1
executor: ruby_with_postgres
steps:
- checkout
- run:
name: Force Bundler Version
command: |
sudo gem update --system
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
source $BASH_ENV
gem install bundler
- ruby/load-cache:
key: rails-demo-bundle
- ruby/bundle-install
- yarn-load-cache
# Check DB status
- run:
name: Wait for DB
command: dockerize -wait tcp://localhost:5432 -timeout 1m
# Setup database
- run:
name: Database setup
command: bundle exec rails db:schema:load --trace
# Run rspec in parallel
- ruby/test
workflows:
version: 2
build_and_test:
jobs:
- build
- test:
requires:
- build
Finally, the spec pass fine when run on the command line with either rake spec
or rspec
it seems like this command is coming from within circleci
TESTFILES=$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
bundle exec rspec $TESTFILES --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress
but I do have specs at that folder spec/ so I’m not sure why on circleci it is telling me No examples found.