Skip to content

Commit b177152

Browse files
authored
Merge pull request #7: Update Workflow options
2 parents b9ab40b + 3b35496 commit b177152

14 files changed

Lines changed: 204 additions & 152 deletions

.github/workflows/cs-fix.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.release-please-config:
2+
json:
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
8+
name: Fix Code Style
9+
10+
jobs:
11+
cs-fix:
12+
permissions:
13+
contents: write
14+
uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master

.github/workflows/psalm.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,12 @@ jobs:
4141
extensions: dom
4242

4343
- name: Check Out Code
44-
uses: actions/checkout@v4
44+
uses: actions/checkout@v5
4545
with:
4646
fetch-depth: 1
4747

48-
- name: Get Composer Cache Directory
49-
id: composer-cache
50-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
51-
52-
- name: Cache Dependencies
53-
uses: actions/cache@v3
54-
with:
55-
path: ${{ steps.composer-cache.outputs.dir }}
56-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
57-
restore-keys: php-${{ matrix.php }}-${{ runner.os }}-composer-
48+
- name: 📥 Install dependencies with composer
49+
uses: ramsey/composer-install@v3
5850

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

.github/workflows/run-test-suite.yml

Lines changed: 28 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -39,72 +39,42 @@ on:
3939

4040
jobs:
4141
test:
42-
name: (PHP ${{ matrix.php }}, ${{ matrix.os }}, ${{ matrix.dependencies }} deps
42+
timeout-minutes: 4
4343
runs-on: ${{ matrix.os }}
44-
timeout-minutes: ${{ matrix.timeout-minutes }}
45-
env: { GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' }
44+
concurrency:
45+
cancel-in-progress: true
46+
group: testing-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.php-version }}-${{ matrix.dependencies }}
4647
strategy:
47-
fail-fast: ${{ inputs.fail-fast }}
48+
fail-fast: false
4849
matrix:
49-
php: [ 8.1, 8.2 ]
50-
os: [ ubuntu-latest, windows-latest ]
51-
dependencies: [ lowest , highest ]
52-
timeout-minutes: [ '${{ inputs.test-timeout }}' ]
53-
exclude:
54-
- os: windows-latest
55-
php: 8.2
56-
include:
57-
- os: ubuntu-latest
58-
php: 8.3
59-
dependencies: highest
60-
timeout-minutes: 40
50+
os:
51+
- ubuntu-latest
52+
php-version:
53+
- '8.1'
54+
- '8.2'
55+
- '8.3'
56+
- '8.4'
57+
dependencies:
58+
- lowest
59+
- locked
60+
- highest
6161
steps:
62-
- name: Set Git To Use LF
63-
run: |
64-
git config --global core.autocrlf false
65-
git config --global core.eol lf
62+
- name: 📦 Check out the codebase
63+
uses: actions/checkout@v5
6664

67-
- name: Setup PHP ${{ matrix.php }}
65+
- name: 🛠️ Setup PHP
6866
uses: shivammathur/setup-php@v2
6967
with:
70-
php-version: ${{ matrix.php }}
71-
tools: composer:v2
72-
extensions: sockets, curl
68+
php-version: ${{ matrix.php-version }}
69+
ini-values: error_reporting=E_ALL
7370

74-
- name: Check Out Code
75-
uses: actions/checkout@v4
76-
with:
77-
fetch-depth: 1
78-
79-
- name: Validate composer.json and composer.lock
80-
run: composer validate --strict
81-
82-
- name: Get Composer Cache Directory
83-
id: composer-cache
84-
run: |
85-
echo "::set-output name=dir::$(composer config cache-files-dir)"
71+
- name: 🤖 Validate composer.json and composer.lock
72+
run: composer validate --ansi --strict
8673

87-
- name: Cache Composer Dependencies
88-
uses: actions/cache@v3
74+
- name: 📥 Install dependencies with composer
75+
uses: ramsey/composer-install@v3
8976
with:
90-
path: ${{ steps.composer-cache.outputs.dir }}
91-
key: php-${{ matrix.php }}-${{ matrix.os }}-composer-${{ hashFiles('**/composer.lock') }}
92-
restore-keys: |
93-
php-${{ matrix.php }}-${{ matrix.os }}-composer-
94-
95-
- name: Install lowest dependencies from composer.json
96-
if: matrix.dependencies == 'lowest'
97-
run: composer update --no-interaction --no-progress --prefer-lowest
98-
99-
- name: Validate lowest dependencies
100-
if: matrix.dependencies == 'lowest'
101-
env:
102-
COMPOSER_POOL_OPTIMIZER: 0
103-
run: vendor/bin/validate-prefer-lowest
104-
105-
- name: Install highest dependencies from composer.json
106-
if: matrix.dependencies == 'highest'
107-
run: composer update --no-interaction --no-progress
77+
dependency-versions: ${{ matrix.dependencies }}
10878

109-
- name: Run tests
110-
run: vendor/bin/pest --testdox
79+
- name: 🧪 Run tests
80+
run: composer test

.github/workflows/security.yml

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,33 +31,30 @@ jobs:
3131
fail-fast: false
3232
matrix:
3333
# Note: This workflow requires only the LATEST version of PHP
34-
php: [ 8.2 ]
35-
os: [ ubuntu-latest ]
34+
os:
35+
- ubuntu-latest
36+
php-version:
37+
- '8.2'
38+
dependencies:
39+
- locked
3640
steps:
37-
- name: Set up PHP ${{ matrix.php }}
38-
uses: shivammathur/setup-php@v2
39-
with:
40-
php-version: ${{ matrix.php }}
41-
extensions: dom, sockets, grpc, curl
41+
- name: 📦 Check out the codebase
42+
uses: actions/checkout@v5
4243

43-
- name: Check Out Code
44-
uses: actions/checkout@v4
44+
- name: 🛠️ Setup PHP
45+
uses: shivammathur/setup-php@v2
4546
with:
46-
fetch-depth: 1
47+
php-version: ${{ matrix.php-version }}
48+
ini-values: error_reporting=E_ALL
49+
coverage: none
4750

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

52-
- name: Cache Dependencies
53-
uses: actions/cache@v3
54+
- name: 📥 Install dependencies with composer
55+
uses: ramsey/composer-install@v3
5456
with:
55-
path: ${{ steps.composer-cache.outputs.dir }}
56-
key: php-${{ matrix.php }}-${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
57-
restore-keys: php-${{ matrix.php }}-${{ runner.os }}-composer-
58-
59-
- name: Install Composer Dependencies
60-
run: composer install --prefer-dist --no-interaction
57+
dependency-versions: ${{ matrix.dependencies }}
6158

62-
- name: Verify
63-
run: composer require --dev roave/security-advisories:dev-latest
59+
- name: 🐛 Check installed packages for security vulnerability advisories
60+
run: composer audit --ansi

.php-cs-fixer.dist.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
require_once 'vendor/autoload.php';
6+
7+
return \Spiral\CodeStyle\Builder::create()
8+
->include(__DIR__ . '/src')
9+
->include(__DIR__ . '/tests')
10+
->include(__FILE__)
11+
->allowRisky(true)
12+
->build();

composer.json

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
{
99
"name": "Aleksei Gagarin (roxblnfk)",
1010
"homepage": "https://github.com/roxblnfk"
11-
},
12-
{
13-
"name": "Pavel Buchnev (butschster)",
14-
"homepage": "https://github.com/butschster"
1511
}
1612
],
1713
"autoload": {
@@ -28,17 +24,13 @@
2824
{
2925
"type": "patreon",
3026
"url": "https://patreon.com/roxblnfk"
31-
},
32-
{
33-
"type": "patreon",
34-
"url": "https://patreon.com/butschster"
3527
}
3628
],
3729
"minimum-stability": "dev",
3830
"prefer-stable": true,
3931
"require": {
4032
"php": ">=8.1",
41-
"temporal/sdk": "^2.8"
33+
"temporal/sdk": "^2.15"
4234
},
4335
"suggest": {
4436
"buggregator/trap": "For better debugging and protobuf messages dumping"
@@ -47,13 +39,31 @@
4739
"buggregator/trap": "^1.4",
4840
"dereuromark/composer-prefer-lowest": "^0.1.10",
4941
"phpunit/phpunit": "^10.5",
50-
"vimeo/psalm": "^5.23",
51-
"pestphp/pest": "^2.34",
52-
"pestphp/pest-plugin-arch": "^2.7"
42+
"spiral/code-style": "^2.3.0",
43+
"ta-tikoma/phpunit-architecture-test": "^0.8.4",
44+
"vimeo/psalm": "^6.13"
5345
},
5446
"config": {
5547
"allow-plugins": {
5648
"pestphp/pest-plugin": false
5749
}
50+
},
51+
"scripts": {
52+
"cs:diff": "php-cs-fixer fix --dry-run -v --diff",
53+
"cs:fix": "php-cs-fixer fix -v",
54+
"psalm": "psalm",
55+
"psalm:baseline": "psalm --set-baseline=psalm-baseline.xml",
56+
"psalm:ci": "psalm --output-format=github --shepherd --show-info=false --stats --threads=4",
57+
"test": [
58+
"phpunit --color=always --no-coverage"
59+
],
60+
"test:unit": [
61+
"@putenv XDEBUG_MODE=coverage",
62+
"phpunit --color=always --testsuite=Unit"
63+
],
64+
"test:arch": [
65+
"@putenv XDEBUG_MODE=coverage",
66+
"phpunit --color=always --testsuite=Arch"
67+
]
5868
}
5969
}

phpunit.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
44
backupGlobals="false"
55
colors="true"
6+
cacheResultFile="runtime/phpunit/result.cache"
67
processIsolation="false"
78
executionOrder="random"
89
failOnRisky="true"
910
failOnWarning="true"
1011
stopOnFailure="false"
1112
stopOnError="false"
1213
stderr="true"
13-
cacheDirectory=".phpunit.cache"
1414
resolveDependencies="true"
15+
displayDetailsOnTestsThatTriggerDeprecations="true"
1516
>
1617
<testsuites>
1718
<testsuite name="Unit">

src/Factory/ActivityStub.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Temporal\Support\Factory;
66

7-
use DateInterval;
87
use Temporal\Activity\ActivityOptions;
98
use Temporal\Internal\Workflow\ActivityProxy;
109
use Temporal\Support\Attribute\RetryPolicy;
@@ -15,7 +14,6 @@
1514
use Temporal\Support\Internal\RetryOptions;
1615
use Temporal\Workflow;
1716
use Temporal\Workflow\ActivityStubInterface;
18-
use Throwable;
1917

2018
final class ActivityStub
2119
{
@@ -29,29 +27,28 @@ final class ActivityStub
2927
* @param int<0, max>|null $retryAttempts Maximum number of attempts. When exceeded the retries stop even
3028
* if not expired yet. If not set or set to 0, it means unlimited, and rely on activity
3129
* {@see ActivityOptions::$scheduleToCloseTimeout} to stop.
32-
* @param DateInterval|string|int|null $retryInitInterval Backoff interval for the first retry.
30+
* @param \DateInterval|string|int|null $retryInitInterval Backoff interval for the first retry.
3331
* If $retryBackoff is 1.0 then it is used for all retries.
3432
* Int value in seconds.
35-
* @param DateInterval|string|int|null $retryMaxInterval Maximum backoff interval between retries.
33+
* @param \DateInterval|string|int|null $retryMaxInterval Maximum backoff interval between retries.
3634
* Exponential backoff leads to interval increase. This value is the cap of the interval.
3735
* Int value in seconds.
3836
* Default is 100x of $retryInitInterval.
3937
* @param float|null $retryBackoff Coefficient used to calculate the next retry backoff interval.
4038
* The next retry interval is previous interval multiplied by this coefficient.
4139
* Note: Must be greater than 1.0
42-
* @param list<class-string<Throwable>> $nonRetryables Non-retriable errors. Temporal server will stop retry
40+
* @param list<class-string<\Throwable>> $nonRetryables Non-retriable errors. Temporal server will stop retry
4341
* if error type matches this list.
44-
* @param DateInterval|string|int $scheduleToStartTimeout Time activity can stay in task queue before it
42+
* @param \DateInterval|string|int $scheduleToStartTimeout Time activity can stay in task queue before it
4543
* is picked up by a worker. If $scheduleToCloseTimeout is not provided then
4644
* both this and $startToCloseTimeout are required.
47-
* @param DateInterval|string|int $startToCloseTimeout Maximum activity execution time after it was sent
45+
* @param \DateInterval|string|int $startToCloseTimeout Maximum activity execution time after it was sent
4846
* to a worker. If $scheduleToCloseTimeout is not provided then both this
4947
* and $scheduleToStartTimeout are required.
50-
* @param DateInterval|string|int $scheduleToCloseTimeout Overall timeout workflow is willing to wait for
48+
* @param \DateInterval|string|int $scheduleToCloseTimeout Overall timeout workflow is willing to wait for
5149
* activity to complete. It includes time in a task queue ($scheduleToStartTimeout) plus activity
5250
* execution time ($startToCloseTimeout).
5351
* Either this option or both $scheduleToStartTimeout and $startToCloseTimeout are required.
54-
* @param DateInterval|string|int $heartbeatTimeout
5552
* @param \Stringable|non-empty-string|null $activityId Business level activity ID, this is not needed
5653
* for most of the cases. If you have to specify this, then talk to the temporal team.
5754
* This is something will be done in the future.
@@ -99,7 +96,7 @@ public static function activity(
9996
$scheduleToCloseTimeout === 0 or $options = $options->withScheduleToCloseTimeout($scheduleToCloseTimeout);
10097
$heartbeatTimeout === 0 or $options = $options->withHeartbeatTimeout($heartbeatTimeout);
10198
// Activity ID
102-
$activityId === null or $options = $options->withActivityId((string)$activityId);
99+
$activityId === null or $options = $options->withActivityId((string) $activityId);
103100
$cancellationType === 0 or $options = $options->withCancellationType($cancellationType);
104101

105102
return $class === null

0 commit comments

Comments
 (0)