Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 51 additions & 42 deletions .github/workflows/lint-and-analyse-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,55 @@ on:
push:
pull_request:

permissions:
contents: read

jobs:
lint-php:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7

- name: Set up PHP 7.2
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
tools: composer:v2

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Install Composer dependencies
uses: ramsey/composer-install@v4
with:
dependency-versions: highest

- name: Lint files
run: composer run phpcs

analyse-php:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7

- name: Set up PHP 7.2
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
tools: composer:v2

- name: Install Composer dependencies
uses: ramsey/composer-install@v4
with:
dependency-versions: highest

- name: Analyse files
run: composer run phpstan
lint-php:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Set up PHP 7.2
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
tools: composer:v2

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Install Composer dependencies
uses: ramsey/composer-install@v4
with:
dependency-versions: highest

- name: Lint files
run: composer run phpcs

analyse-php:
name: Analyse
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Set up PHP 7.2
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
tools: composer:v2

- name: Install Composer dependencies
uses: ramsey/composer-install@v4
with:
dependency-versions: highest

- name: Analyse files
run: composer run phpstan
28 changes: 17 additions & 11 deletions .github/workflows/lint-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@ on:
push:
pull_request:

permissions:
contents: read

jobs:
lint-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
lint-docs:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Lint PHP documentation
uses: sudo-bot/action-doctum@v5
with:
config-file: doctum-config.php
method: "parse"
cli-args: "--output-format=github --no-ansi --no-progress -v --ignore-parse-errors"
- name: Lint PHP documentation
uses: sudo-bot/action-doctum@v5
with:
config-file: doctum-config.php
method: "parse"
cli-args: "--output-format=github --no-ansi --no-progress -v --ignore-parse-errors"
104 changes: 53 additions & 51 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,57 @@ on:
push:
pull_request:

permissions:
contents: read

jobs:
test-php:
name: Test on PHP ${{ matrix.php-version }} (${{ matrix.extensions }})
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
extensions: [':apcu, mbstring', 'apcu, mbstring']
os: [ubuntu-latest]
experimental: [false]
composer-options: ['']
include:
- { php-version: '8.5', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: 'apcu, mbstring' }
- { php-version: '8.5', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: ':apcu, mbstring' }
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
# Fetch some commits for Scrutinizer coverage upload
fetch-depth: 15

- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ matrix.extensions }}
ini-values: "apc.enable_cli=1"
coverage: xdebug

- name: Install Composer dependencies
uses: ramsey/composer-install@v4
with:
dependency-versions: highest
composer-options: ${{ matrix.composer-options }}

- name: Run PHP tests
run: composer run phpunit

- name: Send coverage
uses: codecov/codecov-action@v7
with:
flags: unit-${{ matrix.php-version }}-${{ matrix.os }}
name: phpunit-${{ matrix.php-version }}-${{ matrix.os }}
token: ${{ secrets.CODECOV_TOKEN }}

- name: Send coverage to Scrutinizer
uses: sudo-bot/action-scrutinizer@latest
# Do not run this step on forked versions of the main repository (example: contributor forks)
if: github.repository == 'phpmyadmin/motranslator'
with:
cli-args: "--format=php-clover build/logs/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}"
test-php:
name: Test on PHP ${{ matrix.php-version }} (${{ matrix.extensions }})
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
extensions: [':apcu', 'apcu']
experimental: [false]
composer-options: ['']
include:
- {php-version: '8.6', experimental: true, composer-options: '--ignore-platform-req=php+', extensions: 'apcu'}
- {php-version: '8.6', experimental: true, composer-options: '--ignore-platform-req=php+', extensions: ':apcu'}
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 15 # Fetch some commits for Scrutinizer coverage upload
persist-credentials: false

- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, ${{ matrix.extensions }}
ini-values: "apc.enable_cli=1"
coverage: xdebug

- name: Install Composer dependencies
uses: ramsey/composer-install@v4
with:
dependency-versions: highest
composer-options: ${{ matrix.composer-options }}

- name: Run PHP tests
run: composer run phpunit ${{ case(matrix.php-version >= '8.1', '-- --display-all-issues', '') }}

- name: Send coverage
uses: codecov/codecov-action@v7
with:
flags: unit-${{ matrix.php-version }}
name: phpunit-${{ matrix.php-version }}
token: ${{ secrets.CODECOV_TOKEN }}

- name: Send coverage to Scrutinizer
uses: sudo-bot/action-scrutinizer@latest
# Do not run this step on forked versions of the main repository (example: contributor forks)
if: github.repository == 'phpmyadmin/motranslator'
with:
cli-args: "--format=php-clover build/logs/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}"
6 changes: 5 additions & 1 deletion tests/Cache/ApcuCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
use function implode;
use function sleep;

use const PHP_VERSION_ID;

/**
* @covers \PhpMyAdmin\MoTranslator\Cache\ApcuCache
*/
Expand Down Expand Up @@ -199,7 +201,9 @@ public function testReloadOnMissHonorsLock(): void
$cache = new ApcuCache(new MoParser(null), $locale, $domain);

$method = new ReflectionMethod($cache, 'reloadOnMiss');
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}

$key = 'mo_' . $locale . '.' . $domain . '.' . $msgid;
apcu_entry($key, static function () use ($expected): string {
Expand Down