Skip to content

Commit

Permalink
Merge branch 'release/0.8.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
pprkut committed Feb 7, 2024
2 parents 1f51ebb + c9bdc7e commit 561b967
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 103 deletions.
95 changes: 11 additions & 84 deletions .github/workflows/php-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,89 +3,16 @@
# SPDX-License-Identifier: CC0-1.0

name: PHP Tests
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

jobs:
phpunit:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
name: "PHP-${{ matrix.php-versions }}: PHPUnit"
strategy:
matrix:
php-versions: ['8.1']
experimental: [false]
include:
- php-versions: 8.2
experimental: true
- php-versions: 8.3
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit:9.5.x
extensions: http, msgpack, gettext, mysqli, uopz, xdebug, uuid

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: Install dependencies
run: composer update

- name: Run PHPunit
run: phpunit --configuration tests/phpunit.xml --coverage-clover=coverage.xml

- name: Collect code coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml

phpcs:
runs-on: ubuntu-latest
continue-on-error: false
name: "PHPCS"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Codestyle checkout
uses: actions/checkout@v3
with:
repository: 'lunr-php/lunr-coding-standard'

# Relative path under $GITHUB_WORKSPACE to place the repository
path: 'codestyle'

- name: Setup PHPCS
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: cs2pr, phpcs

- name: Run PHPCS
run: phpcs -q --report=checkstyle src --standard=$GITHUB_WORKSPACE/codestyle/Lunr | cs2pr

phpstan:
runs-on: ubuntu-latest
continue-on-error: false
name: "PHPStan"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHPStan
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: phpstan
extensions: uopz

- name: Install dependencies
run: composer update

- name: Run PHPStan
run: phpstan analyze src -l9 --configuration tests/phpstan.neon.dist
php-tests:
uses: lunr-php/actions-templates/.github/workflows/php-composer.yml@master
with:
phpstan-level: 9
allow-style-failures: false
allow-phpstan-failures: false
phpcs-whitelist: tests/phan.config.php tests/phpstan.autoload.inc.php tests/test.bootstrap.inc.php
php-extensions: uopz
stable-php-versions: '["8.1"]'
experimental-php-versions: '["8.2","8.3"]'
2 changes: 2 additions & 0 deletions tests/phan.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@
'PhanTypeObjectUnsetDeclaredProperty',
],
];

?>
15 changes: 4 additions & 11 deletions tests/phpstan.autoload.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,19 @@
if (file_exists($base . '/vendor/autoload.php') == TRUE)
{
// Load composer autoloader.
require_once $base . '/vendor/autoload.php';
$autoload_file = $base . '/vendor/autoload.php';
}
else
{
// workaround for https://github.com/phpstan/phpstan/issues/7526
function phpstan_issue_7526_workaround($class)
{
autoload_psr($class);
}

spl_autoload_register('phpstan_issue_7526_workaround');

// Load decomposer autoloade.
require_once $base . '/decomposer.autoload.inc.php';
$autoload_file = $base . '/decomposer.autoload.inc.php';
}

require_once $autoload_file;

// Define application config lookup path
$paths = [
get_include_path(),
$base . '/config',
$base . '/src',
];

Expand Down
20 changes: 12 additions & 8 deletions tests/test.bootstrap.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,29 @@

$base = __DIR__ . '/..';

// Define application config lookup path
$paths = [
get_include_path(),
$base . '/src',
];

set_include_path(
$base . '/src:' .
$base . '/config:' .
$base . '/tests:' .
$base . '/tests/statics:' .
get_include_path()
implode(':', $paths)
);

if (file_exists($base . '/vendor/autoload.php') == TRUE)
{
// Load composer autoloader.
require_once $base . '/vendor/autoload.php';
$autoload_file = $base . '/vendor/autoload.php';
}
else
{
// Load decomposer autoloade.
require_once $base . '/decomposer.autoload.inc.php';
// Load decomposer autoloader.
$autoload_file = $base . '/decomposer.autoload.inc.php';
}

require_once $autoload_file;

define('REFLECTION_BUG_72194', (PHP_MAJOR_VERSION > 5));

if (defined('TEST_STATICS') === FALSE)
Expand Down

0 comments on commit 561b967

Please sign in to comment.