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
29 changes: 23 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
extensions: swoole
coverage: none

Expand All @@ -49,16 +49,20 @@ jobs:
run: composer analyze

unit:
name: Tests / Unit
name: Tests / Unit / PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v6

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: ${{ matrix.php }}
extensions: swoole
coverage: none
coverage: ${{ matrix.php == '8.3' && 'pcov' || 'none' }}

- name: Get composer cache directory
id: composer-cache
Expand All @@ -67,15 +71,28 @@ jobs:
- uses: actions/cache@v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ hashFiles('composer.lock') }}
restore-keys: composer-
key: composer-${{ matrix.php }}-${{ hashFiles('composer.lock') }}
restore-keys: composer-${{ matrix.php }}-

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

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

- name: Run unit tests with coverage
if: matrix.php == '8.3'
run: vendor/bin/phpunit --configuration phpunit.xml --testsuite unit --coverage-text --coverage-clover coverage.xml

- name: Upload coverage artifact
if: matrix.php == '8.3' && always()
uses: actions/upload-artifact@v7
with:
name: coverage-clover
path: coverage.xml
if-no-files-found: ignore

e2e:
name: Tests / E2E / ${{ matrix.adapter.display }}
runs-on: ubuntu-latest
Expand Down
30 changes: 26 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,33 @@ $ git push origin [name_of_your_new_branch]
8. After approval, merge your PR
9. GitHub will automatically delete the branch after the merge is done. (they can still be restored).

### Testing
### Development environment

- `docker compose up -d`
- `docker compose exec web vendor/bin/phpunit --configuration phpunit.xml`
- `docker compose exec web vendor/bin/psalm --show-info=true`
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:

```
composer install --ignore-platform-req=ext-opentelemetry
composer test # unit suite
composer analyze # PHPStan
composer format:check
composer format # auto-fix
```

The end-to-end suites need the adapter containers:

```
docker compose up -d --build
docker compose exec fpm vendor/bin/phpunit --configuration phpunit.xml --testsuite e2e-fpm
docker compose exec swoole vendor/bin/phpunit --configuration phpunit.xml --testsuite e2e-swoole
```

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:

```
docker compose exec fpm composer test
docker compose exec fpm composer analyze
docker compose exec fpm composer format:check
```

## Introducing New Features

Expand Down
6 changes: 5 additions & 1 deletion Dockerfile.fpm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN composer install --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist \
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`

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

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

# Composer binary (for running scripts inside the container)
COPY --from=composer:2.7 /usr/bin/composer /usr/local/bin/composer

# Add PHP Source Code
COPY ./src /usr/share/nginx/html/src
COPY ./tests /usr/share/nginx/html/tests
COPY ./phpunit.xml /usr/share/nginx/html/phpunit.xml
COPY ./composer.json ./composer.lock ./phpstan.neon ./pint.json /usr/share/nginx/html/
COPY --from=step0 /usr/local/src/vendor /usr/share/nginx/html/vendor

# Supervisord Conf
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile.swoole
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ LABEL maintainer="team@appwrite.io"

WORKDIR /usr/src/code

# Composer binary (for running scripts inside the container)
COPY --from=composer:2.7 /usr/bin/composer /usr/local/bin/composer

COPY ./src /usr/src/code/src
COPY ./tests /usr/src/code/tests
COPY ./phpunit.xml /usr/src/code/phpunit.xml
COPY ./composer.json ./composer.lock ./phpstan.neon ./pint.json /usr/src/code/
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor

EXPOSE 80
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ To learn more about architecture and features for this library, check out more i

## System Requirements

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

## More from Utopia

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"test": "vendor/bin/phpunit --configuration phpunit.xml"
},
"require": {
"php": ">=8.2",
"php": ">=8.3",
"utopia-php/di": "0.3.*",
"utopia-php/servers": "0.3.*",
"utopia-php/compression": "0.1.*",
Expand All @@ -40,7 +40,7 @@
},
"config": {
"platform": {
"php": "8.2",
"php": "8.3",
"ext-opentelemetry": "1.0.0",
"ext-protobuf": "4.26.1"
},
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/Getting-Starting-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,6 @@ Http::shutdown(function($request) {
# Running Locally
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.

> Utopia HTTP requires PHP 8.2 or later. We recommend using the latest PHP version whenever possible.
> Utopia HTTP requires PHP 8.3 or later. We recommend using the latest PHP version whenever possible.

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).
2 changes: 0 additions & 2 deletions example/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
server:
build:
Expand Down
Loading