Issue #4 - [OPTIMIZATION] Skip Ruby cache generation when gems unchanged

Description

The Ruby gems cache job runs even when no gem dependencies have changed, wasting CI/CD time. Add logic to skip cache generation when the Gemfile hasn't been modified.

Current Behavior

  • Cache job runs on every pipeline
  • Unnecessary cache rebuilds
  • Slower CI/CD pipelines
  • Wasted compute resources

Expected Behavior

  • Cache job runs only when gems change
  • Faster pipelines when gems unchanged
  • Efficient resource usage
  • Smart dependency checking

What You'll Learn

  • GitLab CI/CD pipeline optimization
  • Dependency caching strategies
  • YAML pipeline configuration
  • Git change detection

Steps to Implement

  1. Locate the cache:ruby-gems job in .gitlab-ci.yml
  2. Add only:changes: rule to detect Gemfile changes
  3. Specify files to watch:
    • Gemfile
    • Gemfile.lock
  4. Test that cache runs when gems change
  5. Test that cache skips when gems unchanged

Example Configuration

cache:ruby-gems:
  only:
    changes:
      - Gemfile
      - Gemfile.lock

Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below."