Skip to content

Commit 25757c8

Browse files
committed
Update CI workflow: pass PHP version as environment variable and use dynamically in Docker image
Added `PHP_VERSION` as an environment variable in the workflow matrix and updated `castor.php` to dynamically use this variable for Docker image references. Default PHP version fallback logic added.
1 parent 240977d commit 25757c8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ jobs:
189189
image: ghcr.io/spomky-labs/phpqa:${{ matrix.php-version }}
190190
env:
191191
XDEBUG_MODE: coverage
192+
PHP_VERSION: ${{ matrix.php-version }}
192193
steps:
193194
- uses: actions/checkout@v4
194195
- uses: actions/cache@v4

castor.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,15 @@ function phpqa(array $command, array $dockerOptions = []): void
201201
'-e', 'XDEBUG_MODE=off',
202202
];
203203

204+
$phpVersion = getenv('PHP_VERSION')
205+
?: (\PHP_MAJOR_VERSION . '.' . \PHP_MINOR_VERSION)
206+
?: '8.4';
207+
204208
run([
205209
'docker', 'run',
206210
...$defaultDockerOptions,
207211
...$dockerOptions,
208-
'ghcr.io/spomky-labs/phpqa:8.4',
212+
sprintf('ghcr.io/spomky-labs/phpqa:%s', $phpVersion),
209213
...$command,
210214
]);
211215
}

0 commit comments

Comments
 (0)