Skip to content

Commit 5e3a863

Browse files
loks0nclaude
andcommitted
Chore: Rename CI jobs and split tests into unit/e2e
Rename jobs per team convention: Lint -> Format, Static Analysis -> Analyze, Benchmarks -> Benchmark. Split the single Tests matrix into three jobs: Tests / Unit (runs on host PHP, no docker), Tests / E2E / FPM, and Tests / E2E / Swoole. Adds phpunit testsuites (unit, e2e-fpm, e2e-swoole) and moves BaseTest trait to tests/ so it autoloads via its existing PSR-4 namespace. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 04a750f commit 5e3a863

4 files changed

Lines changed: 69 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
branches: [master, "*.x"]
77

88
jobs:
9-
lint:
10-
name: Lint
9+
format:
10+
name: Format
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
@@ -17,8 +17,8 @@ jobs:
1717
docker run --rm -v "$PWD":/app -w /app composer:2.7 sh -c \
1818
"composer install --profile --ignore-platform-reqs --no-interaction && composer lint"
1919
20-
static:
21-
name: Static Analysis
20+
analyze:
21+
name: Analyze
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v4
@@ -48,28 +48,68 @@ jobs:
4848
- name: PHPStan
4949
run: composer check
5050

51-
tests:
52-
name: Tests (${{ matrix.adapter }})
51+
unit:
52+
name: Tests / Unit
5353
runs-on: ubuntu-latest
54-
strategy:
55-
fail-fast: false
56-
matrix:
57-
adapter: [fpm, swoole]
5854
steps:
5955
- uses: actions/checkout@v4
6056

61-
- name: Build and wait for ${{ matrix.adapter }} to be healthy
62-
run: docker compose up -d --build --wait ${{ matrix.adapter }}
57+
- uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: '8.2'
60+
extensions: swoole
61+
coverage: none
62+
63+
- name: Get composer cache directory
64+
id: composer-cache
65+
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
66+
67+
- uses: actions/cache@v4
68+
with:
69+
path: ${{ steps.composer-cache.outputs.dir }}
70+
key: composer-${{ hashFiles('composer.lock') }}
71+
restore-keys: composer-
72+
73+
- name: Install dependencies
74+
run: composer install --prefer-dist --no-progress --no-interaction
75+
76+
- name: Run unit tests
77+
run: vendor/bin/phpunit --configuration phpunit.xml --testsuite unit
78+
79+
e2e-fpm:
80+
name: Tests / E2E / FPM
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/checkout@v4
84+
85+
- name: Build and wait for fpm to be healthy
86+
run: docker compose up -d --build --wait fpm
87+
88+
- name: Run E2E tests
89+
run: docker compose exec -T fpm vendor/bin/phpunit --configuration phpunit.xml --testsuite e2e-fpm
90+
91+
- name: Dump container logs on failure
92+
if: failure()
93+
run: docker compose logs fpm
94+
95+
e2e-swoole:
96+
name: Tests / E2E / Swoole
97+
runs-on: ubuntu-latest
98+
steps:
99+
- uses: actions/checkout@v4
100+
101+
- name: Build and wait for swoole to be healthy
102+
run: docker compose up -d --build --wait swoole
63103

64-
- name: Run tests
65-
run: docker compose exec -T ${{ matrix.adapter }} vendor/bin/phpunit --configuration phpunit.xml
104+
- name: Run E2E tests
105+
run: docker compose exec -T swoole vendor/bin/phpunit --configuration phpunit.xml --testsuite e2e-swoole
66106

67107
- name: Dump container logs on failure
68108
if: failure()
69-
run: docker compose logs ${{ matrix.adapter }}
109+
run: docker compose logs swoole
70110

71-
bench:
72-
name: Benchmarks
111+
benchmark:
112+
name: Benchmark
73113
runs-on: ubuntu-latest
74114
steps:
75115
- uses: actions/checkout@v4

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"Utopia\\": "src/"
1616
}
1717
},
18-
"autoload-dev": {
18+
"autoload-dev": {
1919
"psr-4": {
20-
"Utopia\\Http\\Tests\\": "tests/",
21-
"Tests\\E2E\\": "tests/e2e"
22-
}
20+
"Utopia\\Http\\Tests\\": "tests/",
21+
"Tests\\E2E\\": "tests/e2e"
22+
}
2323
},
2424
"scripts": {
2525
"lint": "vendor/bin/pint --test",

phpunit.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@
1010
stopOnFailure="false"
1111
>
1212
<testsuites>
13-
<testsuite name="Application Test Suite">
13+
<testsuite name="unit">
1414
<directory>./tests</directory>
15+
<exclude>./tests/e2e</exclude>
16+
</testsuite>
17+
<testsuite name="e2e-fpm">
18+
<file>./tests/e2e/ResponseFPMTest.php</file>
19+
</testsuite>
20+
<testsuite name="e2e-swoole">
21+
<file>./tests/e2e/ResponseSwooleTest.php</file>
1522
</testsuite>
1623
</testsuites>
1724
</phpunit>

0 commit comments

Comments
 (0)