Repository navigation
Conversation
Caches Composer, npm and Yarn downloads with actions/cache, keyed on the lock files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 task
Comment on lines
+81
to
+97
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: ./ | ||
| with: | ||
| ddevDir: tests/fixtures/ddevProj2 | ||
| cacheDependencies: true | ||
|
|
||
| - name: Install dependencies to fill the cache | ||
| working-directory: tests/fixtures/ddevProj2 | ||
| run: | | ||
| ddev composer install | ||
| ddev npm ci | ||
|
|
||
| cache-restore: |
Comment on lines
+98
to
+119
| needs: cache-save | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: ./ | ||
| id: ddev | ||
| with: | ||
| ddevDir: tests/fixtures/ddevProj2 | ||
| cacheDependencies: true | ||
|
|
||
| - name: Cache restored | ||
| env: | ||
| CACHE_HIT: ${{ steps.ddev.outputs.cache-hit }} | ||
| run: test "$CACHE_HIT" = 'true' | ||
|
|
||
| - name: Install dependencies without network access | ||
| working-directory: tests/fixtures/ddevProj2 | ||
| run: | | ||
| ddev exec 'COMPOSER_DISABLE_NETWORK=1 composer install' | ||
| ddev npm ci --offline |
Collaborator
Author
|
Closing in favor of a separate action, davereid/github-action-cache-ddev. Instead of overriding the package managers' cache settings, it mounts runner directories over the caches DDEV already keeps (Composer, npm, Yarn 1 and 4, Corepack, Node.js), so this action stays focused on setting up DDEV. #15 stays open for Docker image caching. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an opt-in
cacheDependenciesinput that caches Composer, npm and Yarn downloads between workflow runs, following up on the Composer caching approach from #15.cacheDependencies(defaultfalse): writes.ddev/config.zz-setup-ddev-cache.yaml, pointingCOMPOSER_CACHE_DIR,npm_config_cacheandYARN_CACHE_FOLDERat.ddev/.setup-ddev-cache, and caches that directory withactions/cache, keyed oncomposer.lock,package-lock.jsonandyarn.lockcache-hit:truewhen the lock files matched a saved cache exactlytests/fixtures/ddevProj2fixture andcache-save/cache-restorejobs that install offline from the restored cacheAn alternative to #62, which documents the same approach as a recipe for workflows to copy. Related to #15, which stays open for Docker image caching.
Remaining tasks
cache-restorepasses:actions/cachesaves from inside a composite action, and the cache variables reach the web containerYARN_CACHE_FOLDERmay not apply there; the tests only cover Composer and npmAI disclosure
Claude Code (Claude Opus 5.5) wrote the input, the tests, the README section and this description, from my earlier Composer example in #15. I proposed adding caching to the action itself and reviewed the changes.
🤖 Generated with Claude Code