Skip to content

Commit

Permalink
Merge pull request #131 from utopia-php/feat-di-upgrade
Browse files Browse the repository at this point in the history
Work in progress
  • Loading branch information
christyjacob4 authored Aug 8, 2024
2 parents 111da1c + ee50ec9 commit d1e9674
Show file tree
Hide file tree
Showing 49 changed files with 1,858 additions and 1,455 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: composer validate --strict

- name: Setup Docker
run: docker-compose up -d --build
run: docker compose up -d --build

- name: Wait for Server to be ready
run: sleep 10
Expand All @@ -28,4 +28,7 @@ jobs:
run: docker compose exec fpm vendor/bin/phpunit --configuration phpunit.xml

- name: Run Swoole Tests
run: docker compose exec swoole vendor/bin/phpunit --configuration phpunit.xml
run: docker compose exec swoole vendor/bin/phpunit --configuration phpunit.xml

- name: Run Swoole Corotuine Tests
run: docker compose exec swoole-coroutine vendor/bin/phpunit --configuration phpunit.xml
9 changes: 9 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/usr/src/code": "${workspaceRoot}"
}
}
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ $ git push origin [name_of_your_new_branch]

### Testing

- `docker-compose up -d`
- `docker-compose exec web vendor/bin/phpunit --configuration phpunit.xml`
- `docker-compose exec web vendor/bin/psalm --show-info=true`
- `docker compose up -d`
- `docker compose exec web vendor/bin/phpunit --configuration phpunit.xml`
- `docker compose exec web vendor/bin/psalm --show-info=true`

## Introducing New Features

Expand Down
23 changes: 21 additions & 2 deletions Dockerfile.swoole
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM composer:2.0 AS step0


ARG TESTING=true
ARG DEBUG=false

ENV TESTING=$TESTING
ENV DEBUG=$DEBUG

WORKDIR /usr/local/src/

Expand All @@ -13,17 +14,35 @@ RUN composer install --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist \
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`

FROM appwrite/base:0.4.3 as final
FROM appwrite/base:0.9.0 as final

ARG TESTING=true
ARG DEBUG=false

ENV TESTING=$TESTING
ENV DEBUG=$DEBUG

LABEL maintainer="[email protected]"

RUN \
if [ "$DEBUG" == "true" ]; then \
apk add boost boost-dev; \
fi

WORKDIR /usr/src/code

COPY ./dev /usr/src/code/dev
COPY ./src /usr/src/code/src
COPY ./tests /usr/src/code/tests
COPY ./phpunit.xml /usr/src/code/phpunit.xml
COPY ./phpbench.json /usr/src/code/phpbench.json
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor

# Enable Extensions
RUN if [ "$DEBUG" == "true" ]; then cp /usr/src/code/dev/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini; fi
RUN if [ "$DEBUG" = "false" ]; then rm -rf /usr/src/code/dev; fi
RUN if [ "$DEBUG" = "false" ]; then rm -f /usr/local/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so; fi

EXPOSE 80

CMD ["php", "tests/e2e/server-swoole.php"]
48 changes: 48 additions & 0 deletions Dockerfile.swoole_coroutines
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM composer:2.0 AS step0

ARG TESTING=true
ARG DEBUG=false

ENV TESTING=$TESTING
ENV DEBUG=$DEBUG

WORKDIR /usr/local/src/

COPY composer.* /usr/local/src/

RUN composer install --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist \
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`

FROM appwrite/base:0.9.0 as final

ARG TESTING=true
ARG DEBUG=false

ENV TESTING=$TESTING
ENV DEBUG=$DEBUG

LABEL maintainer="[email protected]"

RUN \
if [ "$DEBUG" == "true" ]; then \
apk add boost boost-dev; \
fi

WORKDIR /usr/src/code

COPY ./dev /usr/src/code/dev
COPY ./src /usr/src/code/src
COPY ./tests /usr/src/code/tests
COPY ./phpunit.xml /usr/src/code/phpunit.xml
COPY ./phpbench.json /usr/src/code/phpbench.json
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor

# Enable Extensions
RUN if [ "$DEBUG" == "true" ]; then cp /usr/src/code/dev/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini; fi
RUN if [ "$DEBUG" = "false" ]; then rm -rf /usr/src/code/dev; fi
RUN if [ "$DEBUG" = "false" ]; then rm -f /usr/local/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so; fi

EXPOSE 80

CMD ["php", "tests/e2e/server-swoole-coroutine.php"]
12 changes: 9 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,28 @@
"minimum-stability": "stable",
"autoload": {
"psr-4": {
"Utopia\\": "src/",
"Utopia\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\E2E\\": "tests/e2e"
}
},
"scripts": {
"lint": "vendor/bin/pint --test",
"format": "vendor/bin/pint",
"check": "vendor/bin/phpstan analyse -c phpstan.neon",
"check": "vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=256M",
"test": "vendor/bin/phpunit --configuration phpunit.xml",
"bench": "vendor/bin/phpbench run --report=benchmark"
},
"require": {
"php": ">=8.0",
"ext-swoole": "*"
"ext-swoole": "*",
"utopia-php/servers": "0.1.* "
},
"require-dev": {
"ext-xdebug": "*",
"phpunit/phpunit": "^9.5.25",
"laravel/pint": "^1.2",
"swoole/ide-helper": "4.8.3",
Expand Down
Loading

0 comments on commit d1e9674

Please sign in to comment.