- 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
71 lines
1.9 KiB
YAML
71 lines
1.9 KiB
YAML
name: PHP Unit
|
|
|
|
on:
|
|
pull_request:
|
|
|
|
jobs:
|
|
phpunit:
|
|
runs-on: ubuntu-latest
|
|
|
|
name: PHPUnit test suite
|
|
|
|
strategy:
|
|
matrix:
|
|
operating-system: ['ubuntu-latest']
|
|
php-versions: ['8.2', '8.3']
|
|
phpunit-versions: ['latest']
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:latest
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: jbukdev_testing
|
|
ports:
|
|
- 5432:5432
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
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');"
|
|
|
|
- name: Get Composer Cache Directory
|
|
id: composer-cache
|
|
run: |
|
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: Cache composer dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-php-${{ matrix.php-version }}-composer-
|
|
|
|
- name: Install Composer Dependencies
|
|
run: composer install --quiet --no-ansi --no-interaction --no-progress
|
|
|
|
- name: Generate Key
|
|
run: php artisan key:generate
|
|
|
|
- name: Setup Directory Permissions
|
|
run: chmod -R 777 storage bootstrap/cache
|
|
|
|
- name: Setup Database
|
|
run: php artisan migrate
|
|
|
|
- name: Execute PHPUnit Tests
|
|
run: vendor/bin/phpunit
|