CircleCI-Public / ruby-orb

The `circleci/ruby` orb source code.
https://circleci.com/developer/orbs/orb/circleci/ruby
MIT License
26 stars 53 forks source link

Task `run-tests` does not work with Bundler 2.1.4 #20

Closed fenak closed 4 years ago

fenak commented 4 years ago

Orb Version 0.2.2

Describe the bug After the change introduced in #18 the deprecation warning goes away and the gems are installed in the correct path, but at least on bundler 2.1.4 setting the BUNDLE_PATH does not seem to make the configuration persistent, so running ruby/run-tests fails as bundler can't find the rspec executable.

To Reproduce Using bundler version 2.1.4, call these steps in the following order:

  1. ruby/load-cache
  2. ruby/install-deps
  3. ruby/save-cache (saves on the wrong path if path overwritten on step 2, as described on #19)
  4. ruby/run-tests - fail to run as the rspec executable can't be found by Bundler

Screen Shot 2020-05-05 at 4 48 19 pm

Expected behavior Step 4 above runs successfully.

Additional context My current workaround:

Running this before the steps mentioned above.

      - run:
          name: Setup bundler
          command: |
            bundle config set path vendor/bundle
KyleTryon commented 4 years ago

Hello,

Version 1.0.0 of the Ruby orb has been released.

https://github.com/CircleCI-Public/ruby-orb/releases/tag/v1.0.0 https://circleci.com/orbs/registry/orb/circleci/ruby?version=1.0.0

We are now currently testing our orb/sample project against the latest version of bundler. Please upgrade to the new 1.0.0 version of the orb and let us know if you continue to experience any issue. Thank you.

xiaoronglv commented 4 years ago

I see this error when using Ruby orb 1.0.0

image

jobs:
  build:
    docker:
      - image: 'cimg/ruby:2.6-node'
    steps:
      - checkout
      - ruby/install-deps
#      - node/install-packages:
#          cache-key: yarn.lock
#          pkg-manager: yarn
  test:
    docker:
      - image: 'cimg/ruby:2.6-node'
      - environment:
          POSTGRES_DB: workstream
          POSTGRES_PASSWORD: ''
          POSTGRES_USER: root
        image: 'circleci/postgres:9.5-alpine'
    environment:
      BUNDLE_JOBS: '3'
      BUNDLE_RETRY: '3'
      PGHOST: 127.0.0.1
      PGPASSWORD: ''
      PGUSER: root
      RAILS_ENV: test
    parallelism: 3
    steps:
      - checkout
      - ruby/install-deps
#      - node/install-packages:
#          cache-key: yarn.lock
#          pkg-manager: yarn
      - run:
          command: 'dockerize -wait tcp://localhost:5432 -timeout 1m'
          name: Wait for DB
      - run:
          command: 'bundle exec rails db:schema:load --trace'
          name: Database setup
      - ruby/rspec-test
orbs:
#  node: circleci/node@x.y
  ruby: circleci/ruby@1.0.0
version: 2.1
workflows:
  build_and_test:
    jobs:
      - build
      - test:
          requires:
            - build

@KyleTryon