diff --git a/app/config/environments.php b/app/config/environments.php index bd89afb9a4..3e483829b7 100644 --- a/app/config/environments.php +++ b/app/config/environments.php @@ -43,6 +43,14 @@ return [ 'build' => '/usr/src/code/docker/environments/ruby-2.7', 'logo' => 'ruby.png', ], + 'ruby-3.0' => [ + 'name' => 'Ruby', + 'version' => '3.0', + 'base' => 'ruby:3.0-alpine', + 'image' => 'appwrite/env-ruby-3.0:1.0.0', + 'build' => '/usr/src/code/docker/environments/ruby-3.0', + 'logo' => 'ruby.png', + ], 'python-3.8' => [ 'name' => 'Python', 'version' => '3.8', diff --git a/docker/environments/build.sh b/docker/environments/build.sh index a60cd5b3e8..2958614d27 100644 --- a/docker/environments/build.sh +++ b/docker/environments/build.sh @@ -26,3 +26,6 @@ docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 echo 'Ruby 2.7...' docker buildx build --platform linux/amd64,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-ruby-2.7:1.0.2 ./docker/environments/ruby-2.7/ --push + +echo 'Ruby 3.0...' +docker buildx build --platform linux/amd64,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-ruby-3.0:1.0.0 ./docker/environments/ruby-3.0/ --push diff --git a/docker/environments/ruby-3.0/Dockerfile b/docker/environments/ruby-3.0/Dockerfile new file mode 100644 index 0000000000..7f1600fa75 --- /dev/null +++ b/docker/environments/ruby-3.0/Dockerfile @@ -0,0 +1,12 @@ +FROM ruby:3.0-alpine + +LABEL maintainer="team@appwrite.io" + +RUN apk add tar + +RUN mkdir /usr/local/src + +WORKDIR /usr/local/src/ + +ENV GEM_PATH=/usr/local/src/.appwrite +ENV GEM_SPEC_CACHE=/usr/local/src/.appwrite/specs \ No newline at end of file diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 0c7ecc555d..ae62711c60 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -455,24 +455,6 @@ class FunctionsCustomServerTest extends Scope public function testENVS():array { - sleep(120); - /** - * Test for SUCCESS - */ - $file = $this->client->call(Client::METHOD_POST, '/storage/files', array_merge([ - 'content-type' => 'multipart/form-data', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), - 'read' => ['*'], - 'write' => ['*'], - 'folderId' => 'xyz', - ]); - - $this->assertEquals($file['headers']['status-code'], 201); - $this->assertNotEmpty($file['body']['$id']); - - $fileId = $file['body']['$id'] ?? ''; $functions = realpath(__DIR__ . '/../../../resources/functions'); @@ -529,6 +511,14 @@ class FunctionsCustomServerTest extends Scope 'command' => 'ruby app.rb', 'timeout' => 15, ], + [ + 'language' => 'Ruby', + 'version' => '3.0', + 'name' => 'ruby-3.0', + 'code' => $functions.'/ruby.tar.gz', + 'command' => 'ruby app.rb', + 'timeout' => 15, + ], [ 'language' => 'Deno', 'version' => '1.5', @@ -547,6 +537,26 @@ class FunctionsCustomServerTest extends Scope ], ]; + sleep(count($envs) * 25); + + /** + * Test for SUCCESS + */ + $file = $this->client->call(Client::METHOD_POST, '/storage/files', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + 'read' => ['*'], + 'write' => ['*'], + 'folderId' => 'xyz', + ]); + + $this->assertEquals($file['headers']['status-code'], 201); + $this->assertNotEmpty($file['body']['$id']); + + $fileId = $file['body']['$id'] ?? ''; + foreach ($envs as $key => $env) { $language = $env['language'] ?? ''; $version = $env['version'] ?? '';