Manuals / CI/CD Pipelines / Chapter 7
C · Speed & Scale · intermediate · Week 4–5 · Chapter 7 of 12
Caching & pipeline speed
Slow pipelines get skipped. Cache npm/pip/maven dependencies. Measure before and after.
Path progress52%
Step 1 of 4
Dependency cache
actions/cache with path and key from lockfile hash. Restore on cache hit.
Example
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}Do this now
Add cache step. Compare workflow duration before/after in README.
Was this step clear?
Chapter learning outcomes
- actions/cache
- Cache keys
- Dependency review
- Parallel jobs
Clear these before you leave
Side quest
Before/after
Screenshot Actions timing with and without cache.