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
78 changes: 73 additions & 5 deletions .github/workflows/php.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,78 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

permissions:
contents: read

jobs:
deploy:
uses: opentelemetry-php/gh-workflows/.github/workflows/php.yml@main
with:
matrix_extension: '["ast, json"]'
php:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4']
experimental: [false]

env:
extensions: ast

steps:
- uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}

- name: Validate composer.json
run: composer validate

- name: Install dependencies
id: composer
if: steps.composer-cache.outputs.cache-hit != 'true'
run: |
composer --version
composer install --prefer-dist --no-progress

- name: Check Style
id: style
continue-on-error: ${{ matrix.experimental }}
env:
PHP_CS_FIXER_IGNORE_ENV: 1
run: |
vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer --version
vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --stop-on-violation --using-cache=no -vvv

- name: Run Phan
id: phan
continue-on-error: ${{ matrix.experimental }}
env:
XDEBUG_MODE: off
PHAN_DISABLE_XDEBUG_WARN: 1
run: |
vendor-bin/phan/vendor/bin/phan --version
vendor-bin/phan/vendor/bin/phan

- name: Run Psalm
id: psalm
continue-on-error: ${{ matrix.experimental }}
run: |
vendor-bin/psalm/vendor/bin/psalm --version
vendor-bin/psalm/vendor/bin/psalm --output-format=github

- name: Run Phpstan
id: phpstan
continue-on-error: ${{ matrix.experimental }}
run: |
vendor/bin/phpstan --version
vendor/bin/phpstan analyse --error-format=github

- name: Run PHPUnit
id: phpunit
continue-on-error: ${{ matrix.experimental }}
run: |
vendor/bin/phpunit --version
php -dzend.assertions=1 vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
6 changes: 3 additions & 3 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
'blank_line_before_statement' => true,
'cast_spaces' => true,
'declare_strict_types' => true,
'function_typehint_space' => true,
'type_declaration_spaces' => true,
'include' => true,
'lowercase_cast' => true,
'new_with_braces' => true,
'new_with_parentheses' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'echo_tag_syntax' => true,
Expand All @@ -35,7 +35,7 @@
'phpdoc_scalar' => true,
'phpdoc_types' => true,
'short_scalar_cast' => true,
'single_blank_line_before_namespace' => true,
'blank_lines_before_namespace' => true,
'single_quote' => true,
'trailing_comma_in_multiline' => true,
])
Expand Down
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ PHP_VERSION ?= 8.1
DC_RUN_PHP = docker compose run --rm php
PSALM_THREADS ?= 1

all: update style phan psalm phpstan test
all: update all-checks
all-checks: style phan psalm phpstan test
install:
$(DC_RUN_PHP) env XDEBUG_MODE=off composer install
update:
Expand All @@ -20,17 +21,15 @@ test-integration:
test-coverage:
$(DC_RUN_PHP) env XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always --testdox --testsuite unit --coverage-html=tests/coverage/html
phan:
$(DC_RUN_PHP) env XDEBUG_MODE=off env PHAN_DISABLE_XDEBUG_WARN=1 vendor/bin/phan
$(DC_RUN_PHP) env XDEBUG_MODE=off env PHAN_DISABLE_XDEBUG_WARN=1 vendor-bin/phan/vendor/bin/phan
psalm:
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/psalm --threads=${PSALM_THREADS} --no-cache --php-version=${PHP_VERSION}
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor-bin/psalm/vendor/bin/psalm --threads=${PSALM_THREADS} --no-cache --php-version=${PHP_VERSION}
psalm-info:
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/psalm --show-info=true --threads=${PSALM_THREADS}
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor-bin/psalm/vendor/bin/psalm --show-info=true --threads=${PSALM_THREADS}
phpstan:
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/phpstan analyse --memory-limit=256M
bash:
$(DC_RUN_PHP) bash
style:
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --using-cache=no -vvv
phpmetrics:
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/phpmetrics --config=./phpmetrics.json --junit=junit.xml
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --using-cache=no -vvv
FORCE:
24 changes: 20 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^7.4|^8.0",
"php": "^8.1",
"ext-json": "*",
"ext-simplexml": "*",
"composer/composer": "^2.3",
Expand All @@ -21,6 +21,9 @@
"kriswallsmith/buzz": "^1.2",
"nyholm/psr7": "^1.4",
"php-http/discovery": "^1.19",
"symfony/polyfill-php82": "^1.26",
"symfony/polyfill-php83": "^1.32",
"symfony/polyfill-php84": "^1.32",
"symfony/runtime": "^5.0|^6.0",
"symfony/service-contracts": "^1|^2.5",
"symfony/yaml": "^4.4|^5.3|^6.0"
Expand All @@ -36,7 +39,12 @@
}
},
"require-dev": {
"open-telemetry/dev-common-metapackage": "dev-main"
"bamarni/composer-bin-plugin": "^1.8",
"mikey179/vfsstream": "^1.6",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-mockery": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.3"
},
"scripts": {
"post-install-cmd": [
Expand All @@ -52,9 +60,17 @@
"config": {
"sort-packages": true,
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"composer/package-versions-deprecated": true,
"symfony/runtime": true,
"php-http/discovery": false
"php-http/discovery": false,
"symfony/runtime": true
}
},
"extra": {
"bamarni-bin": {
"bin-links": false,
"target-directory": "vendor-bin",
"forward-command": true
}
}
}
3 changes: 1 addition & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3.7'
services:
php:
image: ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base:${PHP_VERSION:-8.1}
image: ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base:${PHP_VERSION:-8.2}
volumes:
- ./:/usr/src/myapp
user: "${PHP_USER}:root"
Expand Down
72 changes: 69 additions & 3 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd">
<projectFiles>
<directory name="src"/>
<directory name="tests"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
Expand All @@ -16,9 +15,76 @@
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
</plugins>
<issueHandlers>
<UndefinedDocblockClass>
<PossiblyUnusedMethod>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</UndefinedDocblockClass>
</PossiblyUnusedMethod>
<UnusedClass>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</UnusedClass>
<FalsableReturnStatement>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</FalsableReturnStatement>
<PossiblyUnusedReturnValue>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</PossiblyUnusedReturnValue>
<MissingTemplateParam>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</MissingTemplateParam>
<PossiblyUnusedParam>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</PossiblyUnusedParam>
<PossiblyFalseArgument>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</PossiblyFalseArgument>
<PossiblyFalseOperand>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</PossiblyFalseOperand>
<PossiblyNullPropertyAssignment>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</PossiblyNullPropertyAssignment>
<PossiblyNullPropertyFetch>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</PossiblyNullPropertyFetch>
<PossiblyNullReference>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</PossiblyNullReference>
<PossiblyInvalidArgument>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</PossiblyInvalidArgument>
<PossiblyInvalidCast>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</PossiblyInvalidCast>
<ArgumentTypeCoercion>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</ArgumentTypeCoercion>

</issueHandlers>
</psalm>
2 changes: 2 additions & 0 deletions src/Console/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use OpenTelemetry\DevTools\Console\Command\Release\PeclCommand;
use OpenTelemetry\DevTools\Console\Command\Release\PeclTagCommand;
use OpenTelemetry\DevTools\Console\Command\Release\ReleaseCommand;
use OpenTelemetry\DevTools\Console\Command\Release\ReleaseListCommand;
use OpenTelemetry\DevTools\Package\Composer\MultiRepositoryInfoResolver;
use OpenTelemetry\DevTools\Package\Composer\PackageAttributeResolverFactory;
use OpenTelemetry\DevTools\Package\GitSplit\ConfigResolver;
Expand Down Expand Up @@ -38,6 +39,7 @@ private function initCommands(): void
)
),
new ReleaseCommand(),
new ReleaseListCommand(),
new PeclCommand(),
new PeclTagCommand(),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected function createAndRunCommand(
string $commandClass,
InputInterface $input,
OutputInterface $output,
string $workingDirectory = null
?string $workingDirectory = null
): int {
return $this->runCommand(
$this->createCommand($commandClass),
Expand All @@ -42,7 +42,7 @@ protected function runCommand(
Command $command,
InputInterface $input,
OutputInterface $output,
string $workingDirectory = null
?string $workingDirectory = null
): int {
$oldWorkingDir = WorkingDirectoryResolver::create()->resolve();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function __construct(
$this->initWorkingDirectory();
}

#[\Override]
protected function configure(): void
{
$this->setDescription(self::DESCRIPTION);
Expand All @@ -97,6 +98,7 @@ protected function configure(): void
);
}

#[\Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->registerInputAndOutput($input, $output);
Expand Down Expand Up @@ -265,7 +267,7 @@ private static function resolveBranchOptionValue(InputInterface $input): ?string
: null;
}

private function runUpdateCommand(string $workingDirectory = null): int
private function runUpdateCommand(?string $workingDirectory = null): int
{
return $this->createAndRunCommand(
UpdateCommand::class,
Expand Down
2 changes: 2 additions & 0 deletions src/Console/Command/Packages/ValidatePackagesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ public function __construct(ConfigResolverInterface $resolver, ?CommandRunner $c
$this->commandRunner = $commandRunner ?? CommandRunner::create();
}

#[\Override]
protected function configure(): void
{
$this->setDescription(self::DESCRIPTION);
}

#[\Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->registerInputAndOutput($input, $output);
Expand Down
Loading