Bird
0
0

You want to add caching of pip dependencies in your GitHub Actions workflow to speed up builds. Which snippet correctly caches pip packages?

hard📝 Application Q9 of 15
Flask - Deployment
You want to add caching of pip dependencies in your GitHub Actions workflow to speed up builds. Which snippet correctly caches pip packages?
Auses: actions/cache@v3 with: path: /usr/local/bin/pip key: pip-cache
Buses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
Crun: pip cache save requirements.txt
Drun: cache pip packages
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct cache action usage

    actions/cache@v3 caches directories with a key based on requirements.txt hash.
  2. Step 2: Verify correct cache path and key

    ~/.cache/pip is pip's cache folder; key uses OS and requirements.txt hash for uniqueness.
  3. Final Answer:

    uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} -> Option B
  4. Quick Check:

    Cache pip deps using actions/cache with correct path and key [OK]
Quick Trick: Cache ~/.cache/pip with hash of requirements.txt [OK]
Common Mistakes:
MISTAKES
  • Caching wrong directory like /usr/local/bin/pip
  • Using invalid run commands for caching
  • Not using hashFiles for cache key

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes