Skip to content

Commit

Permalink
Merge pull request #535: merge all the fixes from 2.11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk authored Dec 9, 2024
2 parents 942885c + ed4d291 commit 70311a7
Show file tree
Hide file tree
Showing 250 changed files with 398 additions and 2,876 deletions.
47 changes: 31 additions & 16 deletions .github/workflows/run-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,21 @@ jobs:
test:
name: PHP${{ matrix.php }}${{ matrix.extensions-suffix }}, ${{ matrix.os }}, ${{ matrix.dependencies }} deps
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ matrix.timeout-minutes }}
timeout-minutes: ${{ inputs.test-timeout }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: ${{ inputs.fail-fast }}
matrix:
php: [ 8.1, 8.2, 8.3 ]
os: [ ubuntu-latest, windows-latest ]
php: [ 8.1, 8.2, 8.3, 8.4 ]
os: [ ubuntu-latest ]
extensions-suffix: [ '', ', protobuf' ]
dependencies: [ lowest , highest ]
timeout-minutes: [ '${{ inputs.test-timeout }}' ]
exclude:
- os: windows-latest
php: 8.2
include:
- os: windows-latest
extensions-suffix: ', protobuf'
- os: windows-latest
php: 8.3
php: 8.1
dependencies: highest
steps:
- name: Set Git To Use LF
run: |
Expand All @@ -82,6 +79,10 @@ jobs:
- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Download CPX (PHP 8.4)
if: inputs.download-binaries == true && matrix.php == '8.4'
run: composer global require cpx/cpx

- name: Get Composer Cache Directory
id: composer-cache
run: |
Expand All @@ -96,23 +97,37 @@ jobs:
php-${{ matrix.php }}-${{ matrix.os }}-composer-
- name: Install lowest dependencies from composer.json
if: matrix.dependencies == 'lowest'
if: matrix.dependencies == 'lowest' && matrix.php != '8.4'
run: composer update --no-interaction --no-progress --prefer-lowest

- name: Install lowest dependencies from composer.json ignoring ext-php constraint (PHP 8.4)
if: matrix.dependencies == 'lowest' && matrix.php == '8.4'
run: composer update --no-interaction --no-progress --prefer-lowest --ignore-platform-req php


- name: Validate lowest dependencies
if: matrix.dependencies == 'lowest'
if: matrix.dependencies == 'lowest' && matrix.php == '8.1'
env:
COMPOSER_POOL_OPTIMIZER: 0
run: vendor/bin/validate-prefer-lowest


- name: Install highest dependencies from composer.json
if: matrix.dependencies == 'highest'
if: matrix.dependencies == 'highest' && matrix.php != '8.4'
run: composer update --no-interaction --no-progress

- name: Download RoadRunner
if: inputs.download-binaries == true
run: |
vendor/bin/dload get --no-interaction -vv
- name: Install highest dependencies from composer.json ignoring ext-php constraint (PHP 8.4)
if: matrix.dependencies == 'highest' && matrix.php == '8.4'
run: composer update --no-interaction --no-progress --ignore-platform-req php


- name: Download binaries
if: inputs.download-binaries == true && matrix.php != '8.4'
run: composer get:binaries

- name: Download binaries (PHP 8.4)
if: inputs.download-binaries == true && matrix.php == '8.4'
run: cpx internal/dload get --no-interaction

- name: Run tests
run: ${{ inputs.test-command }}
40 changes: 39 additions & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,43 @@ jobs:
- name: Install Composer Dependencies
run: composer install --prefer-dist --no-interaction

- name: Run Tests
- name: 🔍 Run Tests
run: vendor/bin/psalm

arch:
name: Architecture tests
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
php: [8.3]
os: [ubuntu-latest]
steps:
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom

- name: Check Out Code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: php-${{ matrix.php }}-${{ runner.os }}-composer-

- name: Install Composer Dependencies
run: composer install --prefer-dist --no-interaction

- name: 🔍 Run Tests
run: composer test:arch
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"spiral/roadrunner-kv": "^4.2",
"spiral/roadrunner-worker": "^3.5",
"symfony/filesystem": "^5.4 || ^6.0 || ^7.0",
"symfony/http-client": "^5.4 || ^6.0 || ^7.0",
"symfony/http-client": "^5.4.3 || ^6.0.3 || ^7.0",
"symfony/process": "^5.4 || ^6.0 || ^7.0"
},
"autoload": {
Expand All @@ -61,7 +61,7 @@
"phpunit/phpunit": "^10.5",
"spiral/code-style": "~2.1.2",
"spiral/core": "^3.13",
"symfony/var-dumper": "^6.0 || ^7.0",
"ta-tikoma/phpunit-architecture-test": "^0.8.4",
"vimeo/psalm": "^4.30 || ^5.4"
},
"autoload-dev": {
Expand All @@ -81,12 +81,14 @@
},
"scripts": {
"post-update-cmd": "Temporal\\Worker\\Transport\\RoadRunnerVersionChecker::postUpdate",
"get:binaries": "dload get --no-interaction -vv",
"cs:diff": "php-cs-fixer fix --dry-run -v --diff --show-progress dots",
"cs:fix": "php-cs-fixer fix -v",
"psalm": "psalm",
"psalm:baseline": "psalm --set-baseline=psalm-baseline.xml",
"test:unit": "phpunit --testsuite=Unit --color=always --testdox",
"test:func": "phpunit --testsuite=Functional --color=always --testdox",
"test:arch": "phpunit --testsuite=Arch --color=always --testdox",
"test:accept": "phpunit --testsuite=Acceptance --color=always --testdox"
},
"extra": {
Expand Down
9 changes: 9 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@
stopOnFailure="false"
stopOnError="false"
stderr="true"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
>
<testsuites>
<testsuite name="Acceptance">
<directory suffix="Test.php">tests/Acceptance/Harness</directory>
</testsuite>
<testsuite name="Arch">
<directory suffix="Test.php">tests/Arch</directory>
</testsuite>
<testsuite name="Unit">
<directory suffix="TestCase.php">tests/Unit</directory>
</testsuite>
Expand Down
16 changes: 6 additions & 10 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@
<code><![CDATA[$workflowType]]></code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Client/Schedule/Spec/ScheduleSpec.php">
<DeprecatedProperty>
<code><![CDATA[$this->excludeCalendarList]]></code>
<code><![CDATA[$this->excludeCalendarList]]></code>
</DeprecatedProperty>
</file>
<file src="src/Client/Update/UpdateHandle.php">
<PossiblyNullArgument>
<code><![CDATA[$result->getSuccess()]]></code>
Expand Down Expand Up @@ -508,7 +514,6 @@
</file>
<file src="src/Internal/Declaration/Reader/WorkflowReader.php">
<ArgumentTypeCoercion>
<code><![CDATA[$class]]></code>
<code><![CDATA[$contextualRetry]]></code>
<code><![CDATA[$method]]></code>
<code><![CDATA[$name]]></code>
Expand Down Expand Up @@ -1218,10 +1223,6 @@
<InvalidOperand>
<code><![CDATA[$promisesOrValues]]></code>
</InvalidOperand>
<MissingParamType>
<code><![CDATA[$promiseOrValue]]></code>
<code><![CDATA[$promiseOrValue]]></code>
</MissingParamType>
<TooManyArguments>
<code><![CDATA[$reduce($c, $value, $i++, $total)]]></code>
</TooManyArguments>
Expand Down Expand Up @@ -1367,11 +1368,6 @@
<code><![CDATA[$method]]></code>
</ArgumentTypeCoercion>
</file>
<file src="src/Worker/Transport/RPCConnectionInterface.php">
<MissingParamType>
<code><![CDATA[$payload]]></code>
</MissingParamType>
</file>
<file src="src/Worker/Transport/RoadRunner.php">
<ArgumentTypeCoercion>
<code><![CDATA[$env->getRelayAddress()]]></code>
Expand Down
3 changes: 0 additions & 3 deletions src/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ final class Activity extends Facade
/**
* Returns information about current activity execution.
*
* @return ActivityInfo
* @throws OutOfContextException in the absence of the activity execution context.
*/
public static function getInfo(): ActivityInfo
Expand All @@ -53,7 +52,6 @@ public static function getInfo(): ActivityInfo
* }
* ```
*
* @return ValuesInterface
* @throws OutOfContextException in the absence of the activity execution context.
*/
public static function getInput(): ValuesInterface
Expand All @@ -69,7 +67,6 @@ public static function getInput(): ValuesInterface
*
* This method returns **true** if the first argument has been passed to the {@see Activity::heartbeat()} method.
*
* @return bool
* @throws OutOfContextException in the absence of the activity execution context.
*/
public static function hasHeartbeatDetails(): bool
Expand Down
4 changes: 0 additions & 4 deletions src/Activity/ActivityContextInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface ActivityContextInterface
*
* @see Activity::getInfo()
*
* @return ActivityInfo
*/
public function getInfo(): ActivityInfo;

Expand All @@ -31,7 +30,6 @@ public function getInfo(): ActivityInfo;
*
* @see Activity::getInput()
*
* @return ValuesInterface
*/
public function getInput(): ValuesInterface;

Expand All @@ -40,7 +38,6 @@ public function getInput(): ValuesInterface;
*
* @see Activity::hasHeartbeatDetails()
*
* @return bool
*/
public function hasHeartbeatDetails(): bool;

Expand All @@ -59,7 +56,6 @@ public function getHeartbeatDetails($type = null);
*
* @see Activity::doNotCompleteOnReturn()
*
* @return void
*/
public function doNotCompleteOnReturn(): void;

Expand Down
20 changes: 0 additions & 20 deletions src/Activity/ActivityInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,16 @@ final class ActivityInfo
*
* @see ActivityCompletionClientInterface::complete()
*
* @var string
*/
#[Marshal(name: 'TaskToken')]
public string $taskToken;

/**
* @var WorkflowType|null
*/
#[Marshal(name: 'WorkflowType', type: NullableType::class, of: WorkflowType::class)]
public ?WorkflowType $workflowType = null;

/**
* @var string
*/
#[Marshal(name: 'WorkflowNamespace')]
public string $workflowNamespace = 'default';

/**
* @var WorkflowExecution|null
*/
#[Marshal(name: 'WorkflowExecution', type: NullableType::class, of: WorkflowExecution::class)]
public ?WorkflowExecution $workflowExecution = null;

Expand All @@ -67,53 +57,44 @@ final class ActivityInfo
*
* @see ActivityCompletionClientInterface::complete()
*
* @var string
*/
#[Marshal(name: 'ActivityID')]
public string $id;

/**
* Type (name) of the activity.
*
* @var ActivityType
*/
#[Marshal(name: 'ActivityType', type: ObjectType::class, of: ActivityType::class)]
public ActivityType $type;

/**
* @var string
*/
#[Marshal(name: 'TaskQueue')]
public string $taskQueue = WorkerFactoryInterface::DEFAULT_TASK_QUEUE;

/**
* Maximum time between heartbeats. 0 means no heartbeat needed.
*
* @var \DateInterval
*/
#[Marshal(name: 'HeartbeatTimeout', type: DateIntervalType::class)]
public \DateInterval $heartbeatTimeout;

/**
* Time of activity scheduled by a workflow
*
* @var \DateTimeInterface
*/
#[Marshal(name: 'ScheduledTime', type: DateTimeType::class)]
public \DateTimeInterface $scheduledTime;

/**
* Time of activity start
*
* @var \DateTimeInterface
*/
#[Marshal(name: 'StartedTime', type: DateTimeType::class)]
public \DateTimeInterface $startedTime;

/**
* Time of activity timeout
*
* @var \DateTimeInterface
*/
#[Marshal(name: 'Deadline', type: DateTimeType::class)]
public \DateTimeInterface $deadline;
Expand All @@ -122,7 +103,6 @@ final class ActivityInfo
* Attempt starts from 1, and increased by 1 for every retry if
* retry policy is specified.
*
* @var int
*/
#[Marshal(name: 'Attempt')]
public int $attempt = 1;
Expand Down
3 changes: 0 additions & 3 deletions src/Activity/ActivityInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ class ActivityInterface
#[Immutable]
public string $prefix = '';

/**
* @param string $prefix
*/
public function __construct(string $prefix = '')
{
$this->prefix = $prefix;
Expand Down
5 changes: 1 addition & 4 deletions src/Activity/ActivityMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ final class ActivityMethod
#[Immutable]
public ?string $name = null;

/**
* @param string|null $name
*/
public function __construct(string $name = null)
public function __construct(?string $name = null)
{
$this->name = $name;
}
Expand Down
Loading

0 comments on commit 70311a7

Please sign in to comment.