Skip to content

Commit

Permalink
Fix: Cache key with wildcard never hits
Browse files Browse the repository at this point in the history
Noticing the cache isn't hitting when action runs.
Remove hardcoded composer cache directory.
Remove wildcard .* in Laravel version as part of cache key.
Bump actions/cache to 3.3.1 (via @V3).
  • Loading branch information
cuppett committed Apr 11, 2024
1 parent 185da25 commit 44c65d9
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,27 @@ jobs:
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, yaml
coverage: pcov

- uses: actions/[email protected]
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Prepare cache key
id: prep
run: |
PHP_VERSION=${{ matrix.php }}
LARAVEL_VERSION=${{ matrix.laravel }}
PREFER_VERSION=${{ matrix.prefer }}
# Remove any .* from the versions
LARAVEL_VERSION=${LARAVEL_VERSION//.*}
echo "cache-key=composer-php-$PHP_VERSION-$LARAVEL_VERSION-$PREFER_VERSION-${{ hashFiles('composer.json') }}" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Cache dependencies
with:
path: ~/.composer/cache/files
key: composer-php-${{ matrix.php }}-${{ matrix.laravel }}-${{ matrix.prefer }}-${{ hashFiles('composer.json') }}
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ steps.prep.outputs.cache-key }}

- uses: medyagh/setup-minikube@latest
name: Setup Minikube
Expand Down

0 comments on commit 44c65d9

Please sign in to comment.