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
14 changes: 14 additions & 0 deletions .github/workflows/cs-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.release-please-config:
json:
on:
push:
branches:
- '*'

name: Fix Code Style

jobs:
cs-fix:
permissions:
contents: write
uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master
14 changes: 3 additions & 11 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,12 @@ jobs:
extensions: dom

- name: Check Out Code
uses: actions/checkout@v4
uses: actions/checkout@v5
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 dependencies with composer
uses: ramsey/composer-install@v3

- name: Install Composer Dependencies
run: composer install --prefer-dist --no-interaction
Expand Down
86 changes: 28 additions & 58 deletions .github/workflows/run-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,72 +39,42 @@ on:

jobs:
test:
name: (PHP ${{ matrix.php }}, ${{ matrix.os }}, ${{ matrix.dependencies }} deps
timeout-minutes: 4
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ matrix.timeout-minutes }}
env: { GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' }
concurrency:
cancel-in-progress: true
group: testing-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.php-version }}-${{ matrix.dependencies }}
strategy:
fail-fast: ${{ inputs.fail-fast }}
fail-fast: false
matrix:
php: [ 8.1, 8.2 ]
os: [ ubuntu-latest, windows-latest ]
dependencies: [ lowest , highest ]
timeout-minutes: [ '${{ inputs.test-timeout }}' ]
exclude:
- os: windows-latest
php: 8.2
include:
- os: ubuntu-latest
php: 8.3
dependencies: highest
timeout-minutes: 40
os:
- ubuntu-latest
php-version:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
dependencies:
- lowest
- locked
- highest
steps:
- name: Set Git To Use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: 📦 Check out the codebase
uses: actions/checkout@v5

- name: Setup PHP ${{ matrix.php }}
- name: 🛠️ Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: sockets, curl
php-version: ${{ matrix.php-version }}
ini-values: error_reporting=E_ALL

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

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

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: 🤖 Validate composer.json and composer.lock
run: composer validate --ansi --strict

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

- name: Install lowest dependencies from composer.json
if: matrix.dependencies == 'lowest'
run: composer update --no-interaction --no-progress --prefer-lowest

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

- name: Install highest dependencies from composer.json
if: matrix.dependencies == 'highest'
run: composer update --no-interaction --no-progress
dependency-versions: ${{ matrix.dependencies }}

- name: Run tests
run: vendor/bin/pest --testdox
- name: 🧪 Run tests
run: composer test
43 changes: 20 additions & 23 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,30 @@ jobs:
fail-fast: false
matrix:
# Note: This workflow requires only the LATEST version of PHP
php: [ 8.2 ]
os: [ ubuntu-latest ]
os:
- ubuntu-latest
php-version:
- '8.2'
dependencies:
- locked
steps:
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, sockets, grpc, curl
- name: 📦 Check out the codebase
uses: actions/checkout@v5

- name: Check Out Code
uses: actions/checkout@v4
- name: 🛠️ Setup PHP
uses: shivammathur/setup-php@v2
with:
fetch-depth: 1
php-version: ${{ matrix.php-version }}
ini-values: error_reporting=E_ALL
coverage: none

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: 🤖 Validate composer.json and composer.lock
run: composer validate --ansi --strict

- name: Cache Dependencies
uses: actions/cache@v3
- name: 📥 Install dependencies with composer
uses: ramsey/composer-install@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: php-${{ matrix.php }}-${{ 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
dependency-versions: ${{ matrix.dependencies }}

- name: Verify
run: composer require --dev roave/security-advisories:dev-latest
- name: 🐛 Check installed packages for security vulnerability advisories
run: composer audit --ansi
12 changes: 12 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

require_once 'vendor/autoload.php';

return \Spiral\CodeStyle\Builder::create()
->include(__DIR__ . '/src')
->include(__DIR__ . '/tests')
->include(__FILE__)
->allowRisky(true)
->build();
34 changes: 22 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
{
"name": "Aleksei Gagarin (roxblnfk)",
"homepage": "https://github.com/roxblnfk"
},
{
"name": "Pavel Buchnev (butschster)",
"homepage": "https://github.com/butschster"
}
],
"autoload": {
Expand All @@ -28,17 +24,13 @@
{
"type": "patreon",
"url": "https://patreon.com/roxblnfk"
},
{
"type": "patreon",
"url": "https://patreon.com/butschster"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"temporal/sdk": "^2.8"
"temporal/sdk": "^2.15"
},
"suggest": {
"buggregator/trap": "For better debugging and protobuf messages dumping"
Expand All @@ -47,13 +39,31 @@
"buggregator/trap": "^1.4",
"dereuromark/composer-prefer-lowest": "^0.1.10",
"phpunit/phpunit": "^10.5",
"vimeo/psalm": "^5.23",
"pestphp/pest": "^2.34",
"pestphp/pest-plugin-arch": "^2.7"
"spiral/code-style": "^2.3.0",
"ta-tikoma/phpunit-architecture-test": "^0.8.4",
"vimeo/psalm": "^6.13"
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": false
}
},
"scripts": {
"cs:diff": "php-cs-fixer fix --dry-run -v --diff",
"cs:fix": "php-cs-fixer fix -v",
"psalm": "psalm",
"psalm:baseline": "psalm --set-baseline=psalm-baseline.xml",
"psalm:ci": "psalm --output-format=github --shepherd --show-info=false --stats --threads=4",
"test": [
"phpunit --color=always --no-coverage"
],
"test:unit": [
"@putenv XDEBUG_MODE=coverage",
"phpunit --color=always --testsuite=Unit"
],
"test:arch": [
"@putenv XDEBUG_MODE=coverage",
"phpunit --color=always --testsuite=Arch"
]
}
}
3 changes: 2 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
cacheResultFile="runtime/phpunit/result.cache"
processIsolation="false"
executionOrder="random"
failOnRisky="true"
failOnWarning="true"
stopOnFailure="false"
stopOnError="false"
stderr="true"
cacheDirectory=".phpunit.cache"
resolveDependencies="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
>
<testsuites>
<testsuite name="Unit">
Expand Down
17 changes: 7 additions & 10 deletions src/Factory/ActivityStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Temporal\Support\Factory;

use DateInterval;
use Temporal\Activity\ActivityOptions;
use Temporal\Internal\Workflow\ActivityProxy;
use Temporal\Support\Attribute\RetryPolicy;
Expand All @@ -15,7 +14,6 @@
use Temporal\Support\Internal\RetryOptions;
use Temporal\Workflow;
use Temporal\Workflow\ActivityStubInterface;
use Throwable;

final class ActivityStub
{
Expand All @@ -29,29 +27,28 @@ final class ActivityStub
* @param int<0, max>|null $retryAttempts Maximum number of attempts. When exceeded the retries stop even
* if not expired yet. If not set or set to 0, it means unlimited, and rely on activity
* {@see ActivityOptions::$scheduleToCloseTimeout} to stop.
* @param DateInterval|string|int|null $retryInitInterval Backoff interval for the first retry.
* @param \DateInterval|string|int|null $retryInitInterval Backoff interval for the first retry.
* If $retryBackoff is 1.0 then it is used for all retries.
* Int value in seconds.
* @param DateInterval|string|int|null $retryMaxInterval Maximum backoff interval between retries.
* @param \DateInterval|string|int|null $retryMaxInterval Maximum backoff interval between retries.
* Exponential backoff leads to interval increase. This value is the cap of the interval.
* Int value in seconds.
* Default is 100x of $retryInitInterval.
* @param float|null $retryBackoff Coefficient used to calculate the next retry backoff interval.
* The next retry interval is previous interval multiplied by this coefficient.
* Note: Must be greater than 1.0
* @param list<class-string<Throwable>> $nonRetryables Non-retriable errors. Temporal server will stop retry
* @param list<class-string<\Throwable>> $nonRetryables Non-retriable errors. Temporal server will stop retry
* if error type matches this list.
* @param DateInterval|string|int $scheduleToStartTimeout Time activity can stay in task queue before it
* @param \DateInterval|string|int $scheduleToStartTimeout Time activity can stay in task queue before it
* is picked up by a worker. If $scheduleToCloseTimeout is not provided then
* both this and $startToCloseTimeout are required.
* @param DateInterval|string|int $startToCloseTimeout Maximum activity execution time after it was sent
* @param \DateInterval|string|int $startToCloseTimeout Maximum activity execution time after it was sent
* to a worker. If $scheduleToCloseTimeout is not provided then both this
* and $scheduleToStartTimeout are required.
* @param DateInterval|string|int $scheduleToCloseTimeout Overall timeout workflow is willing to wait for
* @param \DateInterval|string|int $scheduleToCloseTimeout Overall timeout workflow is willing to wait for
* activity to complete. It includes time in a task queue ($scheduleToStartTimeout) plus activity
* execution time ($startToCloseTimeout).
* Either this option or both $scheduleToStartTimeout and $startToCloseTimeout are required.
* @param DateInterval|string|int $heartbeatTimeout
* @param \Stringable|non-empty-string|null $activityId Business level activity ID, this is not needed
* for most of the cases. If you have to specify this, then talk to the temporal team.
* This is something will be done in the future.
Expand Down Expand Up @@ -99,7 +96,7 @@ public static function activity(
$scheduleToCloseTimeout === 0 or $options = $options->withScheduleToCloseTimeout($scheduleToCloseTimeout);
$heartbeatTimeout === 0 or $options = $options->withHeartbeatTimeout($heartbeatTimeout);
// Activity ID
$activityId === null or $options = $options->withActivityId((string)$activityId);
$activityId === null or $options = $options->withActivityId((string) $activityId);
$cancellationType === 0 or $options = $options->withCancellationType($cancellationType);

return $class === null
Expand Down
Loading
Loading