Skip to content

Update .github/workflows/tests.yaml #26

Update .github/workflows/tests.yaml

Update .github/workflows/tests.yaml #26

Workflow file for this run

name: Tests
on: [push, pull_request]
jobs:
phpunit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['8.2', '8.3', '8.4']
composer-flags: ['', '--prefer-lowest']
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: json
coverage: none
tools: composer:v2
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.composer-flags }}-${{ hashFiles('**/composer.json', '**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.composer-flags }}-
${{ runner.os }}-composer-${{ matrix.php-version }}-
- name: Install composer dependencies
run: composer update ${{ matrix.composer-flags }} --no-interaction --no-progress --prefer-dist --ansi
- name: Install npm dependencies
run: npm ci
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps chromium
- name: Install Playwright system deps (cache hit path)
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps chromium
- name: Run PHPUnit
run: ./vendor/bin/phpunit --color=always