Skip to content

Commit 1e3b275

Browse files
committed
ci
1 parent 0418e66 commit 1e3b275

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

.github/actions/setup-php-composer/action.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ inputs:
66
description: 'PHP version to use'
77
required: false
88
default: '8.4'
9+
coverage:
10+
description: 'Coverage driver to use (none, xdebug, pcov)'
11+
required: false
12+
default: 'none'
13+
stability:
14+
description: 'Composer stability preference (prefer-stable, prefer-lowest)'
15+
required: false
16+
default: 'prefer-stable'
917

1018
runs:
1119
using: 'composite'
@@ -14,6 +22,7 @@ runs:
1422
uses: shivammathur/setup-php@v2
1523
with:
1624
php-version: ${{ inputs.php-version }}
25+
coverage: ${{ inputs.coverage }}
1726

1827
- name: Get Composer Cache Directory
1928
id: composer-cache
@@ -24,11 +33,16 @@ runs:
2433
uses: actions/cache@v5
2534
with:
2635
path: ${{ steps.composer-cache.outputs.dir }}
27-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
36+
key: ${{ runner.os }}-composer-${{ inputs.stability }}-${{ hashFiles('**/composer.lock') }}
2837
restore-keys: |
2938
${{ runner.os }}-composer-
3039
3140
- name: Install dependencies
3241
shell: bash
33-
run: composer install --prefer-dist --no-interaction --no-progress
42+
run: |
43+
if [ "${{ inputs.stability }}" = "prefer-lowest" ]; then
44+
composer update --prefer-lowest --prefer-dist --no-interaction --no-progress
45+
else
46+
composer install --prefer-dist --no-interaction --no-progress
47+
fi
3448

.github/workflows/run-tests.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,17 @@ jobs:
2222
- name: Checkout code
2323
uses: actions/checkout@v5
2424

25-
- name: Setup PHP
26-
uses: shivammathur/setup-php@v2
25+
- name: Setup PHP and Composer
26+
uses: ./.github/actions/setup-php-composer
2727
with:
2828
php-version: ${{ matrix.php }}
29-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
3029
coverage: none
30+
stability: ${{ matrix.stability }}
3131

3232
- name: Setup problem matchers
3333
run: |
3434
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
3535
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
3636
37-
- name: Install dependencies
38-
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
39-
4037
- name: Execute tests
4138
run: vendor/bin/pest --colors=always

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ jobs:
5050
uses: ./.github/actions/setup-php-composer
5151

5252
- name: Run format checks
53-
run: composer format
53+
run: composer format --no-progress

0 commit comments

Comments
 (0)