Bundle Caching
yaml
1- uses: ruby/setup-ruby@v1
2 with:
3 ruby-version: '3.2'
4 bundler-cache: true # Automatic cachingManual Caching
yaml
1- name: Cache gems
2 uses: actions/cache@v3
3 with:
4 path: vendor/bundle
5 key: gems-${{ runner.os }}-${{ hashFiles('Gemfile.lock') }}
6 restore-keys: |
7 gems-${{ runner.os }}-Node Modules Cache
yaml
1- name: Cache node modules
2 uses: actions/cache@v3
3 with:
4 path: node_modules
5 key: node-${{ runner.os }}-${{ hashFiles('yarn.lock') }}Asset Cache
yaml
1- name: Cache assets
2 uses: actions/cache@v3
3 with:
4 path: |
5 public/assets
6 tmp/cache/assets
7 key: assets-${{ runner.os }}-${{ hashFiles('app/assets/**/*') }}Docker Layer Caching
yaml
1- uses: docker/build-push-action@v5
2 with:
3 cache-from: type=gha
4 cache-to: type=gha,mode=maxWhen to Cache
✅ Dependencies (gems, npm) ✅ Compiled assets ✅ Docker layers ❌ Test databases ❌ Frequently changing files
