Skip to content

Commit

Permalink
Optimize composer caching
Browse files Browse the repository at this point in the history
Previously our composer package cache would not be updated because we
had no `composer.lock` (which hash is used as part of the cache key).

Generating `composer.lock` (but not installing packages) before we check
the cache fixes this.
  • Loading branch information
weirdan committed Mar 12, 2023
1 parent f48b790 commit 08add38
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/bcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
- name: Generate composer.lock
run: |
composer update --no-install
- name: Cache composer cache
uses: actions/cache@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build-phar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ jobs:
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
- name: Generate composer.lock
run: |
composer update --no-install
- name: Cache composer cache
uses: actions/cache@v3
with:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
- name: Generate composer.lock
run: |
composer update --no-install
- name: Cache composer cache
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -97,6 +101,10 @@ jobs:
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
- name: Generate composer.lock
run: |
composer update --no-install
- name: Cache composer cache
uses: actions/cache@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ jobs:
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
shell: bash

- name: Generate composer.lock
run: |
composer update --no-install
- name: Cache composer cache
uses: actions/cache@v3
with:
Expand Down

0 comments on commit 08add38

Please sign in to comment.