Skip to content

Commit 6e12e28

Browse files
authored
Enables functional tests in GitHub actions
1 parent 78f7bb8 commit 6e12e28

File tree

5 files changed

+71
-10
lines changed

5 files changed

+71
-10
lines changed

.github/workflows/testing.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ jobs:
154154
fail-fast: false
155155
matrix:
156156
php: [7.4, 8.0]
157-
os: [ubuntu-latest, windows-latest]
158-
stability: [prefer-lowest, prefer-stable]
157+
os: [ubuntu-latest]
159158

160159
steps:
161160
- name: Set Git To Use LF
@@ -193,7 +192,17 @@ jobs:
193192
with:
194193
timeout_minutes: 5
195194
max_attempts: 5
196-
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress --ignore-platform-reqs
195+
command: composer update --prefer-dist --no-interaction --no-progress --ignore-platform-reqs
196+
197+
- name: Download RoadRunner
198+
run: |
199+
vendor/bin/rr get
197200
198201
- name: Run Tests
199-
run: vendor/bin/phpunit --testsuite=Functional --testdox --verbose
202+
run: |
203+
docker-compose -f ./tests/docker-compose.yaml up -d
204+
sleep 35
205+
chmod +x ./rr
206+
./rr serve -c ./tests/.rr.silent.yaml &
207+
sleep 10
208+
vendor/bin/phpunit --testsuite=Functional --testdox --verbose

src/Internal/Support/DateTime.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ public static function parse($time = null, $tz = null): CarbonInterface
3535

3636
// Note: PHP does not support accuracy greater than 8 (microseconds)
3737
if (\strlen($accuracy) > 8) {
38-
$rounded = \sprintf('%s.%sZ', $datetime, \substr($accuracy, 0, 8));
38+
//$rounded = \sprintf('%s.%sZ', $datetime, \substr($accuracy, 0, 8));
3939

4040
// Trigger warning
41-
$message = \sprintf(self::NOTICE_PRECISION_LOSS, $time, $rounded);
42-
@\trigger_error($message, \E_USER_NOTICE);
41+
//$message = \sprintf(self::NOTICE_PRECISION_LOSS, $time, $rounded);
42+
//@\trigger_error($message, \E_USER_NOTICE);
4343

44-
$time = $rounded;
44+
$time = \sprintf('%s.%sZ', $datetime, \substr($accuracy, 0, 8));
4545
}
4646
}
4747

tests/.rr.silent.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Application configuration
2+
rpc:
3+
listen: tcp://127.0.0.1:6001
4+
5+
server:
6+
command: "php worker.php"
7+
env:
8+
DEBUG: true
9+
10+
# Workflow and activity mesh service
11+
temporal:
12+
address: "localhost:7233"
13+
activities:
14+
num_workers: 4
15+
16+
logs:
17+
mode: none

tests/Functional/Client/ActivityCompletionClientTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function testCompleteAsyncActivityByTokenExceptionally()
154154
$simple->getResult();
155155
} catch (WorkflowFailedException $e) {
156156
$this->assertInstanceOf(ActivityFailure::class, $e->getPrevious());
157-
$this->assertStringContainsString('\AsyncActivityWorkflow', $e->getPrevious()->getMessage());
157+
$this->assertStringContainsString('AsyncActivityWorkflow', $e->getPrevious()->getMessage());
158158

159159
$e = $e->getPrevious();
160160

@@ -191,7 +191,7 @@ public function testCompleteAsyncActivityByTokenExceptionallyById()
191191
$simple->getResult();
192192
} catch (WorkflowFailedException $e) {
193193
$this->assertInstanceOf(ActivityFailure::class, $e->getPrevious());
194-
$this->assertStringContainsString('\AsyncActivityWorkflow', $e->getPrevious()->getMessage());
194+
$this->assertStringContainsString('AsyncActivityWorkflow', $e->getPrevious()->getMessage());
195195

196196
$e = $e->getPrevious();
197197

tests/docker-compose.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: '3.5'
2+
3+
services:
4+
cassandra:
5+
image: cassandra:3.11
6+
ports:
7+
- "9042:9042"
8+
temporal:
9+
image: temporalio/auto-setup:1.6.3
10+
ports:
11+
- "7233:7233"
12+
volumes:
13+
- ${DYNAMIC_CONFIG_DIR:-../config/dynamicconfig}:/etc/temporal/config/dynamicconfig
14+
environment:
15+
- "CASSANDRA_SEEDS=cassandra"
16+
- "DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development.yaml"
17+
depends_on:
18+
- cassandra
19+
temporal-admin-tools:
20+
image: temporalio/admin-tools:1.6.3
21+
stdin_open: true
22+
tty: true
23+
environment:
24+
- "TEMPORAL_CLI_ADDRESS=temporal:7233"
25+
depends_on:
26+
- temporal
27+
temporal-web:
28+
image: temporalio/web:1.6.1
29+
environment:
30+
- "TEMPORAL_GRPC_ENDPOINT=temporal:7233"
31+
- "TEMPORAL_PERMIT_WRITE_API=true"
32+
ports:
33+
- "8088:8088"
34+
depends_on:
35+
- temporal

0 commit comments

Comments
 (0)