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
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
operating-system: ['ubuntu-latest']
|
||||
php-versions: ['8.2', '8.3']
|
||||
phpunit-versions: ['latest']
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:latest
|
||||
|
@ -21,20 +27,17 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node and dependencies
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
|
||||
- name: Setup PHP with pecl extensions
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
extensions: phpredis,imagick
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, intl, phpredis, imagick
|
||||
coverage: xdebug
|
||||
tools: phpunit:${{ matrix.phpunit-versions }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Copy .env
|
||||
run: php -r "file_exists('.env') || copy('.env.github', '.env');"
|
||||
|
@ -48,9 +51,9 @@ jobs:
|
|||
uses: actions/cache@v3
|
||||
with:
|
||||
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: |
|
||||
${{ runner.os }}-composer-
|
||||
${{ runner.os }}-php-${{ matrix.php-version }}-composer-
|
||||
|
||||
- name: Install Composer Dependencies
|
||||
run: composer install --quiet --no-ansi --no-interaction --no-progress
|
||||
|
|
Loading…
Add table
Reference in a new issue