Skip to content

Commit a5cc643

Browse files
committed
Trying to cache composer vendor directory.
1 parent 75615de commit a5cc643

File tree

3 files changed

+90
-11
lines changed

3 files changed

+90
-11
lines changed

.github/actions/code-quality/action.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@ inputs:
44
working-directory:
55
description: 'Directory to run composer and quality tools in'
66
required: true
7+
php-version:
8+
description: 'PHP version to use'
9+
required: false
10+
default: '7.4'
11+
composer-options:
12+
description: 'Additional composer options'
13+
required: false
14+
default: '--no-progress'
15+
716
runs:
817
using: "composite"
918
steps:
10-
- name: Setup PHP
11-
uses: shivammathur/setup-php@v2
12-
with:
13-
php-version: '7.4'
14-
tools: composer:v2
15-
coverage: none
16-
17-
- name: Install dependencies
18-
uses: ramsey/composer-install@v2
19+
- name: Setup PHP with Cached Composer
20+
uses: ./.github/actions/setup-php-composer
1921
with:
22+
php-version: ${{ inputs.php-version }}
2023
working-directory: ${{ inputs.working-directory }}
21-
composer-options: "--no-progress"
24+
composer-options: ${{ inputs.composer-options }}
2225

2326
- name: Run PHPStan
2427
working-directory: ${{ inputs.working-directory }}
@@ -33,4 +36,4 @@ runs:
3336
- name: Run PHP CodeSniffer
3437
working-directory: ${{ inputs.working-directory }}
3538
run: composer run-script check-cs
36-
shell: bash
39+
shell: bash
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Setup PHP with Cached Composer"
2+
description: "Setup PHP and install Composer dependencies with caching"
3+
inputs:
4+
php-version:
5+
description: "PHP version to setup"
6+
required: false
7+
default: "7.4"
8+
working-directory:
9+
description: "Working directory for composer install"
10+
required: true
11+
composer-options:
12+
description: "Additional composer options"
13+
required: false
14+
default: "--no-progress --optimize-autoloader"
15+
tools:
16+
description: "Tools to install with PHP"
17+
required: false
18+
default: "composer:v2"
19+
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ inputs.php-version }}
27+
tools: ${{ inputs.tools }}
28+
coverage: none
29+
30+
- name: Get Composer cache directory
31+
id: composer-cache
32+
shell: bash
33+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
34+
35+
- name: Cache Composer dependencies
36+
uses: actions/cache@v4
37+
with:
38+
path: |
39+
${{ steps.composer-cache.outputs.dir }}
40+
${{ inputs.working-directory }}/vendor
41+
key: composer-${{ runner.os }}-php${{ inputs.php-version }}-${{ hashFiles(format('{0}/composer.lock', inputs.working-directory)) }}
42+
restore-keys: |
43+
composer-${{ runner.os }}-php${{ inputs.php-version }}-
44+
composer-${{ runner.os }}-
45+
46+
- name: Install Composer dependencies
47+
uses: ramsey/composer-install@v2
48+
with:
49+
working-directory: ${{ inputs.working-directory }}
50+
composer-options: ${{ inputs.composer-options }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
4+
/**
5+
* Inherited Methods
6+
* @method void wantToTest($text)
7+
* @method void wantTo($text)
8+
* @method void execute($callable)
9+
* @method void expectTo($prediction)
10+
* @method void expect($prediction)
11+
* @method void amGoingTo($argumentation)
12+
* @method void am($role)
13+
* @method void lookForwardTo($achieveValue)
14+
* @method void comment($description)
15+
* @method void pause()
16+
*
17+
* @SuppressWarnings(PHPMD)
18+
*/
19+
class FunctionalTester extends \Codeception\Actor
20+
{
21+
use _generated\FunctionalTesterActions;
22+
23+
/**
24+
* Define custom actions here
25+
*/
26+
}

0 commit comments

Comments
 (0)