Skip to content

Commit b31ffe4

Browse files
authored
Merge pull request #41 from iMattPro/cache-deps
Cache composer and npm dependencies
2 parents 9c88686 + 312e2ae commit b31ffe4

File tree

3 files changed

+89
-13
lines changed

3 files changed

+89
-13
lines changed

.github/workflows/tests.yml

Lines changed: 88 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -255,18 +255,37 @@ jobs:
255255
run: .github/setup-database.sh $DB $MYISAM
256256
working-directory: ./phpBB3
257257

258-
- name: Install NPM dependencies
258+
- name: Set up Node.js
259259
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
260260
uses: actions/setup-node@v4
261261
with:
262-
node-version: 20
262+
node-version: 20
263+
264+
- name: Cache NPM dependencies
265+
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
266+
uses: actions/cache@v4
267+
with:
268+
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/node_modules
269+
key: ${{ runner.os }}-node-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/package-lock.json') }}
270+
restore-keys: |
271+
${{ runner.os }}-node-
263272
264273
- name: Run npm ci
265274
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
266275
run: npm ci
267276
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
268277

269-
- name: Install composer dependencies
278+
- name: Cache Composer dependencies
279+
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
280+
uses: actions/cache@v4
281+
with:
282+
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/vendor
283+
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/composer.lock') }}
284+
restore-keys: |
285+
${{ runner.os }}-composer-${{ matrix.php }}-
286+
${{ runner.os }}-composer-
287+
288+
- name: Install Composer dependencies
270289
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
271290
run: composer install
272291
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
@@ -404,18 +423,37 @@ jobs:
404423
run: .github/setup-database.sh $DB $MYISAM
405424
working-directory: ./phpBB3
406425

407-
- name: Install NPM dependencies
426+
- name: Set up Node.js
408427
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
409428
uses: actions/setup-node@v4
410429
with:
411-
node-version: 20
430+
node-version: 20
431+
432+
- name: Cache NPM dependencies
433+
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
434+
uses: actions/cache@v4
435+
with:
436+
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/node_modules
437+
key: ${{ runner.os }}-node-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/package-lock.json') }}
438+
restore-keys: |
439+
${{ runner.os }}-node-
412440
413441
- name: Run npm ci
414442
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
415443
run: npm ci
416444
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
417445

418-
- name: Install composer dependencies
446+
- name: Cache Composer dependencies
447+
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
448+
uses: actions/cache@v4
449+
with:
450+
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/vendor
451+
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/composer.lock') }}
452+
restore-keys: |
453+
${{ runner.os }}-composer-${{ matrix.php }}-
454+
${{ runner.os }}-composer-
455+
456+
- name: Install Composer dependencies
419457
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
420458
run: composer install
421459
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
@@ -525,18 +563,37 @@ jobs:
525563
run: .github/setup-database.sh $DB $MYISAM
526564
working-directory: ./phpBB3
527565

528-
- name: Install NPM dependencies
566+
- name: Set up Node.js
529567
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
530568
uses: actions/setup-node@v4
531569
with:
532-
node-version: 20
570+
node-version: 20
571+
572+
- name: Cache NPM dependencies
573+
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
574+
uses: actions/cache@v4
575+
with:
576+
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/node_modules
577+
key: ${{ runner.os }}-node-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/package-lock.json') }}
578+
restore-keys: |
579+
${{ runner.os }}-node-
533580
534581
- name: Run npm ci
535582
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
536583
run: npm ci
537584
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
538585

539-
- name: Install composer dependencies
586+
- name: Cache Composer dependencies
587+
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
588+
uses: actions/cache@v4
589+
with:
590+
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/vendor
591+
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/composer.lock') }}
592+
restore-keys: |
593+
${{ runner.os }}-composer-${{ matrix.php }}-
594+
${{ runner.os }}-composer-
595+
596+
- name: Install Composer dependencies
540597
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
541598
run: composer install
542599
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
@@ -657,18 +714,37 @@ jobs:
657714
Set-MpPreference -ExclusionPath "${env:PGDATA}" # Exclude PGDATA directory from Windows Defender
658715
Set-MpPreference -DisableRealtimeMonitoring $true
659716
660-
- name: Install NPM dependencies
717+
- name: Set up Node.js
661718
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
662719
uses: actions/setup-node@v4
663720
with:
664-
node-version: 20
721+
node-version: 20
722+
723+
- name: Cache NPM dependencies
724+
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
725+
uses: actions/cache@v4
726+
with:
727+
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/node_modules
728+
key: ${{ runner.os }}-node-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/package-lock.json') }}
729+
restore-keys: |
730+
${{ runner.os }}-node-
665731
666732
- name: Run npm ci
667733
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
668734
run: npm ci
669735
working-directory: .\phpBB3\phpBB\ext\${{ env.EXTNAME }}
670736

671-
- name: Install composer dependencies
737+
- name: Cache Composer dependencies
738+
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
739+
uses: actions/cache@v4
740+
with:
741+
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/vendor
742+
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/composer.lock') }}
743+
restore-keys: |
744+
${{ runner.os }}-composer-${{ matrix.php }}-
745+
${{ runner.os }}-composer-
746+
747+
- name: Install Composer dependencies
672748
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
673749
run: composer install
674750
working-directory: .\phpBB3\phpBB\ext\${{ env.EXTNAME }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# phpBB Extension Test Framework
22

3-
<img align="left" src="detective-bertie.png" alt="Detective Bertie running diagnostics" height="200" width="200">
3+
<img align="left" src="https://raw.githubusercontent.com/phpbb/website-assets/master/images/images/extensions/detective-bertie.png" alt="Detective Bertie running diagnostics" height="200" width="200">
44

55
This repository provides a reusable GitHub Actions workflow for phpBB extension developers.
66

detective-bertie.png

-332 KB
Binary file not shown.

0 commit comments

Comments
 (0)