Skip to content

Commit

Permalink
Merge pull request appwrite#3757 from appwrite/feat-github-non-self-h…
Browse files Browse the repository at this point in the history
…osted

ci: update github actions to use github hosted runners
  • Loading branch information
TorstenDittmann authored Oct 4, 2022
2 parents 052d35f + b6321a8 commit 4bb44ad
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 38 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request]
jobs:
tests:
name: Unit & E2E
runs-on: self-hosted
runs-on: ubuntu-latest

steps:
- name: Checkout repository
Expand All @@ -23,12 +23,14 @@ 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
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 up -d
sleep 10
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
run: docker compose exec -T appwrite doctor

Expand All @@ -37,10 +39,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
48 changes: 48 additions & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
services:
appwrite:
image: appwrite-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
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ services:
build:
context: .
args:
- DEBUG=false
- TESTING=true
- VERSION=dev
DEBUG: false
TESTING: true
VERSION: dev
ports:
- 9501:80
networks:
Expand Down
12 changes: 6 additions & 6 deletions tests/e2e/Services/Functions/FunctionsCustomClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function testCreateExecution(): array
$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',
Expand Down Expand Up @@ -228,7 +228,7 @@ public function testCreateCustomExecution(): array
$deploymentId = $deployment['body']['$id'] ?? '';

// Wait for deployment to be built.
sleep(10);
sleep(20);

$this->assertEquals(202, $deployment['headers']['status-code']);

Expand All @@ -252,7 +252,7 @@ public function testCreateCustomExecution(): array

$executionId = $execution['body']['$id'] ?? '';

sleep(10);
sleep(20);

$executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions/' . $executionId, [
'content-type' => 'application/json',
Expand Down Expand Up @@ -326,7 +326,7 @@ public function testCreateCustomExecutionGuest()
$deploymentId = $deployment['body']['$id'] ?? '';

// Wait for deployment to be built.
sleep(10);
sleep(20);

$this->assertEquals(202, $deployment['headers']['status-code']);

Expand Down Expand Up @@ -395,7 +395,7 @@ public function testListExecutions(array $data)

$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',
Expand Down Expand Up @@ -556,7 +556,7 @@ public function testSynchronousExecution(): array
$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',
Expand Down
30 changes: 15 additions & 15 deletions tests/e2e/Services/Functions/FunctionsCustomServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public function testCreateDeployment($data): array
$this->assertEquals('index.php', $deployment['body']['entrypoint']);

// Wait for deployment to build.
sleep(30);
sleep(60);

return array_merge($data, ['deploymentId' => $deploymentId]);
}
Expand Down Expand Up @@ -610,7 +610,7 @@ public function testCreateExecution($data): array
$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',
Expand All @@ -637,7 +637,7 @@ public function testCreateExecution($data): array
* Test for FAILURE
*/

sleep(10);
sleep(20);

return array_merge($data, ['executionId' => $executionId]);
}
Expand Down Expand Up @@ -881,7 +881,7 @@ public function testTimeout()
$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',
Expand All @@ -894,7 +894,7 @@ public function testTimeout()

$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',
Expand Down Expand Up @@ -965,7 +965,7 @@ public function testCreateCustomPHPExecution()
$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',
Expand All @@ -988,7 +988,7 @@ public function testCreateCustomPHPExecution()

$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',
Expand Down Expand Up @@ -1087,7 +1087,7 @@ public function testCreateCustomNodeExecution()
$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',
Expand All @@ -1103,7 +1103,7 @@ public function testCreateCustomNodeExecution()

$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',
Expand Down Expand Up @@ -1200,7 +1200,7 @@ public function testCreateCustomPythonExecution()
$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',
Expand All @@ -1216,7 +1216,7 @@ public function testCreateCustomPythonExecution()

$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',
Expand Down Expand Up @@ -1314,7 +1314,7 @@ public function testCreateCustomDartExecution()
$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',
Expand All @@ -1330,7 +1330,7 @@ public function testCreateCustomDartExecution()

$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',
Expand Down Expand Up @@ -1428,7 +1428,7 @@ public function testCreateCustomRubyExecution()
$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',
Expand All @@ -1444,7 +1444,7 @@ public function testCreateCustomRubyExecution()

$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',
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ public function testExecutions($data): array
$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']);
Expand Down

0 comments on commit 4bb44ad

Please sign in to comment.