circleci-demo-ruby-rails icon indicating copy to clipboard operation
circleci-demo-ruby-rails copied to clipboard

Running rspec in Circle CI

Open plamenGo opened this issue 5 years ago • 2 comments

Hey guys, the sample .circleci config does not work for me. It always chokes on not being able to find bundle. All I'm trying to do is run rspec on .circle ci.

This is the config I have so far:

version: 2 jobs: build: parallelism: 3 docker: - image: circleci/ruby:2.4.2-jessie-node environment: BUNDLE_JOBS: 3 BUNDLE_RETRY: 3 BUNDLE_PATH: vendor/bundle TERRAFORM_VERSION: 0.10.8 PATH: "${PATH}:${HOME}/.bin"

  - image: circleci/postgres:9.6
    environment:
      POSTGRES_PASSWORD: abcd1234!!

  - image: "redis:3.2.6"

steps:
  - checkout

  # Which version of bundler?
  - run:
      name: Which bundler?
      command: bundle -v

  - run:
      name: Bundle Install
      command: bundle check || bundle install
  
  - run:
      name: Run rspec
      command: |
        bundle exec rspec
      environment:
        RAILS_ENV: test
        DB_HOST: postgres
        DB_NAME: phisher_test
        DB_USERNAME: postgres
        DB_PASSWORD: abcd1234!!
        REDIS_HOST: redis
        JWT_SECRET: dev
        COMPILER_ADDR: 10.12.0.22:5030
        ELASTICSEARCH_HOST: localhost

And this is the output where it fails:

Which bundler? (0)00:00 Exit code: 127 #!/bin/bash -eo pipefail bundle -v /bin/bash: bundle: command not found Exited with code 127

plamenGo avatar Nov 09 '18 22:11 plamenGo

Same issue, I have to install bundler manually. Should it somehow be available without this?

AlecRust avatar Aug 14 '19 11:08 AlecRust

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

jasonfb avatar Oct 06 '21 18:10 jasonfb