Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat benchmarks #4615

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add benchmarks base
  • Loading branch information
abnegate committed Oct 31, 2022
commit f52e4c3e63cec05fa3328d98b61f4e566e7a2339
20 changes: 20 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Benchmark"

on: [pull_request]

jobs:
benchmark:
name: Benchmark
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2

- run: git checkout HEAD^2

- name: Run benchmark against baseline
run: docker run --rm -v $PWD:/app composer sh -c \
"composer install --profile --ignore-platform-reqs && composer benchmark"
5 changes: 5 additions & 0 deletions app/controllers/api/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,11 @@
throw new Exception(Exception::DEPLOYMENT_NOT_FOUND);
}

$build = $dbForProject->getDocument('builds', $deployment->getAttribute('buildId', ''));
$deployment->setAttribute('status', $build->getAttribute('status', 'processing'));
$deployment->setAttribute('buildStderr', $build->getAttribute('stderr', ''));
$deployment->setAttribute('buildStdout', $build->getAttribute('stdout', ''));

$response->dynamic($deployment, Response::MODEL_DEPLOYMENT);
});

Expand Down
18 changes: 16 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@
"scripts": {
"test": "vendor/bin/phpunit",
"lint": "vendor/bin/phpcs",
"format": "vendor/bin/phpcbf"
"format": "vendor/bin/phpcbf",
"benchmark": [
"Composer\\Config::disableProcessTimeout",
"vendor/bin/phpbench run --report=appwrite"
],
"benchmark-tag": [
"Composer\\Config::disableProcessTimeout",
"vendor/bin/phpbench run --tag=baseline --report=appwrite"
],
"benchmark-compare": [
"Composer\\Config::disableProcessTimeout",
"vendor/bin/phpbench run --ref=baseline --report=appwrite"
]
},
"autoload": {
"psr-4": {
Expand All @@ -24,6 +36,7 @@
"psr-4": {
"Tests\\E2E\\": "tests/e2e",
"Tests\\Unit\\": "tests/unit",
"Tests\\Benchmarks\\": "tests/benchmarks",
"Appwrite\\Tests\\": "tests/extensions"
}
},
Expand Down Expand Up @@ -82,7 +95,8 @@
"phpunit/phpunit": "9.5.20",
"squizlabs/php_codesniffer": "^3.6",
"swoole/ide-helper": "4.8.9",
"textalk/websocket": "1.5.7"
"textalk/websocket": "1.5.7",
"phpbench/phpbench": "^1.2"
},
"provide": {
"ext-phpiredis": "*"
Expand Down
Loading