Skip to content

Commit 1e20177

Browse files
committed
perf(ci): add dependency caching across workflows
- Add Composer cache to phpstan, wpcs, and setup-wordpress action - Add npm cache with .nvmrc reference to release workflow - Enable Docker BuildKit for faster image builds in test-plugin Relates to #411
1 parent 8fc9971 commit 1e20177

5 files changed

Lines changed: 39 additions & 2 deletions

File tree

.github/actions/setup-wordpress/action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ runs:
2323
with:
2424
node-version: 18.x
2525

26+
- name: Get Composer cache directory
27+
id: composer-cache
28+
shell: bash
29+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
30+
31+
- name: Cache Composer dependencies
32+
uses: actions/cache@v4
33+
with:
34+
path: ${{ steps.composer-cache.outputs.dir }}
35+
key: ${{ runner.os }}-composer-no-dev-${{ hashFiles('**/composer.lock') }}
36+
restore-keys: ${{ runner.os }}-composer-no-dev-
37+
2638
- name: Install dependencies
2739
shell: bash
2840
run: composer install --no-dev

.github/workflows/phpstan.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ jobs:
1717
with:
1818
php-version: '8.2'
1919

20+
- name: Get Composer cache directory
21+
id: composer-cache
22+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
23+
24+
- name: Cache Composer dependencies
25+
uses: actions/cache@v4
26+
with:
27+
path: ${{ steps.composer-cache.outputs.dir }}
28+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
29+
restore-keys: ${{ runner.os }}-composer-
30+
2031
- name: Install Dependencies
2132
run: composer install
2233

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ jobs:
2828
- name: Checkout Repo
2929
uses: actions/checkout@v4
3030

31-
- name: Setup Node.js 18.x
31+
- name: Setup Node.js
3232
uses: actions/setup-node@v4
3333
with:
34-
node-version: 18.x
34+
node-version-file: '.nvmrc'
35+
cache: 'npm'
3536

3637
- name: Install Dependencies
3738
run: npm ci

.github/workflows/test-plugin.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
env:
2424
PHP_VERSION: ${{ matrix.php }}
2525
WP_VERSION: ${{ matrix.wordpress }}
26+
DOCKER_BUILDKIT: 1
27+
COMPOSE_DOCKER_CLI_BUILD: 1
2628
working-directory: ./
2729
run: |
2830
docker compose build \

.github/workflows/wpcs.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ jobs:
1515
with:
1616
php-version: '8.1'
1717

18+
- name: Get Composer cache directory
19+
id: composer-cache
20+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
21+
22+
- name: Cache Composer dependencies
23+
uses: actions/cache@v4
24+
with:
25+
path: ${{ steps.composer-cache.outputs.dir }}
26+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
27+
restore-keys: ${{ runner.os }}-composer-
28+
1829
- name: Install Dependencies
1930
run: composer install
2031

0 commit comments

Comments
 (0)