ci: Refactor GitHub Actions workflow for PHP setup
- Updated PHP and PHPUnit versions in workflow matrix - Added new extensions to PHP setup - Enabled xdebug coverage - Cached composer dependencies based on PHP version - Removed Node setup and installation of dependencies - Updated checkout action to version 4 - Set GITHUB_TOKEN environment variable for PHP setup - Changed cache key for composer dependencies based on PHP version
This commit is contained in:
parent
6ee4222d80
commit
4dbcba401c
1 changed files with 16 additions and 13 deletions
29
.github/workflows/phpunit.yml
vendored
29
.github/workflows/phpunit.yml
vendored
|
@ -9,6 +9,12 @@ jobs:
|
||||||
|
|
||||||
name: PHPUnit test suite
|
name: PHPUnit test suite
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
operating-system: ['ubuntu-latest']
|
||||||
|
php-versions: ['8.2', '8.3']
|
||||||
|
phpunit-versions: ['latest']
|
||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:latest
|
||||||
|
@ -21,20 +27,17 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Node and dependencies
|
- name: Setup PHP
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
cache: 'npm'
|
|
||||||
- run: npm ci
|
|
||||||
|
|
||||||
- name: Setup PHP with pecl extensions
|
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.2'
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: phpredis,imagick
|
extensions: mbstring, intl, phpredis, imagick
|
||||||
|
coverage: xdebug
|
||||||
|
tools: phpunit:${{ matrix.phpunit-versions }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Copy .env
|
- name: Copy .env
|
||||||
run: php -r "file_exists('.env') || copy('.env.github', '.env');"
|
run: php -r "file_exists('.env') || copy('.env.github', '.env');"
|
||||||
|
@ -48,9 +51,9 @@ jobs:
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-composer-
|
${{ runner.os }}-php-${{ matrix.php-version }}-composer-
|
||||||
|
|
||||||
- name: Install Composer Dependencies
|
- name: Install Composer Dependencies
|
||||||
run: composer install --quiet --no-ansi --no-interaction --no-progress
|
run: composer install --quiet --no-ansi --no-interaction --no-progress
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue