Noob help with setting up ruby bundler caching

Hi
I’m really new to travis CI and stumbled across this wonderful tool trying to build github pages.

I’m struggling through things but making slow progress.

My Github is setup to serve files from the /docs subdirectory. Within the /docs subdirectory I have the _config.yml file, Gemfile and Gemfile.lock.

Within the root directory of the repository I have the .travis.yml file.

I’m requiring the use of Bundler2 and I’ve read the documentation how to install this at build time.

The problem I’m having is bundle is build everytime despite the _travis.yml file asking the builder to cache Bundler.

I’m getting the following message:
bundler caching is configured but a Gemfile is not found. Caching may not work.

Here is my _travis.yml file:

language: ruby
cache: bundler
before_install:
  - cd docs
  - gem install bundler
#before_script:
#  - cd docs
rvm:
  - 2.5.3
script:
  - bundle exec jekyll build

branches:
  only:
  - /.*/
deploy:
  provider: pages
  skip-cleanup: true
  repo: <user>/Site-Documentation
  github_token: $GITHUB_TOKEN
  target_branch: master
  on:
    branch: master

I suspect the error related to no Gemfile found is because there is no Gemfile within the root directory. How do I work around this error so bundler can be cached?

Hello @kevdogg,

I’m glad you like Travis CI, and first and foremost welcome to the community!

So onto the problem, to give me a scope of the issue at hand can you remove cache: bundler from your .travis.yml then retrigger the build?

If possible can you please include a relevant log URL.

-Montana (Travis CI Staff)