From 683a691bf93ae8c04ee6b1f656ef994411be0e11 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Sun, 4 Sep 2022 22:05:30 +0200 Subject: [PATCH 1/7] ci: update github actions to use github hosted runners --- .github/workflows/tests.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2ed2b65ff7..64f39013fd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,7 +4,7 @@ on: [pull_request] jobs: tests: name: Unit & E2E - runs-on: self-hosted + runs-on: ubuntu-latest steps: - name: Checkout repository @@ -23,12 +23,11 @@ jobs: # Upstream bug causes buildkit pulls to fail so prefetch base images # https://github.com/moby/moby/issues/41864 run: | - echo "_APP_FUNCTIONS_RUNTIMES=php-8.0" >> .env docker pull composer:2.0 docker pull php:8.0-cli-alpine docker compose build --progress=plain docker compose up -d - sleep 10 + sleep 30 - name: Doctor run: docker compose exec -T appwrite doctor @@ -37,10 +36,3 @@ jobs: - name: Run Tests run: docker compose exec -T appwrite test --debug - - - name: Teardown - if: always() - run: | - docker ps -aq | xargs docker rm --force || true - docker volume prune --force || true - docker network prune --force || true \ No newline at end of file From bcd05bf5a7944b8f16c1f3f02e34a2b61d97e91c Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Sun, 4 Sep 2022 22:23:38 +0200 Subject: [PATCH 2/7] ci: force buildkit and settings --- .github/workflows/tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 64f39013fd..2652929613 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,9 +23,13 @@ jobs: # Upstream bug causes buildkit pulls to fail so prefetch base images # https://github.com/moby/moby/issues/41864 run: | + export COMPOSE_INTERACTIVE_NO_CLI + export DOCKER_BUILDKIT=1 + export COMPOSE_DOCKER_CLI_BUILD=1 + export BUILDKIT_PROGRESS=plain docker pull composer:2.0 docker pull php:8.0-cli-alpine - docker compose build --progress=plain + docker compose build docker compose up -d sleep 30 - name: Doctor From 6d5aec39fe0b53ac392df0aa5556d5d6ef9841bf Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 14 Sep 2022 16:44:50 +0200 Subject: [PATCH 3/7] ci: use faster compose file for ci --- .github/workflows/tests.yml | 4 +-- docker-compose.ci.yml | 55 +++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 docker-compose.ci.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2652929613..d5fc0dfb26 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,8 +29,8 @@ jobs: export BUILDKIT_PROGRESS=plain docker pull composer:2.0 docker pull php:8.0-cli-alpine - docker compose build - docker compose up -d + docker compose -f docker-compose.yml -f docker-compose.ci.yml build + docker compose -f docker-compose.yml -f docker-compose.ci.yml up -d sleep 30 - name: Doctor run: docker compose exec -T appwrite doctor diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml new file mode 100644 index 0000000000..5ae38c5dd9 --- /dev/null +++ b/docker-compose.ci.yml @@ -0,0 +1,55 @@ +services: + appwrite: + container_name: appwrite + image: appwrite-dev + build: + context: . + args: + - DEBUG=false + - TESTING=true + - VERSION=dev + + appwrite-realtime: + image: appwrite-dev + + appwrite-worker-audits: + image: appwrite-dev + + appwrite-worker-webhooks: + image: appwrite-dev + + appwrite-worker-deletes: + image: appwrite-dev + + appwrite-worker-databases: + image: appwrite-dev + + appwrite-worker-builds: + image: appwrite-dev + + appwrite-worker-certificates: + image: appwrite-dev + + appwrite-worker-functions: + image: appwrite-dev + + appwrite-executor: + image: appwrite-dev + + appwrite-worker-mails: + image: appwrite-dev + + appwrite-worker-messaging: + image: appwrite-dev + + appwrite-maintenance: + image: appwrite-dev + + appwrite-usage-timeseries: + image: appwrite-dev + + appwrite-usage-database: + image: appwrite-dev + + appwrite-schedule: + image: appwrite-dev From 5fd0de842fdbfc22898f12904b1c22a82d30c54e Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 14 Sep 2022 17:52:52 +0200 Subject: [PATCH 4/7] ci: fix build args --- .github/workflows/tests.yml | 2 +- docker-compose.ci.yml | 7 ------- docker-compose.yml | 6 +++--- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d5fc0dfb26..8dfae35cdc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,7 +29,7 @@ jobs: export BUILDKIT_PROGRESS=plain docker pull composer:2.0 docker pull php:8.0-cli-alpine - docker compose -f docker-compose.yml -f docker-compose.ci.yml build + docker compose -f docker-compose.yml -f docker-compose.ci.yml build appwrite docker compose -f docker-compose.yml -f docker-compose.ci.yml up -d sleep 30 - name: Doctor diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 5ae38c5dd9..21d5e5d296 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -1,13 +1,6 @@ services: appwrite: - container_name: appwrite image: appwrite-dev - build: - context: . - args: - - DEBUG=false - - TESTING=true - - VERSION=dev appwrite-realtime: image: appwrite-dev diff --git a/docker-compose.yml b/docker-compose.yml index 9dd5b8721f..7b4970f2ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,9 +73,9 @@ services: build: context: . args: - - DEBUG=false - - TESTING=true - - VERSION=dev + DEBUG: false + TESTING: true + VERSION: dev ports: - 9501:80 networks: From 0e2e7395a934b33ece76c7103e6e9614669b1dc3 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 14 Sep 2022 19:17:03 +0200 Subject: [PATCH 5/7] ci: increase test timeouts --- .../Functions/FunctionsCustomClientTest.php | 12 ++++---- .../Functions/FunctionsCustomServerTest.php | 30 +++++++++---------- .../Webhooks/WebhooksCustomServerTest.php | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php index 6a0d87c214..56b72e4468 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -116,7 +116,7 @@ class FunctionsCustomClientTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); // Wait for deployment to be built. - sleep(10); + sleep(20); $function = $this->client->call(Client::METHOD_PATCH, '/functions/' . $function['body']['$id'] . '/deployments/' . $deploymentId, [ 'content-type' => 'application/json', @@ -228,7 +228,7 @@ class FunctionsCustomClientTest extends Scope $deploymentId = $deployment['body']['$id'] ?? ''; // Wait for deployment to be built. - sleep(10); + sleep(20); $this->assertEquals(202, $deployment['headers']['status-code']); @@ -252,7 +252,7 @@ class FunctionsCustomClientTest extends Scope $executionId = $execution['body']['$id'] ?? ''; - sleep(10); + sleep(20); $executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions/' . $executionId, [ 'content-type' => 'application/json', @@ -326,7 +326,7 @@ class FunctionsCustomClientTest extends Scope $deploymentId = $deployment['body']['$id'] ?? ''; // Wait for deployment to be built. - sleep(10); + sleep(20); $this->assertEquals(202, $deployment['headers']['status-code']); @@ -395,7 +395,7 @@ class FunctionsCustomClientTest extends Scope $this->assertEquals(202, $execution['headers']['status-code']); - sleep(10); + sleep(20); $base = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions', [ 'content-type' => 'application/json', @@ -556,7 +556,7 @@ class FunctionsCustomClientTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); // Wait for deployment to be built. - sleep(10); + sleep(20); $function = $this->client->call(Client::METHOD_PATCH, '/functions/' . $functionId . '/deployments/' . $deploymentId, [ 'content-type' => 'application/json', diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 94f7e84f43..5e498368ea 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -373,7 +373,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('index.php', $deployment['body']['entrypoint']); // Wait for deployment to build. - sleep(30); + sleep(60); return array_merge($data, ['deploymentId' => $deploymentId]); } @@ -610,7 +610,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('', $execution['body']['stderr']); $this->assertEquals(0, $execution['body']['duration']); - sleep(5); + sleep(10); $execution = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'] . '/executions/' . $executionId, array_merge([ 'content-type' => 'application/json', @@ -637,7 +637,7 @@ class FunctionsCustomServerTest extends Scope * Test for FAILURE */ - sleep(10); + sleep(20); return array_merge($data, ['executionId' => $executionId]); } @@ -881,7 +881,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); // Allow build step to run - sleep(20); + sleep(40); $execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', array_merge([ 'content-type' => 'application/json', @@ -894,7 +894,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(202, $execution['headers']['status-code']); - sleep(10); + sleep(20); $executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions', array_merge([ 'content-type' => 'application/json', @@ -965,7 +965,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); // Allow build step to run - sleep(10); + sleep(20); $deployment = $this->client->call(Client::METHOD_PATCH, '/functions/' . $functionId . '/deployments/' . $deploymentId, array_merge([ 'content-type' => 'application/json', @@ -988,7 +988,7 @@ class FunctionsCustomServerTest extends Scope $executionId = $execution['body']['$id'] ?? ''; - sleep(10); + sleep(20); $executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions/' . $executionId, array_merge([ 'content-type' => 'application/json', @@ -1087,7 +1087,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); // Allow build step to run - sleep(10); + sleep(20); $execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', array_merge([ 'content-type' => 'application/json', @@ -1103,7 +1103,7 @@ class FunctionsCustomServerTest extends Scope $executionId = $execution['body']['$id'] ?? ''; - sleep(10); + sleep(20); $executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions/' . $executionId, array_merge([ 'content-type' => 'application/json', @@ -1200,7 +1200,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); // Allow build step to run - sleep(30); + sleep(60); $execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', array_merge([ 'content-type' => 'application/json', @@ -1216,7 +1216,7 @@ class FunctionsCustomServerTest extends Scope $executionId = $execution['body']['$id'] ?? ''; - sleep(30); + sleep(60); $executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions/' . $executionId, array_merge([ 'content-type' => 'application/json', @@ -1314,7 +1314,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); // Allow build step to run - sleep(40); + sleep(80); $execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', array_merge([ 'content-type' => 'application/json', @@ -1330,7 +1330,7 @@ class FunctionsCustomServerTest extends Scope $executionId = $execution['body']['$id'] ?? ''; - sleep(10); + sleep(20); $executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions/' . $executionId, array_merge([ 'content-type' => 'application/json', @@ -1428,7 +1428,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); // Allow build step to run - sleep(30); + sleep(60); $execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', array_merge([ 'content-type' => 'application/json', @@ -1444,7 +1444,7 @@ class FunctionsCustomServerTest extends Scope $executionId = $execution['body']['$id'] ?? ''; - sleep(10); + sleep(20); $executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions/' . $executionId, array_merge([ 'content-type' => 'application/json', diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index db520bf502..f2f4b27260 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -634,7 +634,7 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); // wait for timeout function to complete - sleep(10); + sleep(20); $webhook = $this->getLastRequest(); $signatureExpected = self::getWebhookSignature($webhook, $this->getProject()['signatureKey']); From 052d35fe5932d4a20d77071afa2429dae9fd2987 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Tue, 4 Oct 2022 08:54:53 +0300 Subject: [PATCH 6/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bc84adbb64..9519d38219 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ -[![Hacktoberfest](https://img.shields.io/static/v1?label=hacktoberfest&message=friendly&color=191120&style=flat-square)](https://hacktoberfest.appwrite.io) +[![Hacktoberfest](https://img.shields.io/static/v1?label=hacktoberfest&message=ready&color=191120&style=flat-square)](https://hacktoberfest.appwrite.io) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord?r=Github) [![Build Status](https://img.shields.io/github/workflow/status/appwrite/appwrite/Tests?label=tests&style=flat-square)](https://github.com/appwrite/appwrite/actions) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) From b6321a8bed5d2d5ea70406da52f307d8ead3e8d7 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 4 Oct 2022 11:05:52 +0200 Subject: [PATCH 7/7] ci: remove php image pre pull --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8dfae35cdc..d99c29999a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,7 +28,6 @@ jobs: export COMPOSE_DOCKER_CLI_BUILD=1 export BUILDKIT_PROGRESS=plain docker pull composer:2.0 - docker pull php:8.0-cli-alpine docker compose -f docker-compose.yml -f docker-compose.ci.yml build appwrite docker compose -f docker-compose.yml -f docker-compose.ci.yml up -d sleep 30