Skip to content

Commit 60bcad8

Browse files
loks0nclaude
andauthored
Chore: Fix dev env friction, bump PHP floor to 8.3, add PHP matrix (#245)
* Chore: Fix dev env friction, bump PHP floor to 8.3, add PHP matrix - Dockerfiles now ship composer, composer.json/lock, phpstan.neon, pint.json so composer scripts (test/analyze/format) work in-container - CONTRIBUTING: document host-native inner loop; fix wrong service name (web -> fpm); drop stale psalm reference; add swoole exec path - Drop PHP 8.2 support; bump require/platform pin and FPM base image to 8.3 - CI unit job runs a matrix over PHP 8.3 / 8.4 / 8.5 with per-version composer cache keys; coverage (pcov + clover artifact) collected on 8.3 - example/docker-compose.yml: drop deprecated version key Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Chore: Regenerate composer.lock for PHP 8.3 floor The require.php / platform bump changed composer.json's content-hash, so the lock was reporting out-of-date. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e282738 commit 60bcad8

9 files changed

Lines changed: 68 additions & 23 deletions

File tree

.github/workflows/ci.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
- uses: shivammathur/setup-php@v2
2727
with:
28-
php-version: '8.2'
28+
php-version: '8.3'
2929
extensions: swoole
3030
coverage: none
3131

@@ -49,16 +49,20 @@ jobs:
4949
run: composer analyze
5050

5151
unit:
52-
name: Tests / Unit
52+
name: Tests / Unit / PHP ${{ matrix.php }}
5353
runs-on: ubuntu-latest
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
php: ['8.3', '8.4', '8.5']
5458
steps:
5559
- uses: actions/checkout@v6
5660

5761
- uses: shivammathur/setup-php@v2
5862
with:
59-
php-version: '8.2'
63+
php-version: ${{ matrix.php }}
6064
extensions: swoole
61-
coverage: none
65+
coverage: ${{ matrix.php == '8.3' && 'pcov' || 'none' }}
6266

6367
- name: Get composer cache directory
6468
id: composer-cache
@@ -67,15 +71,28 @@ jobs:
6771
- uses: actions/cache@v5
6872
with:
6973
path: ${{ steps.composer-cache.outputs.dir }}
70-
key: composer-${{ hashFiles('composer.lock') }}
71-
restore-keys: composer-
74+
key: composer-${{ matrix.php }}-${{ hashFiles('composer.lock') }}
75+
restore-keys: composer-${{ matrix.php }}-
7276

7377
- name: Install dependencies
7478
run: composer install --prefer-dist --no-progress --no-interaction --ignore-platform-req=ext-opentelemetry
7579

7680
- name: Run unit tests
81+
if: matrix.php != '8.3'
7782
run: vendor/bin/phpunit --configuration phpunit.xml --testsuite unit
7883

84+
- name: Run unit tests with coverage
85+
if: matrix.php == '8.3'
86+
run: vendor/bin/phpunit --configuration phpunit.xml --testsuite unit --coverage-text --coverage-clover coverage.xml
87+
88+
- name: Upload coverage artifact
89+
if: matrix.php == '8.3' && always()
90+
uses: actions/upload-artifact@v7
91+
with:
92+
name: coverage-clover
93+
path: coverage.xml
94+
if-no-files-found: ignore
95+
7996
e2e:
8097
name: Tests / E2E / ${{ matrix.adapter.display }}
8198
runs-on: ubuntu-latest

CONTRIBUTING.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,33 @@ $ git push origin [name_of_your_new_branch]
6464
8. After approval, merge your PR
6565
9. GitHub will automatically delete the branch after the merge is done. (they can still be restored).
6666

67-
### Testing
67+
### Development environment
6868

69-
- `docker compose up -d`
70-
- `docker compose exec web vendor/bin/phpunit --configuration phpunit.xml`
71-
- `docker compose exec web vendor/bin/psalm --show-info=true`
69+
The repo ships two server adapters (FPM and Swoole), each with its own container. For most inner-loop work you don't need Docker — install deps on the host and run the unit suite directly:
70+
71+
```
72+
composer install --ignore-platform-req=ext-opentelemetry
73+
composer test # unit suite
74+
composer analyze # PHPStan
75+
composer format:check
76+
composer format # auto-fix
77+
```
78+
79+
The end-to-end suites need the adapter containers:
80+
81+
```
82+
docker compose up -d --build
83+
docker compose exec fpm vendor/bin/phpunit --configuration phpunit.xml --testsuite e2e-fpm
84+
docker compose exec swoole vendor/bin/phpunit --configuration phpunit.xml --testsuite e2e-swoole
85+
```
86+
87+
You can also run the unit suite and lint/analyze inside either container — `composer.json`, `phpstan.neon`, and `pint.json` are all present in the image:
88+
89+
```
90+
docker compose exec fpm composer test
91+
docker compose exec fpm composer analyze
92+
docker compose exec fpm composer format:check
93+
```
7294

7395
## Introducing New Features
7496

Dockerfile.fpm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN composer install --ignore-platform-reqs --optimize-autoloader \
1313
--no-plugins --no-scripts --prefer-dist \
1414
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
1515

16-
FROM php:8.2-fpm-alpine AS final
16+
FROM php:8.3-fpm-alpine AS final
1717
LABEL maintainer="team@appwrite.io"
1818

1919
ENV DEBIAN_FRONTEND=noninteractive \
@@ -34,10 +34,14 @@ COPY ./tests/docker/www.conf /usr/local/etc/php-fpm.d/www.conf
3434
# Script
3535
COPY ./tests/docker/start /usr/local/bin/start
3636

37+
# Composer binary (for running scripts inside the container)
38+
COPY --from=composer:2.7 /usr/bin/composer /usr/local/bin/composer
39+
3740
# Add PHP Source Code
3841
COPY ./src /usr/share/nginx/html/src
3942
COPY ./tests /usr/share/nginx/html/tests
4043
COPY ./phpunit.xml /usr/share/nginx/html/phpunit.xml
44+
COPY ./composer.json ./composer.lock ./phpstan.neon ./pint.json /usr/share/nginx/html/
4145
COPY --from=step0 /usr/local/src/vendor /usr/share/nginx/html/vendor
4246

4347
# Supervisord Conf

Dockerfile.swoole

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ LABEL maintainer="team@appwrite.io"
1818

1919
WORKDIR /usr/src/code
2020

21+
# Composer binary (for running scripts inside the container)
22+
COPY --from=composer:2.7 /usr/bin/composer /usr/local/bin/composer
23+
2124
COPY ./src /usr/src/code/src
2225
COPY ./tests /usr/src/code/tests
2326
COPY ./phpunit.xml /usr/src/code/phpunit.xml
27+
COPY ./composer.json ./composer.lock ./phpstan.neon ./pint.json /usr/src/code/
2428
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor
2529

2630
EXPOSE 80

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ To learn more about architecture and features for this library, check out more i
259259

260260
## System Requirements
261261

262-
Utopia HTTP requires PHP 8.2 or later. We recommend using the latest PHP version whenever possible.
262+
Utopia HTTP requires PHP 8.3 or later. We recommend using the latest PHP version whenever possible.
263263

264264
## More from Utopia
265265

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"test": "vendor/bin/phpunit --configuration phpunit.xml"
2929
},
3030
"require": {
31-
"php": ">=8.2",
31+
"php": ">=8.3",
3232
"utopia-php/di": "0.3.*",
3333
"utopia-php/servers": "0.3.*",
3434
"utopia-php/compression": "0.1.*",
@@ -40,7 +40,7 @@
4040
},
4141
"config": {
4242
"platform": {
43-
"php": "8.2",
43+
"php": "8.3",
4444
"ext-opentelemetry": "1.0.0",
4545
"ext-protobuf": "4.26.1"
4646
},

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Getting-Starting-Guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,6 @@ Http::shutdown(function($request) {
269269
# Running Locally
270270
If you have PHP and Composer installed on your device, you can run Utopia apps locally by downloading the `utopia-php/http` dependency using `composer require utopia-php/http` command.
271271

272-
> Utopia HTTP requires PHP 8.2 or later. We recommend using the latest PHP version whenever possible.
272+
> Utopia HTTP requires PHP 8.3 or later. We recommend using the latest PHP version whenever possible.
273273
274274
Wonderful! 😄 You’re all set to create a basic demo app using the Utopia HTTP. If you have any issues or questions feel free to reach out to us on our [Discord Server](https://appwrite.io/discord).

example/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
server:
53
build:

0 commit comments

Comments
 (0)