Skip to content

Commit cc880ec

Browse files
Merge pull request #139 from utopia-php/feat-di-upgrade
Feat di upgrade
2 parents e3bbca0 + c132449 commit cc880ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1631
-1362
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
run: composer validate --strict
2020

2121
- name: Setup Docker
22-
run: docker-compose up -d --build
22+
run: docker compose up -d --build
2323

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

3030
- name: Run Swoole Tests
31-
run: docker compose exec swoole vendor/bin/phpunit --configuration phpunit.xml
31+
run: docker compose exec swoole vendor/bin/phpunit --configuration phpunit.xml
32+
33+
- name: Run Swoole Corotuine Tests
34+
run: docker compose exec swoole-coroutine vendor/bin/phpunit --configuration phpunit.xml

.vscode/launch.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "Listen for Xdebug",
3+
"type": "php",
4+
"request": "launch",
5+
"port": 9003,
6+
"pathMappings": {
7+
"/usr/src/code": "${workspaceRoot}"
8+
}
9+
}

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ $ git push origin [name_of_your_new_branch]
6666

6767
### Testing
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+
- `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`
7272

7373
## Introducing New Features
7474

Dockerfile.swoole

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
FROM composer:2.0 AS step0
22

3-
43
ARG TESTING=true
4+
ARG DEBUG=false
55

66
ENV TESTING=$TESTING
7+
ENV DEBUG=$DEBUG
78

89
WORKDIR /usr/local/src/
910

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

16-
FROM appwrite/base:0.4.3 as final
17+
FROM appwrite/base:0.9.0 as final
18+
19+
ARG TESTING=true
20+
ARG DEBUG=false
21+
22+
ENV TESTING=$TESTING
23+
ENV DEBUG=$DEBUG
24+
1725
LABEL maintainer="team@appwrite.io"
1826

27+
RUN \
28+
if [ "$DEBUG" == "true" ]; then \
29+
apk add boost boost-dev; \
30+
fi
31+
1932
WORKDIR /usr/src/code
2033

34+
COPY ./dev /usr/src/code/dev
2135
COPY ./src /usr/src/code/src
2236
COPY ./tests /usr/src/code/tests
2337
COPY ./phpunit.xml /usr/src/code/phpunit.xml
2438
COPY ./phpbench.json /usr/src/code/phpbench.json
2539
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor
2640

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

2948
CMD ["php", "tests/e2e/server-swoole.php"]

Dockerfile.swoole_coroutines

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM composer:2.0 AS step0
2+
3+
ARG TESTING=true
4+
ARG DEBUG=false
5+
6+
ENV TESTING=$TESTING
7+
ENV DEBUG=$DEBUG
8+
9+
WORKDIR /usr/local/src/
10+
11+
COPY composer.* /usr/local/src/
12+
13+
RUN composer install --ignore-platform-reqs --optimize-autoloader \
14+
--no-plugins --no-scripts --prefer-dist \
15+
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
16+
17+
FROM appwrite/base:0.9.0 as final
18+
19+
ARG TESTING=true
20+
ARG DEBUG=false
21+
22+
ENV TESTING=$TESTING
23+
ENV DEBUG=$DEBUG
24+
25+
LABEL maintainer="team@appwrite.io"
26+
27+
RUN \
28+
if [ "$DEBUG" == "true" ]; then \
29+
apk add boost boost-dev; \
30+
fi
31+
32+
WORKDIR /usr/src/code
33+
34+
COPY ./dev /usr/src/code/dev
35+
COPY ./src /usr/src/code/src
36+
COPY ./tests /usr/src/code/tests
37+
COPY ./phpunit.xml /usr/src/code/phpunit.xml
38+
COPY ./phpbench.json /usr/src/code/phpbench.json
39+
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor
40+
41+
# Enable Extensions
42+
RUN if [ "$DEBUG" == "true" ]; then cp /usr/src/code/dev/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini; fi
43+
RUN if [ "$DEBUG" = "false" ]; then rm -rf /usr/src/code/dev; fi
44+
RUN if [ "$DEBUG" = "false" ]; then rm -f /usr/local/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so; fi
45+
46+
EXPOSE 80
47+
48+
CMD ["php", "tests/e2e/server-swoole-coroutine.php"]

composer.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,28 @@
1212
"minimum-stability": "stable",
1313
"autoload": {
1414
"psr-4": {
15-
"Utopia\\": "src/",
15+
"Utopia\\": "src/"
16+
}
17+
},
18+
"autoload-dev": {
19+
"psr-4": {
1620
"Tests\\E2E\\": "tests/e2e"
1721
}
1822
},
1923
"scripts": {
2024
"lint": "vendor/bin/pint --test",
2125
"format": "vendor/bin/pint",
22-
"check": "vendor/bin/phpstan analyse -c phpstan.neon",
26+
"check": "vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=256M",
2327
"test": "vendor/bin/phpunit --configuration phpunit.xml",
2428
"bench": "vendor/bin/phpbench run --report=benchmark"
2529
},
2630
"require": {
2731
"php": ">=8.0",
28-
"ext-swoole": "*"
32+
"ext-swoole": "*",
33+
"utopia-php/servers": "0.1.*"
2934
},
3035
"require-dev": {
36+
"ext-xdebug": "*",
3137
"phpunit/phpunit": "^9.5.25",
3238
"laravel/pint": "^1.2",
3339
"swoole/ide-helper": "4.8.3",

0 commit comments

Comments
 (0)