Skip to content

Tests

Tests #742

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
run-tests:
name: Tests with PHP ${{ matrix.php-version }}
runs-on: ubuntu-latest
env:
VUFIND_HOME: ${{ github.workspace }}
VUFIND_LOCAL_DIR: ${{ github.workspace }}/local
strategy:
matrix:
php-version: ['8.2', '8.3', '8.4', '8.5']
# We run PHP-based tests on all platforms (qa-php), but we only include PHP AND
# Javascript-related tests (qa-console) once. Since the JS results should be the
# same on all platforms, we don't need to repeat them.
include:
- php-version: 8.2
phing_tasks: "qa-php"
- php-version: 8.3
phing_tasks: "qa-console"
- php-version: 8.4
phing_tasks: "qa-php"
- php-version: 8.5
phing_tasks: "qa-php"
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: intl, xsl
tools: composer:2.9.8
ini-values: error_reporting=E_ALL
- name: Checkout
uses: actions/checkout@v6
- name: Disable Solr installation
run: touch solr/.disableAutomaticInstall
- name: Setup node
if: ${{ matrix.phing_tasks == 'qa-console' }}
uses: actions/setup-node@v6
with:
node-version: '20'
- 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@v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Cache php-cs-fixer data
uses: actions/cache@v5
with:
path: .php_cs_cache
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ github.sha }}"
restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-"
- name: Cache phpstan data
uses: actions/cache@v5
with:
path: .phpstan_cache
key: "php-${{ matrix.php-version }}-phpstan-${{ github.sha }}"
restore-keys: "php-${{ matrix.php-version }}-phpstan-"
- name: Cache PHP_CodeSniffer data
uses: actions/cache@v5
with:
path: tests/phpcs.cache.json
key: "php-${{ matrix.php-version }}-phpcs-${{ github.sha }}"
restore-keys: "php-${{ matrix.php-version }}-phpcs-"
- name: Cache rector data
uses: actions/cache@v5
with:
path: .rector
key: "php-${{ matrix.php-version }}-rector-${{ github.sha }}"
restore-keys: "php-${{ matrix.php-version }}-rector-"
- name: Install composer dependencies
run: composer install
- name: Cache NPM dependencies
if: ${{ matrix.phing_tasks == 'qa-console' }}
uses: actions/cache@v5
with:
path: ~/.npm
key: npm-${{ hashFiles('**/package.json') }}
restore-keys: npm-
- name: Install node dependencies
if: ${{ matrix.phing_tasks == 'qa-console' }}
# Run NPM via Composer for consistency and centralization.
run: composer run install-build-deps
- name: Run tests
run: vendor/bin/phing ${{ matrix.phing_tasks }}