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
- Locate the
cache:ruby-gemsjob in.gitlab-ci.yml - Add
only:changes:rule to detect Gemfile changes - Specify files to watch:
GemfileGemfile.lock
- Test that cache runs when gems change
- 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."