From 4dbcba401cae5824355a88b6458ab6c526c44e81 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Mon, 27 Nov 2023 18:44:20 +0000 Subject: [PATCH] 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 --- .github/workflows/phpunit.yml | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index cde7e397..433e1a15 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -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