From addc88ccdca932148baef1831016477fb308cfd4 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 18:49:02 +0000 Subject: [PATCH 01/57] chore: test parallel executions --- .github/workflows/tests.yml | 36 +++++++++++++++++++++++++++++------- composer.lock | 2 +- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8fb3ac351..8c96c4b74 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,8 +6,8 @@ concurrency: on: [pull_request] jobs: - tests: - name: Unit & E2E + build: + name: Build & Unit Test runs-on: ubuntu-latest steps: @@ -49,12 +49,34 @@ jobs: sleep 30 - name: Doctor - run: | - docker compose logs appwrite - docker compose exec -T appwrite doctor + run: docker compose exec -T appwrite doctor - name: Environment Variables run: docker compose exec -T appwrite vars - - name: Run Tests - run: docker compose exec -T appwrite test --debug \ No newline at end of file + - name: Run Unit Tests + run: docker compose exec appwrite test /usr/src/code/tests/unit + + e2e_test: + name: E2E Test + runs-on: ubuntu-latest + needs: build + strategy: + fail-fast: false + matrix: + services: [Account,Avatars,Console,Databases,Functions,GraphQL,Health,Locale,Projects,Realtime,Storage,Teams,Users,Webhooks] + + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 2 + submodules: recursive + + - name: Start Appwrite + run: | + docker compose up -d + sleep 30 + + - name: Run ${{matrix.services}} Tests + run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file diff --git a/composer.lock b/composer.lock index 7d412e42c..23ea11886 100644 --- a/composer.lock +++ b/composer.lock @@ -6096,5 +6096,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } From 2eae37d8025dc83b6dc06430e81dccfcfee63abb Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 19:03:55 +0000 Subject: [PATCH 02/57] feat: test upload artifact --- .github/workflows/tests.yml | 93 ++++++++++++++++++++++++------------- 1 file changed, 62 insertions(+), 31 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8c96c4b74..22ce93bb3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,10 +4,13 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +env: + TAG: appwrite-dev + on: [pull_request] jobs: - build: - name: Build & Unit Test + setup: + name: Setup & Build Appwrite Image runs-on: ubuntu-latest steps: @@ -25,58 +28,86 @@ jobs: - run: git checkout HEAD^2 if: ${{ github.event_name == 'pull_request' }} - # This is a separate action that sets up buildx runner - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Build Appwrite uses: docker/build-push-action@v3 with: context: . push: false - tags: appwrite-dev + tags: $TAG load: true cache-from: type=gha cache-to: type=gha,mode=max + outputs: type=docker,dest=/tmp/$TAG.tar build-args: | DEBUG=false TESTING=true VERSION=dev + + - name: Upload Docker Image + uses: actions/upload-artifact@v3 + with: + name: $TAG + path: /tmp/$TAG.tar - - name: Start Appwrite - run: | - docker compose up -d - sleep 30 - - name: Doctor - run: docker compose exec -T appwrite doctor + # - name: Start Appwrite + # run: | + # docker compose up -d + # sleep 30 - - name: Environment Variables - run: docker compose exec -T appwrite vars + # - name: Doctor + # run: docker compose exec -T appwrite doctor - - name: Run Unit Tests - run: docker compose exec appwrite test /usr/src/code/tests/unit + # - name: Environment Variables + # run: docker compose exec -T appwrite vars - e2e_test: - name: E2E Test + # - name: Run Unit Tests + # run: docker compose exec appwrite test /usr/src/code/tests/unit + + unit_test: + name: Unit Test runs-on: ubuntu-latest - needs: build - strategy: - fail-fast: false - matrix: - services: [Account,Avatars,Console,Databases,Functions,GraphQL,Health,Locale,Projects,Realtime,Storage,Teams,Users,Webhooks] + needs: setup steps: - name: checkout uses: actions/checkout@v2 with: - fetch-depth: 2 + fetch-depth: 1 submodules: recursive + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: $TAG + path: /tmp + + - name: Load Docker image + run: | + docker load --input /tmp/$TAG.tar + docker image ls -a - - name: Start Appwrite - run: | - docker compose up -d - sleep 30 + + # e2e_test: + # name: E2E Test + # runs-on: ubuntu-latest + # needs: build + # strategy: + # fail-fast: false + # matrix: + # services: [Account,Avatars,Console,Databases,Functions,GraphQL,Health,Locale,Projects,Realtime,Storage,Teams,Users,Webhooks] + + # steps: + # - name: checkout + # uses: actions/checkout@v2 + # with: + # fetch-depth: 2 + # submodules: recursive + + # - name: Start Appwrite + # run: | + # docker compose up -d + # sleep 30 - - name: Run ${{matrix.services}} Tests - run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file + # - name: Run ${{matrix.services}} Tests + # run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file From 1e07fa96a35f31aad6e5b64598c52b21dd6db7fc Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 19:06:10 +0000 Subject: [PATCH 03/57] feat: test upload artifact --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 22ce93bb3..3a4de4ed4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,6 +28,10 @@ jobs: - run: git checkout HEAD^2 if: ${{ github.event_name == 'pull_request' }} + # This is a separate action that sets up buildx runner + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build Appwrite uses: docker/build-push-action@v3 with: From 57e146be2b14e41de037b8c7b5f9d9d64b4d1051 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 19:11:00 +0000 Subject: [PATCH 04/57] feat: test upload artifact --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3a4de4ed4..874c4b341 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,13 +31,13 @@ jobs: # This is a separate action that sets up buildx runner - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - + - name: Build Appwrite uses: docker/build-push-action@v3 with: context: . push: false - tags: $TAG + tags: TAG load: true cache-from: type=gha cache-to: type=gha,mode=max From 22c878104729ba790f645dc1244ccd3bce05e2a6 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 19:11:57 +0000 Subject: [PATCH 05/57] feat: test upload artifact --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 874c4b341..bea74325e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,7 +37,7 @@ jobs: with: context: . push: false - tags: TAG + tags: ${{ TAG }} load: true cache-from: type=gha cache-to: type=gha,mode=max From 2aad9e622bc4dc3e763ca60c447fefbdf3628745 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 19:16:25 +0000 Subject: [PATCH 06/57] feat: trigger ci From fa99c4584e9ab2ee6684044b4be18da6af8fead5 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 20:07:13 +0000 Subject: [PATCH 07/57] feat: test upload artifact --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bea74325e..bf8296955 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,6 +8,7 @@ env: TAG: appwrite-dev on: [pull_request] + jobs: setup: name: Setup & Build Appwrite Image @@ -37,7 +38,7 @@ jobs: with: context: . push: false - tags: ${{ TAG }} + tags: $TAG load: true cache-from: type=gha cache-to: type=gha,mode=max From 13c6666883e6eea35bc28dceb235b7b75400c9cb Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 21:29:11 +0000 Subject: [PATCH 08/57] feat: test upload artifact --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bf8296955..d5075f137 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,11 +38,11 @@ jobs: with: context: . push: false - tags: $TAG + tags: ${{ env.TAG }} load: true cache-from: type=gha cache-to: type=gha,mode=max - outputs: type=docker,dest=/tmp/$TAG.tar + outputs: type=docker,dest=/tmp/${{ env.TAG }}.tar build-args: | DEBUG=false TESTING=true @@ -51,8 +51,8 @@ jobs: - name: Upload Docker Image uses: actions/upload-artifact@v3 with: - name: $TAG - path: /tmp/$TAG.tar + name: ${{ env.TAG }} + path: /tmp/${{ env.TAG }}.tar # - name: Start Appwrite From 8bd822d171f2a71a4fa3ab5f1b772276598fe3aa Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 21:35:01 +0000 Subject: [PATCH 09/57] feat: test upload artifact --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d5075f137..0a657d352 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -84,12 +84,12 @@ jobs: - name: Download artifact uses: actions/download-artifact@v3 with: - name: $TAG + name: ${{ env.TAG }} path: /tmp - name: Load Docker image run: | - docker load --input /tmp/$TAG.tar + docker load --input /tmp/${{ env.TAG }}.tar docker image ls -a From dec4f4722b243579121a51c5e756154cf77412da Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 21:43:18 +0000 Subject: [PATCH 10/57] feat: test upload artifact --- .github/workflows/tests.yml | 39 +++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0a657d352..398032efb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,26 +48,17 @@ jobs: TESTING=true VERSION=dev - - name: Upload Docker Image - uses: actions/upload-artifact@v3 + - name: Cache Docker Image + uses: actions/cache@v3 with: - name: ${{ env.TAG }} + key: ${{ env.TAG }} path: /tmp/${{ env.TAG }}.tar - - # - name: Start Appwrite - # run: | - # docker compose up -d - # sleep 30 - - # - name: Doctor - # run: docker compose exec -T appwrite doctor - - # - name: Environment Variables - # run: docker compose exec -T appwrite vars - - # - name: Run Unit Tests - # run: docker compose exec appwrite test /usr/src/code/tests/unit + # - name: Upload Docker Image + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ env.TAG }} + # path: /tmp/${{ env.TAG }}.tar unit_test: name: Unit Test @@ -92,6 +83,20 @@ jobs: docker load --input /tmp/${{ env.TAG }}.tar docker image ls -a + - name: Start Appwrite + run: | + docker compose up -d + sleep 10 + + - name: Doctor + run: docker compose exec -T appwrite doctor + + - name: Environment Variables + run: docker compose exec -T appwrite vars + + - name: Run Unit Tests + run: docker compose exec appwrite test /usr/src/code/tests/unit + # e2e_test: # name: E2E Test From 27f77759ed9192982c1893ca64c5975bd33db9e6 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 21:48:31 +0000 Subject: [PATCH 11/57] feat: test upload artifact --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 398032efb..5c65650df 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,7 +51,6 @@ jobs: - name: Cache Docker Image uses: actions/cache@v3 with: - key: ${{ env.TAG }} path: /tmp/${{ env.TAG }}.tar # - name: Upload Docker Image From cf030457e062a6a677488493dee9720ec6ff8737 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 21:55:28 +0000 Subject: [PATCH 12/57] feat: test upload artifact --- .github/workflows/tests.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5c65650df..479442fd6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,6 +51,7 @@ jobs: - name: Cache Docker Image uses: actions/cache@v3 with: + key: ${{ env.TAG }} path: /tmp/${{ env.TAG }}.tar # - name: Upload Docker Image @@ -71,11 +72,17 @@ jobs: fetch-depth: 1 submodules: recursive - - name: Download artifact - uses: actions/download-artifact@v3 + # - name: Download artifact + # uses: actions/download-artifact@v3 + # with: + # name: ${{ env.TAG }} + # path: /tmp + + - name: Get Cached Docker Image + uses: actions/cache@v3 with: - name: ${{ env.TAG }} - path: /tmp + key: ${{ env.TAG }} + path: /tmp/${{ env.TAG }}.tar - name: Load Docker image run: | From 2ed6327c1e1cd3badf8fdd5c491ef31e5cee25ae Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 22:03:32 +0000 Subject: [PATCH 13/57] feat: test upload artifact --- .github/workflows/tests.yml | 43 +++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 479442fd6..299cf5404 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,11 +48,11 @@ jobs: TESTING=true VERSION=dev - - name: Cache Docker Image - uses: actions/cache@v3 - with: - key: ${{ env.TAG }} - path: /tmp/${{ env.TAG }}.tar + # - name: Cache Docker Image + # uses: actions/cache@v3 + # with: + # key: ${{ env.TAG }} + # path: /tmp/${{ env.TAG }}.tar # - name: Upload Docker Image # uses: actions/upload-artifact@v3 @@ -78,7 +78,7 @@ jobs: # name: ${{ env.TAG }} # path: /tmp - - name: Get Cached Docker Image + - name: Load Cache uses: actions/cache@v3 with: key: ${{ env.TAG }} @@ -104,6 +104,37 @@ jobs: run: docker compose exec appwrite test /usr/src/code/tests/unit + accounts_test: + name: Accounts Test + runs-on: ubuntu-latest + needs: setup + + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 1 + submodules: recursive + + - name: Load Cache + uses: actions/cache@v3 + with: + key: ${{ env.TAG }} + path: /tmp/${{ env.TAG }}.tar + + - name: Load Docker image + run: | + docker load --input /tmp/${{ env.TAG }}.tar + docker image ls -a + + - name: Start Appwrite + run: | + docker compose up -d + sleep 10 + + - name: Run Accounts Tests + run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/Account --debug + # e2e_test: # name: E2E Test # runs-on: ubuntu-latest From 5793a11480066f801432c97f2069c4934a6c703b Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 22:10:56 +0000 Subject: [PATCH 14/57] feat: test upload artifact --- .github/workflows/tests.yml | 73 ++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 299cf5404..46b5d361e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -104,19 +104,55 @@ jobs: run: docker compose exec appwrite test /usr/src/code/tests/unit - accounts_test: - name: Accounts Test + # accounts_test: + # name: Accounts Test + # runs-on: ubuntu-latest + # needs: setup + + # steps: + # - name: checkout + # uses: actions/checkout@v2 + # with: + # fetch-depth: 1 + # submodules: recursive + + # - name: Load Cache + # uses: actions/cache@v3 + # with: + # key: ${{ env.TAG }} + # path: /tmp/${{ env.TAG }}.tar + + # - name: Load Docker image + # run: | + # docker load --input /tmp/${{ env.TAG }}.tar + # docker image ls -a + + # - name: Start Appwrite + # run: | + # docker compose up -d + # sleep 10 + + # - name: Run Accounts Tests + # run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/Account --debug + + e2e_test: + name: E2E Test runs-on: ubuntu-latest needs: setup + strategy: + fail-fast: false + matrix: + services: [Account,Avatars,Console,Databases,Functions,GraphQL,Health,Locale,Projects,Realtime,Storage,Teams,Users,Webhooks] steps: - name: checkout uses: actions/checkout@v2 with: - fetch-depth: 1 + fetch-depth: 2 submodules: recursive - name: Load Cache + id: load-cache uses: actions/cache@v3 with: key: ${{ env.TAG }} @@ -128,33 +164,10 @@ jobs: docker image ls -a - name: Start Appwrite + if: steps.load-cache.outputs.cache-hit == 'true' run: | docker compose up -d - sleep 10 - - - name: Run Accounts Tests - run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/Account --debug - - # e2e_test: - # name: E2E Test - # runs-on: ubuntu-latest - # needs: build - # strategy: - # fail-fast: false - # matrix: - # services: [Account,Avatars,Console,Databases,Functions,GraphQL,Health,Locale,Projects,Realtime,Storage,Teams,Users,Webhooks] - - # steps: - # - name: checkout - # uses: actions/checkout@v2 - # with: - # fetch-depth: 2 - # submodules: recursive - - # - name: Start Appwrite - # run: | - # docker compose up -d - # sleep 30 + sleep 20 - # - name: Run ${{matrix.services}} Tests - # run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file + - name: Run ${{matrix.services}} Tests + run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file From 5cb14fbec5364fc34f5e7ebcba1ac6312e7aac65 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 22:11:40 +0000 Subject: [PATCH 15/57] feat: test upload artifact --- .github/workflows/tests.yml | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 46b5d361e..396e8bbcc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,7 @@ concurrency: cancel-in-progress: true env: - TAG: appwrite-dev + IMAGE: appwrite-dev on: [pull_request] @@ -38,27 +38,27 @@ jobs: with: context: . push: false - tags: ${{ env.TAG }} + tag: ${{ env.IMAGE }} load: true cache-from: type=gha cache-to: type=gha,mode=max - outputs: type=docker,dest=/tmp/${{ env.TAG }}.tar + outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar build-args: | DEBUG=false TESTING=true VERSION=dev - # - name: Cache Docker Image - # uses: actions/cache@v3 - # with: - # key: ${{ env.TAG }} - # path: /tmp/${{ env.TAG }}.tar + - name: Cache Docker Image + uses: actions/cache@v3 + with: + key: ${{ env.IMAGE }} + path: /tmp/${{ env.IMAGE }}.tar # - name: Upload Docker Image # uses: actions/upload-artifact@v3 # with: - # name: ${{ env.TAG }} - # path: /tmp/${{ env.TAG }}.tar + # name: ${{ env.IMAGE }} + # path: /tmp/${{ env.IMAGE }}.tar unit_test: name: Unit Test @@ -75,18 +75,18 @@ jobs: # - name: Download artifact # uses: actions/download-artifact@v3 # with: - # name: ${{ env.TAG }} + # name: ${{ env.IMAGE }} # path: /tmp - name: Load Cache uses: actions/cache@v3 with: - key: ${{ env.TAG }} - path: /tmp/${{ env.TAG }}.tar + key: ${{ env.IMAGE }} + path: /tmp/${{ env.IMAGE }}.tar - name: Load Docker image run: | - docker load --input /tmp/${{ env.TAG }}.tar + docker load --input /tmp/${{ env.IMAGE }}.tar docker image ls -a - name: Start Appwrite @@ -119,12 +119,12 @@ jobs: # - name: Load Cache # uses: actions/cache@v3 # with: - # key: ${{ env.TAG }} - # path: /tmp/${{ env.TAG }}.tar + # key: ${{ env.IMAGE }} + # path: /tmp/${{ env.IMAGE }}.tar # - name: Load Docker image # run: | - # docker load --input /tmp/${{ env.TAG }}.tar + # docker load --input /tmp/${{ env.IMAGE }}.tar # docker image ls -a # - name: Start Appwrite @@ -155,12 +155,12 @@ jobs: id: load-cache uses: actions/cache@v3 with: - key: ${{ env.TAG }} - path: /tmp/${{ env.TAG }}.tar + key: ${{ env.IMAGE }} + path: /tmp/${{ env.IMAGE }}.tar - name: Load Docker image run: | - docker load --input /tmp/${{ env.TAG }}.tar + docker load --input /tmp/${{ env.IMAGE }}.tar docker image ls -a - name: Start Appwrite From 21357bfe7bbfa01d2a021ba217dc80d1a77daaf2 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 22:32:54 +0000 Subject: [PATCH 16/57] chore: update CI file --- .github/workflows/tests.yml | 76 ------------------------------------- 1 file changed, 76 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 396e8bbcc..eff3a2fcc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,23 +42,10 @@ jobs: load: true cache-from: type=gha cache-to: type=gha,mode=max - outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar build-args: | DEBUG=false TESTING=true VERSION=dev - - - name: Cache Docker Image - uses: actions/cache@v3 - with: - key: ${{ env.IMAGE }} - path: /tmp/${{ env.IMAGE }}.tar - - # - name: Upload Docker Image - # uses: actions/upload-artifact@v3 - # with: - # name: ${{ env.IMAGE }} - # path: /tmp/${{ env.IMAGE }}.tar unit_test: name: Unit Test @@ -71,28 +58,10 @@ jobs: with: fetch-depth: 1 submodules: recursive - - # - name: Download artifact - # uses: actions/download-artifact@v3 - # with: - # name: ${{ env.IMAGE }} - # path: /tmp - - - name: Load Cache - uses: actions/cache@v3 - with: - key: ${{ env.IMAGE }} - path: /tmp/${{ env.IMAGE }}.tar - - - name: Load Docker image - run: | - docker load --input /tmp/${{ env.IMAGE }}.tar - docker image ls -a - name: Start Appwrite run: | docker compose up -d - sleep 10 - name: Doctor run: docker compose exec -T appwrite doctor @@ -103,38 +72,6 @@ jobs: - name: Run Unit Tests run: docker compose exec appwrite test /usr/src/code/tests/unit - - # accounts_test: - # name: Accounts Test - # runs-on: ubuntu-latest - # needs: setup - - # steps: - # - name: checkout - # uses: actions/checkout@v2 - # with: - # fetch-depth: 1 - # submodules: recursive - - # - name: Load Cache - # uses: actions/cache@v3 - # with: - # key: ${{ env.IMAGE }} - # path: /tmp/${{ env.IMAGE }}.tar - - # - name: Load Docker image - # run: | - # docker load --input /tmp/${{ env.IMAGE }}.tar - # docker image ls -a - - # - name: Start Appwrite - # run: | - # docker compose up -d - # sleep 10 - - # - name: Run Accounts Tests - # run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/Account --debug - e2e_test: name: E2E Test runs-on: ubuntu-latest @@ -151,20 +88,7 @@ jobs: fetch-depth: 2 submodules: recursive - - name: Load Cache - id: load-cache - uses: actions/cache@v3 - with: - key: ${{ env.IMAGE }} - path: /tmp/${{ env.IMAGE }}.tar - - - name: Load Docker image - run: | - docker load --input /tmp/${{ env.IMAGE }}.tar - docker image ls -a - - name: Start Appwrite - if: steps.load-cache.outputs.cache-hit == 'true' run: | docker compose up -d sleep 20 From ebb4bc7e6bad863c4ba8cd34e7cea2e5dc5ff66f Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 22:39:11 +0000 Subject: [PATCH 17/57] chore: update CI file --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eff3a2fcc..696c80c35 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,7 +38,7 @@ jobs: with: context: . push: false - tag: ${{ env.IMAGE }} + tags: ${{ env.IMAGE }} load: true cache-from: type=gha cache-to: type=gha,mode=max From 1415727f10f3a6084afa3bbf6e0d3514952e8ce1 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 22:53:50 +0000 Subject: [PATCH 18/57] chore: update CI file --- .github/workflows/tests.yml | 38 ++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 696c80c35..2206c3909 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,10 +42,23 @@ jobs: load: true cache-from: type=gha cache-to: type=gha,mode=max + outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar build-args: | DEBUG=false TESTING=true VERSION=dev + + - name: Cache Docker Image + uses: actions/cache@v3 + with: + key: ${{ env.IMAGE }}-${{ github.sha }} + path: /tmp/${{ env.IMAGE }}.tar + + # - name: Upload Docker Image + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ env.IMAGE }} + # path: /tmp/${{ env.IMAGE }}.tar unit_test: name: Unit Test @@ -58,10 +71,20 @@ jobs: with: fetch-depth: 1 submodules: recursive - - - name: Start Appwrite + + - name: Load Cache + uses: actions/cache@v3 + with: + key: ${{ env.IMAGE }}-${{ github.sha }} + path: /tmp/${{ env.IMAGE }}.tar + fail-on-cache-miss: true + + - name: Load and Start Appwrite + if: steps.load-cache.outputs.cache-hit == 'true' run: | + docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d + sleep 10 - name: Doctor run: docker compose exec -T appwrite doctor @@ -88,8 +111,17 @@ jobs: fetch-depth: 2 submodules: recursive - - name: Start Appwrite + - name: Load Cache + uses: actions/cache@v3 + with: + key: ${{ env.IMAGE }}-${{ github.sha }} + path: /tmp/${{ env.IMAGE }}.tar + fail-on-cache-miss: true + + - name: Load and Start Appwrite + if: steps.load-cache.outputs.cache-hit == 'true' run: | + docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d sleep 20 From 733b7ed612e7c32979f05b0aba36b64c416ae172 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 22:57:25 +0000 Subject: [PATCH 19/57] chore: update CI file --- .github/workflows/tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2206c3909..dc2dffca6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -80,7 +80,6 @@ jobs: fail-on-cache-miss: true - name: Load and Start Appwrite - if: steps.load-cache.outputs.cache-hit == 'true' run: | docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d @@ -119,7 +118,6 @@ jobs: fail-on-cache-miss: true - name: Load and Start Appwrite - if: steps.load-cache.outputs.cache-hit == 'true' run: | docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d From 10f6cc7b0b2410361376239d84dc659c0c0a9c49 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 23:12:11 +0000 Subject: [PATCH 20/57] chore: update CI file --- .github/workflows/tests.yml | 124 +++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 60 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dc2dffca6..0720d4ce5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,17 +42,21 @@ jobs: load: true cache-from: type=gha cache-to: type=gha,mode=max - outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar + # outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar build-args: | DEBUG=false TESTING=true VERSION=dev - - name: Cache Docker Image - uses: actions/cache@v3 - with: - key: ${{ env.IMAGE }}-${{ github.sha }} - path: /tmp/${{ env.IMAGE }}.tar + - name: Save Docker Images + run: | + docker images --filter="dangling=false" | sed '1d' | awk '{print $1 ":" $2 }' + + # - name: Cache Docker Image + # uses: actions/cache@v3 + # with: + # key: ${{ env.IMAGE }}-${{ github.sha }} + # path: /tmp/${{ env.IMAGE }}.tar # - name: Upload Docker Image # uses: actions/upload-artifact@v3 @@ -60,68 +64,68 @@ jobs: # name: ${{ env.IMAGE }} # path: /tmp/${{ env.IMAGE }}.tar - unit_test: - name: Unit Test - runs-on: ubuntu-latest - needs: setup + # unit_test: + # name: Unit Test + # runs-on: ubuntu-latest + # needs: setup - steps: - - name: checkout - uses: actions/checkout@v2 - with: - fetch-depth: 1 - submodules: recursive + # steps: + # - name: checkout + # uses: actions/checkout@v2 + # with: + # fetch-depth: 1 + # submodules: recursive - - name: Load Cache - uses: actions/cache@v3 - with: - key: ${{ env.IMAGE }}-${{ github.sha }} - path: /tmp/${{ env.IMAGE }}.tar - fail-on-cache-miss: true + # - name: Load Cache + # uses: actions/cache@v3 + # with: + # key: ${{ env.IMAGE }}-${{ github.sha }} + # path: /tmp/${{ env.IMAGE }}.tar + # fail-on-cache-miss: true - - name: Load and Start Appwrite - run: | - docker load --input /tmp/${{ env.IMAGE }}.tar - docker compose up -d - sleep 10 + # - name: Load and Start Appwrite + # run: | + # docker load --input /tmp/${{ env.IMAGE }}.tar + # docker compose up -d + # sleep 10 - - name: Doctor - run: docker compose exec -T appwrite doctor + # - name: Doctor + # run: docker compose exec -T appwrite doctor - - name: Environment Variables - run: docker compose exec -T appwrite vars + # - name: Environment Variables + # run: docker compose exec -T appwrite vars - - name: Run Unit Tests - run: docker compose exec appwrite test /usr/src/code/tests/unit + # - name: Run Unit Tests + # run: docker compose exec appwrite test /usr/src/code/tests/unit - e2e_test: - name: E2E Test - runs-on: ubuntu-latest - needs: setup - strategy: - fail-fast: false - matrix: - services: [Account,Avatars,Console,Databases,Functions,GraphQL,Health,Locale,Projects,Realtime,Storage,Teams,Users,Webhooks] + # e2e_test: + # name: E2E Test + # runs-on: ubuntu-latest + # needs: setup + # strategy: + # fail-fast: false + # matrix: + # services: [Account,Avatars,Console,Databases,Functions,GraphQL,Health,Locale,Projects,Realtime,Storage,Teams,Users,Webhooks] - steps: - - name: checkout - uses: actions/checkout@v2 - with: - fetch-depth: 2 - submodules: recursive + # steps: + # - name: checkout + # uses: actions/checkout@v2 + # with: + # fetch-depth: 2 + # submodules: recursive - - name: Load Cache - uses: actions/cache@v3 - with: - key: ${{ env.IMAGE }}-${{ github.sha }} - path: /tmp/${{ env.IMAGE }}.tar - fail-on-cache-miss: true + # - name: Load Cache + # uses: actions/cache@v3 + # with: + # key: ${{ env.IMAGE }}-${{ github.sha }} + # path: /tmp/${{ env.IMAGE }}.tar + # fail-on-cache-miss: true - - name: Load and Start Appwrite - run: | - docker load --input /tmp/${{ env.IMAGE }}.tar - docker compose up -d - sleep 20 + # - name: Load and Start Appwrite + # run: | + # docker load --input /tmp/${{ env.IMAGE }}.tar + # docker compose up -d + # sleep 20 - - name: Run ${{matrix.services}} Tests - run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file + # - name: Run ${{matrix.services}} Tests + # run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file From 0f67c1151f023f46ef2e3ad55329333665e8017c Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 23:18:26 +0000 Subject: [PATCH 21/57] chore: update CI file --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0720d4ce5..e2b6e1d8c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,7 +50,7 @@ jobs: - name: Save Docker Images run: | - docker images --filter="dangling=false" | sed '1d' | awk '{print $1 ":" $2 }' + docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u # - name: Cache Docker Image # uses: actions/cache@v3 From 1a93aa408529e5c8fe047f240435aa68a61bda3b Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 23:24:16 +0000 Subject: [PATCH 22/57] chore: update CI file --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e2b6e1d8c..3eaf13635 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,7 +50,9 @@ jobs: - name: Save Docker Images run: | + docker compose images docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u + # docker save $(docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u) -o allinone.tar # - name: Cache Docker Image # uses: actions/cache@v3 From eaf94aa670f1440667b8009b04a51262afcd9007 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 23:31:04 +0000 Subject: [PATCH 23/57] chore: update CI file --- .github/workflows/tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3eaf13635..8e26f79fc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,8 +50,9 @@ jobs: - name: Save Docker Images run: | - docker compose images - docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u + docker image ls + # docker compose images + # docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u # docker save $(docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u) -o allinone.tar # - name: Cache Docker Image From 01aaa6b33789025e99dfbbeb3cff24f2d5e20391 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 23:34:23 +0000 Subject: [PATCH 24/57] chore: update CI file --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8e26f79fc..1d7e66b6b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,7 +51,7 @@ jobs: - name: Save Docker Images run: | docker image ls - # docker compose images + docker compose images # docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u # docker save $(docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u) -o allinone.tar From 889942ee764c6247a3f00494c95fce3f663876b1 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 23:37:41 +0000 Subject: [PATCH 25/57] chore: update CI file --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1d7e66b6b..7c0230bcf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,6 +51,7 @@ jobs: - name: Save Docker Images run: | docker image ls + docker compose pull docker compose images # docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u # docker save $(docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u) -o allinone.tar From 29d0820b10b990da73f2e7df3fcc205a88b79af7 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 23:41:16 +0000 Subject: [PATCH 26/57] chore: update CI file --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7c0230bcf..38423c033 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,7 +51,7 @@ jobs: - name: Save Docker Images run: | docker image ls - docker compose pull + docker compose pull --ignore-pull-failures --ignore-buildable docker compose images # docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u # docker save $(docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u) -o allinone.tar From 0ddf036bd508a46a5b96cfdc1967b7e44e0a4d46 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 23:44:19 +0000 Subject: [PATCH 27/57] chore: update CI file --- .github/workflows/tests.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 38423c033..0f9260b17 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,11 +47,14 @@ jobs: DEBUG=false TESTING=true VERSION=dev + + - name: Pull Docker Images + run: docker compose pull --ignore-pull-failures --ignore-buildable - - name: Save Docker Images + - name: List Files and images run: | + ls docker image ls - docker compose pull --ignore-pull-failures --ignore-buildable docker compose images # docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u # docker save $(docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u) -o allinone.tar From 0a2874458b5cec67a005a94ecd43c92b8714cbac Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 8 Sep 2023 23:54:27 +0000 Subject: [PATCH 28/57] chore: update CI file --- .github/workflows/tests.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0f9260b17..62990984d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -53,11 +53,9 @@ jobs: - name: List Files and images run: | - ls - docker image ls - docker compose images - # docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u - # docker save $(docker compose images | sed '1d' | awk '{ print $2 ":" $3 }' | sort -u) -o allinone.tar + docker compose config --images | sort -u + docker save $(docker compose config --images | sort -u) -o allinone.tar + stat allinone.tar # - name: Cache Docker Image # uses: actions/cache@v3 From 29e056c71b1175043d03f970204f53c372561d0a Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 9 Sep 2023 00:00:06 +0000 Subject: [PATCH 29/57] chore: update CI file --- .github/workflows/tests.yml | 67 ++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 62990984d..028599d7e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -54,14 +54,13 @@ jobs: - name: List Files and images run: | docker compose config --images | sort -u - docker save $(docker compose config --images | sort -u) -o allinone.tar - stat allinone.tar + docker save $(docker compose config --images | sort -u) -o /tmp/allinone.tar - # - name: Cache Docker Image - # uses: actions/cache@v3 - # with: - # key: ${{ env.IMAGE }}-${{ github.sha }} - # path: /tmp/${{ env.IMAGE }}.tar + - name: Cache Docker Image + uses: actions/cache@v3 + with: + key: ${{ env.IMAGE }}-${{ github.sha }} + path: /tmp/allinone.tar # - name: Upload Docker Image # uses: actions/upload-artifact@v3 @@ -69,39 +68,39 @@ jobs: # name: ${{ env.IMAGE }} # path: /tmp/${{ env.IMAGE }}.tar - # unit_test: - # name: Unit Test - # runs-on: ubuntu-latest - # needs: setup + unit_test: + name: Unit Test + runs-on: ubuntu-latest + needs: setup - # steps: - # - name: checkout - # uses: actions/checkout@v2 - # with: - # fetch-depth: 1 - # submodules: recursive + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 1 + submodules: recursive - # - name: Load Cache - # uses: actions/cache@v3 - # with: - # key: ${{ env.IMAGE }}-${{ github.sha }} - # path: /tmp/${{ env.IMAGE }}.tar - # fail-on-cache-miss: true + - name: Load Cache + uses: actions/cache@v3 + with: + key: ${{ env.IMAGE }}-${{ github.sha }} + path: /tmp/allinone.tar + fail-on-cache-miss: true - # - name: Load and Start Appwrite - # run: | - # docker load --input /tmp/${{ env.IMAGE }}.tar - # docker compose up -d - # sleep 10 + - name: Load and Start Appwrite + run: | + docker load --input /tmp/allinone.tar + docker compose up -d + sleep 10 - # - name: Doctor - # run: docker compose exec -T appwrite doctor + - name: Doctor + run: docker compose exec -T appwrite doctor - # - name: Environment Variables - # run: docker compose exec -T appwrite vars + - name: Environment Variables + run: docker compose exec -T appwrite vars - # - name: Run Unit Tests - # run: docker compose exec appwrite test /usr/src/code/tests/unit + - name: Run Unit Tests + run: docker compose exec appwrite test /usr/src/code/tests/unit # e2e_test: # name: E2E Test From e390cf0d70cf7da273def57cd513e2dc954d5e91 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 9 Sep 2023 00:11:14 +0000 Subject: [PATCH 30/57] chore: update CI file --- .github/workflows/tests.yml | 54 ++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 028599d7e..5d83b4a2c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -102,34 +102,34 @@ jobs: - name: Run Unit Tests run: docker compose exec appwrite test /usr/src/code/tests/unit - # e2e_test: - # name: E2E Test - # runs-on: ubuntu-latest - # needs: setup - # strategy: - # fail-fast: false - # matrix: - # services: [Account,Avatars,Console,Databases,Functions,GraphQL,Health,Locale,Projects,Realtime,Storage,Teams,Users,Webhooks] + e2e_test: + name: E2E Test + runs-on: ubuntu-latest + needs: setup + strategy: + fail-fast: false + matrix: + services: [Account,Avatars,Console,Databases,Functions,GraphQL,Health,Locale,Projects,Realtime,Storage,Teams,Users,Webhooks] - # steps: - # - name: checkout - # uses: actions/checkout@v2 - # with: - # fetch-depth: 2 - # submodules: recursive + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 2 + submodules: recursive - # - name: Load Cache - # uses: actions/cache@v3 - # with: - # key: ${{ env.IMAGE }}-${{ github.sha }} - # path: /tmp/${{ env.IMAGE }}.tar - # fail-on-cache-miss: true + - name: Load Cache + uses: actions/cache@v3 + with: + key: ${{ env.IMAGE }}-${{ github.sha }} + path: /tmp/allinone.tar + fail-on-cache-miss: true - # - name: Load and Start Appwrite - # run: | - # docker load --input /tmp/${{ env.IMAGE }}.tar - # docker compose up -d - # sleep 20 + - name: Load and Start Appwrite + run: | + docker load --input /tmp/allinone.tar + docker compose up -d + sleep 20 - # - name: Run ${{matrix.services}} Tests - # run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file + - name: Run ${{matrix.services}} Tests + run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file From e70d5beb0d3235d25a52591feb63f41867e3a2fa Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 9 Sep 2023 01:29:56 +0000 Subject: [PATCH 31/57] chore: update ci file --- .github/workflows/tests.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5d83b4a2c..cf0eaac4a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,25 +42,25 @@ jobs: load: true cache-from: type=gha cache-to: type=gha,mode=max - # outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar + outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar build-args: | DEBUG=false TESTING=true VERSION=dev - - name: Pull Docker Images - run: docker compose pull --ignore-pull-failures --ignore-buildable + # - name: Pull Docker Images + # run: docker compose pull --ignore-pull-failures --ignore-buildable - - name: List Files and images - run: | - docker compose config --images | sort -u - docker save $(docker compose config --images | sort -u) -o /tmp/allinone.tar + # - name: List Files and images + # run: | + # docker compose config --images | sort -u + # docker save $(docker compose config --images | sort -u) -o /tmp/allinone.tar - name: Cache Docker Image uses: actions/cache@v3 with: key: ${{ env.IMAGE }}-${{ github.sha }} - path: /tmp/allinone.tar + path: /tmp/${{ env.IMAGE }}.tar # - name: Upload Docker Image # uses: actions/upload-artifact@v3 @@ -84,12 +84,12 @@ jobs: uses: actions/cache@v3 with: key: ${{ env.IMAGE }}-${{ github.sha }} - path: /tmp/allinone.tar + path: /tmp/${{ env.IMAGE }}.tar fail-on-cache-miss: true - name: Load and Start Appwrite run: | - docker load --input /tmp/allinone.tar + docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d sleep 10 @@ -122,12 +122,12 @@ jobs: uses: actions/cache@v3 with: key: ${{ env.IMAGE }}-${{ github.sha }} - path: /tmp/allinone.tar + path: /tmp/${{ env.IMAGE }}.tar fail-on-cache-miss: true - name: Load and Start Appwrite run: | - docker load --input /tmp/allinone.tar + docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d sleep 20 From 238089409a673afa1388a0abf51a9e0b226e4ae5 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 9 Sep 2023 01:39:01 +0000 Subject: [PATCH 32/57] chore: update ci file --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cf0eaac4a..79cf57a37 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -130,6 +130,10 @@ jobs: docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d sleep 20 + + - name: Additional Sleep for Functions and GraphQL + if: ${{ matrix.services == 'Functions' || matrix.services == 'GraphQL' }} + run: sleep 30 - name: Run ${{matrix.services}} Tests run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file From 1c9dfb903d310dacc857f2f5ccd825aa0c9a789c Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 9 Sep 2023 01:58:37 +0000 Subject: [PATCH 33/57] chore: update ci file --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 79cf57a37..27f580f4f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -129,11 +129,11 @@ jobs: run: | docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d - sleep 20 + sleep 10 - - name: Additional Sleep for Functions and GraphQL - if: ${{ matrix.services == 'Functions' || matrix.services == 'GraphQL' }} - run: sleep 30 + - name: Additional Sleep for GraphQL + if: ${{ matrix.services == 'GraphQL' }} + run: sleep 60 - name: Run ${{matrix.services}} Tests run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file From ff4816a436cbd3381035a38e5028b5241bb64bcf Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 9 Sep 2023 02:17:21 +0000 Subject: [PATCH 34/57] chore: update ci file --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 27f580f4f..89bbc3b79 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -131,9 +131,9 @@ jobs: docker compose up -d sleep 10 - - name: Additional Sleep for GraphQL + - name: Output build logs if: ${{ matrix.services == 'GraphQL' }} - run: sleep 60 + run: docker compose logs appwrite-worker-builds - name: Run ${{matrix.services}} Tests run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file From 85fcddceade12722bed32e3f4db4881f756d8680 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 9 Sep 2023 02:20:25 +0000 Subject: [PATCH 35/57] chore: update ci file --- phpunit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index f83f9f0fa..3d15bbd21 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,7 +6,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" + stopOnFailure="true" > From 8a28c9ddbc1f9ce43b81756138efcccc20cf57c9 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 9 Sep 2023 02:29:50 +0000 Subject: [PATCH 36/57] chore: update ci file --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 89bbc3b79..d570f9191 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -130,10 +130,10 @@ jobs: docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d sleep 10 + + - name: Run ${{matrix.services}} Tests + run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug - name: Output build logs if: ${{ matrix.services == 'GraphQL' }} - run: docker compose logs appwrite-worker-builds - - - name: Run ${{matrix.services}} Tests - run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file + run: docker compose logs appwrite-worker-builds \ No newline at end of file From ab5fa9666841861f644e408d190d908a7a13f1f1 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 9 Sep 2023 02:39:51 +0000 Subject: [PATCH 37/57] chore: update ci file --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d570f9191..819b7c652 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -135,5 +135,5 @@ jobs: run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug - name: Output build logs - if: ${{ matrix.services == 'GraphQL' }} + if: always() && ${{ matrix.services == 'GraphQL' }} run: docker compose logs appwrite-worker-builds \ No newline at end of file From 9b0a2fdc73407c3d6fec2c7cef240212e1153869 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 3 Oct 2023 15:10:09 -0400 Subject: [PATCH 38/57] Fix docs links CONTRIBUTING.md --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1341c9f13..90c649728 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -84,7 +84,7 @@ $ git push origin [name_of_your_new_branch] To set up a working **development environment**, just fork the project git repository and install the backend and frontend dependencies using the proper package manager and create run the docker-compose stack. -> If you just want to install Appwrite for day-to-day use and not as a contributor, you can reference the [installation guide](https://github.com/appwrite/appwrite#installation), the [getting started guide](https://appwrite.io/docs/getting-started-for-web), or the main [README](README.md) file. +> If you just want to install Appwrite for day-to-day use and not as a contributor, you can reference the [installation guide](https://github.com/appwrite/appwrite#installation), the [getting started guide](https://appwrite.io/docs/quick-starts), or the main [README](README.md) file. ```bash git clone git@github.com:[YOUR_FORK_HERE]/appwrite.git @@ -451,7 +451,7 @@ From time to time, our team will add tutorials that will help contributors find - [Adding Support for a New OAuth2 Provider](./docs/tutorials/add-oauth2-provider.md) - [Appwrite Environment Variables](./docs/tutorials/add-environment-variable.md) -- [Running in Production](https://appwrite.io/docs/production) +- [Running in Production](https://appwrite.io/docs/advanced/self-hosting/production) - [Adding Storage Adapter](./docs/tutorials/add-storage-adapter.md) ## Other Ways to Help From 80574838a49c67e0cdb88fbcda776f43d082387a Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 17 Oct 2023 15:19:29 +0200 Subject: [PATCH 39/57] gitpod: fix composer usage --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 4c081dd27..d740c467c 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -8,7 +8,7 @@ tasks: command: | docker run --rm --interactive --tty \ --volume $PWD:/app \ - composer update \ + composer install \ --ignore-platform-reqs \ --optimize-autoloader \ --no-plugins \ From 9f3561aaa367d53de9b444ee35ac6346169421ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=B7=E5=8D=8E=20=E5=88=98?= Date: Thu, 19 Oct 2023 17:09:49 +0000 Subject: [PATCH 40/57] chore: cleanup ci file --- .github/workflows/tests.yml | 16 ---------------- composer.lock | 13 ++++++------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 819b7c652..4576787d3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,18 +18,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - # Fetch submodules submodules: recursive - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - # This is a separate action that sets up buildx runner - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -76,9 +66,6 @@ jobs: steps: - name: checkout uses: actions/checkout@v2 - with: - fetch-depth: 1 - submodules: recursive - name: Load Cache uses: actions/cache@v3 @@ -114,9 +101,6 @@ jobs: steps: - name: checkout uses: actions/checkout@v2 - with: - fetch-depth: 2 - submodules: recursive - name: Load Cache uses: actions/cache@v3 diff --git a/composer.lock b/composer.lock index e45e4b3d8..d88355c4c 100644 --- a/composer.lock +++ b/composer.lock @@ -2283,23 +2283,22 @@ }, { "name": "utopia-php/logger", - "version": "0.3.2", + "version": "0.3.1", "source": { "type": "git", "url": "https://github.com/utopia-php/logger.git", - "reference": "9151b7d16eab18d4c37c34643041cc0f33ca4a6c" + "reference": "de623f1ec1c672c795d113dd25c5bf212f7ef4fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/logger/zipball/9151b7d16eab18d4c37c34643041cc0f33ca4a6c", - "reference": "9151b7d16eab18d4c37c34643041cc0f33ca4a6c", + "url": "https://api.github.com/repos/utopia-php/logger/zipball/de623f1ec1c672c795d113dd25c5bf212f7ef4fc", + "reference": "de623f1ec1c672c795d113dd25c5bf212f7ef4fc", "shasum": "" }, "require": { "php": ">=8.0" }, "require-dev": { - "laravel/pint": "1.2.*", "phpstan/phpstan": "1.9.x-dev", "phpunit/phpunit": "^9.3", "vimeo/psalm": "4.0.1" @@ -2331,9 +2330,9 @@ ], "support": { "issues": "https://github.com/utopia-php/logger/issues", - "source": "https://github.com/utopia-php/logger/tree/0.3.2" + "source": "https://github.com/utopia-php/logger/tree/0.3.1" }, - "time": "2023-10-16T08:16:19+00:00" + "time": "2023-02-10T15:52:50+00:00" }, { "name": "utopia-php/messaging", From c0f099e176e50d744bcefea7d967ac6912498428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=B7=E5=8D=8E=20=E5=88=98?= Date: Sun, 22 Oct 2023 15:28:39 +0000 Subject: [PATCH 41/57] chore: update test file --- .github/workflows/tests.yml | 1 - phpunit.xml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4576787d3..d9d94e843 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,6 @@ jobs: setup: name: Setup & Build Appwrite Image runs-on: ubuntu-latest - steps: - name: Checkout repository uses: actions/checkout@v3 diff --git a/phpunit.xml b/phpunit.xml index 99ccaf175..975b54962 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,7 +6,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="true" + stopOnFailure="false" > From 0411f9f5305117d1a1ea464e71b91c9d59d0743d Mon Sep 17 00:00:00 2001 From: shimon Date: Mon, 23 Oct 2023 16:33:26 +0300 Subject: [PATCH 42/57] fix function-worker body param typo --- src/Appwrite/Platform/Workers/Functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index 6b7b5efe0..7a6cfe115 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -77,7 +77,7 @@ class Functions extends Action $type = $payload['type'] ?? ''; $events = $payload['events'] ?? []; - $data = $payload['data'] ?? ''; + $data = $payload['body'] ?? ''; $eventData = $payload['payload'] ?? ''; $project = new Document($payload['project'] ?? []); $function = new Document($payload['function'] ?? []); From 3addf76a2a1b5a7986fe744e155a2fe4bdca3bc5 Mon Sep 17 00:00:00 2001 From: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> Date: Mon, 23 Oct 2023 18:53:40 +0000 Subject: [PATCH 43/57] Bump appwrite version to 1.4.7 --- README-CN.md | 6 +++--- README.md | 6 +++--- app/init.php | 2 +- src/Appwrite/Migration/Migration.php | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README-CN.md b/README-CN.md index 1328ef5cf..1df799f7e 100644 --- a/README-CN.md +++ b/README-CN.md @@ -66,7 +66,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.4.6 + appwrite/appwrite:1.4.7 ``` ### Windows @@ -78,7 +78,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.4.6 + appwrite/appwrite:1.4.7 ``` #### PowerShell @@ -88,7 +88,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.4.6 + appwrite/appwrite:1.4.7 ``` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 diff --git a/README.md b/README.md index 40a4248d5..b4980d0e6 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.4.6 + appwrite/appwrite:1.4.7 ``` ### Windows @@ -88,7 +88,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.4.6 + appwrite/appwrite:1.4.7 ``` #### PowerShell @@ -98,7 +98,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.4.6 + appwrite/appwrite:1.4.7 ``` Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation. diff --git a/app/init.php b/app/init.php index 16eceb1ea..86e4790a3 100644 --- a/app/init.php +++ b/app/init.php @@ -110,7 +110,7 @@ const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours const APP_USER_ACCCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 514; -const APP_VERSION_STABLE = '1.4.6'; +const APP_VERSION_STABLE = '1.4.7'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip'; diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 15098793a..964aef66e 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -71,6 +71,7 @@ abstract class Migration '1.4.4' => 'V19', '1.4.5' => 'V19', '1.4.6' => 'V19', + '1.4.7' => 'V19', ]; /** From 84ea81f56d34a4fb2fc046120cfb342173ee0ec6 Mon Sep 17 00:00:00 2001 From: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> Date: Mon, 23 Oct 2023 18:54:33 +0000 Subject: [PATCH 44/57] Add 1.4.7 to CHANGES.md --- CHANGES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 33b41d35f..ac405184d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +# Version 1.4.7 + +## Fixes +- Fix missing body in async function execution in [#6988](https://github.com/appwrite/appwrite/pull/6988) + # Version 1.4.6 ## Changes From fbcbd0d430a59eaf3bfbe13548dc1229ee9be362 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 24 Oct 2023 14:32:22 +0200 Subject: [PATCH 45/57] feat: realtime error handling --- app/config/errors.php | 17 +++++++++++ app/realtime.php | 51 +++++++++++++++++-------------- src/Appwrite/Extend/Exception.php | 9 ++++-- 3 files changed, 52 insertions(+), 25 deletions(-) diff --git a/app/config/errors.php b/app/config/errors.php index 159c80617..78c633ee7 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -732,4 +732,21 @@ return [ 'description' => 'Migration is already in progress. You can check the status of the migration in your Appwrite Console\'s "Settings" > "Migrations".', 'code' => 409, ], + + /** Realtime */ + Exception::REALTIME_MESSAGE_FORMAT_INVALID => [ + 'name' => Exception::REALTIME_MESSAGE_FORMAT_INVALID, + 'description' => 'Message format is not valid.', + 'code' => 1003, + ], + Exception::REALTIME_POLICY_VIOLATION => [ + 'name' => Exception::REALTIME_POLICY_VIOLATION, + 'description' => 'Policy violation.', + 'code' => 1008, + ], + Exception::REALTIME_TOO_MANY_MESSAGES => [ + 'name' => Exception::REALTIME_TOO_MANY_MESSAGES, + 'description' => 'Too many messages.', + 'code' => 1013, + ], ]; diff --git a/app/realtime.php b/app/realtime.php index 25b0532b4..42fa43f57 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -1,8 +1,10 @@ get('logger'); - if ($logger) { + if ($logger && !$error instanceof Exception) { $version = App::getEnv('_APP_VERSION', 'UNKNOWN'); $log = new Log(); $log->setNamespace("realtime"); - $log->setServer(\gethostname()); + $log->setServer(gethostname()); $log->setVersion($version); $log->setType(Log::TYPE_ERROR); $log->setMessage($error->getMessage()); @@ -182,7 +186,7 @@ $server->onStart(function () use ($stats, $register, $containerId, &$statsDocume $statsDocument = Authorization::skip(fn () => $database->createDocument('realtime', $document)); break; - } catch (\Throwable $th) { + } catch (Throwable) { Console::warning("Collection not ready. Retrying connection ({$attempts})..."); sleep(DATABASE_RECONNECT_SLEEP); } @@ -210,7 +214,7 @@ $server->onStart(function () use ($stats, $register, $containerId, &$statsDocume ->setAttribute('value', json_encode($payload)); Authorization::skip(fn () => $database->updateDocument('realtime', $statsDocument->getId(), $statsDocument)); - } catch (\Throwable $th) { + } catch (Throwable $th) { call_user_func($logError, $th, "updateWorkerDocument"); } finally { $register->get('pools')->reclaim(); @@ -362,7 +366,7 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats, $stats->incr($event['project'], 'messages', $num); } }); - } catch (\Throwable $th) { + } catch (Throwable $th) { call_user_func($logError, $th, "pubSubConnection"); Console::error('Pub/sub error: ' . $th->getMessage()); @@ -389,19 +393,19 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, App::setResource('response', fn() => $response); try { - /** @var \Utopia\Database\Document $project */ + /** @var Document $project */ $project = $app->getResource('project'); /* * Project Check */ if (empty($project->getId())) { - throw new Exception('Missing or unknown project ID', 1008); + throw new Exception(Exception::REALTIME_POLICY_VIOLATION, 'Missing or unknown project ID'); } $dbForProject = getProjectDB($project); - $console = $app->getResource('console'); /** @var \Utopia\Database\Document $console */ - $user = $app->getResource('user'); /** @var \Utopia\Database\Document $user */ + $console = $app->getResource('console'); /** @var Document $console */ + $user = $app->getResource('user'); /** @var Document $user */ /* * Abuse Check @@ -416,7 +420,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $abuse = new Abuse($timeLimit); if (App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled' && $abuse->check()) { - throw new Exception('Too many requests', 1013); + throw new Exception(Exception::REALTIME_TOO_MANY_MESSAGES, 'Too many requests'); } /* @@ -425,10 +429,10 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, * Skip this check for non-web platforms which are not required to send an origin header. */ $origin = $request->getOrigin(); - $originValidator = new Origin(\array_merge($project->getAttribute('platforms', []), $console->getAttribute('platforms', []))); + $originValidator = new Origin(array_merge($project->getAttribute('platforms', []), $console->getAttribute('platforms', []))); if (!$originValidator->isValid($origin) && $project->getId() !== 'console') { - throw new Exception($originValidator->getDescription(), 1008); + throw new Exception(Exception::REALTIME_POLICY_VIOLATION, $originValidator->getDescription()); } $roles = Auth::getRoles($user); @@ -439,7 +443,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, * Channels Check */ if (empty($channels)) { - throw new Exception('Missing channels', 1008); + throw new Exception(Exception::REALTIME_POLICY_VIOLATION, 'Missing channels'); } $realtime->subscribe($project->getId(), $connection, $roles, $channels); @@ -460,7 +464,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, ]); $stats->incr($project->getId(), 'connections'); $stats->incr($project->getId(), 'connectionsTotal'); - } catch (\Throwable $th) { + } catch (Throwable $th) { call_user_func($logError, $th, "initServer"); $response = [ @@ -486,7 +490,6 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $server->onMessage(function (int $connection, string $message) use ($server, $register, $realtime, $containerId) { try { - $app = new App('UTC'); $response = new Response(new SwooleResponse()); $projectId = $realtime->connections[$connection]['projectId']; $database = getConsoleDB(); @@ -494,6 +497,8 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re if ($projectId !== 'console') { $project = Authorization::skip(fn() => $database->getDocument('projects', $projectId)); $database = getProjectDB($project); + } else { + $project = null; } /* @@ -510,22 +515,22 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re $abuse = new Abuse($timeLimit); if ($abuse->check() && App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled') { - throw new Exception('Too many messages', 1013); + throw new Exception(Exception::REALTIME_TOO_MANY_MESSAGES, 'Too many messages.'); } $message = json_decode($message, true); if (is_null($message) || (!array_key_exists('type', $message) && !array_key_exists('data', $message))) { - throw new Exception('Message format is not valid.', 1003); + throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Message format is not valid.'); } switch ($message['type']) { - /** + /** * This type is used to authenticate. */ case 'authentication': if (!array_key_exists('session', $message['data'])) { - throw new Exception('Payload is not valid.', 1003); + throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Payload is not valid.'); } $session = Auth::decodeSession($message['data']['session']); @@ -540,7 +545,7 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re || !Auth::sessionVerify($user->getAttribute('sessions', []), Auth::$secret, $authDuration) // Validate user has valid login token ) { // cookie not valid - throw new Exception('Session is not valid.', 1003); + throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Session is not valid.'); } $roles = Auth::getRoles($user); @@ -560,9 +565,9 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re break; default: - throw new Exception('Message type is not valid.', 1003); + throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Message type is not valid.'); } - } catch (\Throwable $th) { + } catch (Throwable $th) { $response = [ 'type' => 'error', 'data' => [ diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index c7ff2e73c..dc56932cd 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -225,8 +225,13 @@ class Exception extends \Exception public const MIGRATION_ALREADY_EXISTS = 'migration_already_exists'; public const MIGRATION_IN_PROGRESS = 'migration_in_progress'; - protected $type = ''; - protected $errors = []; + /** Realtime */ + public const REALTIME_MESSAGE_FORMAT_INVALID = 'realtime_message_format_invalid'; + public const REALTIME_TOO_MANY_MESSAGES = 'realtime_too_many_messages'; + public const REALTIME_POLICY_VIOLATION = 'realtime_policy_violation'; + + protected string $type = ''; + protected array $errors = []; public function __construct(string $type = Exception::GENERAL_UNKNOWN, string $message = null, int $code = null, \Throwable $previous = null) { From 8db372a7d3b14406719d697ac4131c7de3669296 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 25 Oct 2023 13:55:32 +1300 Subject: [PATCH 46/57] Update dependencies --- composer.json | 2 +- composer.lock | 115 +++++++++++--------------------------------------- 2 files changed, 25 insertions(+), 92 deletions(-) diff --git a/composer.json b/composer.json index f73fc0258..ef10f99a1 100644 --- a/composer.json +++ b/composer.json @@ -64,7 +64,7 @@ "utopia-php/preloader": "0.2.*", "utopia-php/queue": "0.5.*", "utopia-php/registry": "0.5.*", - "utopia-php/storage": "0.17.*", + "utopia-php/storage": "0.18.*", "utopia-php/swoole": "0.5.*", "utopia-php/vcs": "0.5.*", "utopia-php/websocket": "0.1.*", diff --git a/composer.lock b/composer.lock index 7823864bd..a9121a6dc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6ff937a260c3e0c09de9eb5e073d830d", + "content-hash": "06c2610579f319495ea7d2d28f42d376", "packages": [ { "name": "adhocore/jwt", @@ -851,72 +851,6 @@ }, "time": "2021-10-08T21:21:46+00:00" }, - { - "name": "laravel/pint", - "version": "v1.2.1", - "source": { - "type": "git", - "url": "https://github.com/laravel/pint.git", - "reference": "e60e2112ee779ce60f253695b273d1646a17d6f1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/e60e2112ee779ce60f253695b273d1646a17d6f1", - "reference": "e60e2112ee779ce60f253695b273d1646a17d6f1", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-mbstring": "*", - "ext-tokenizer": "*", - "ext-xml": "*", - "php": "^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.11.0", - "illuminate/view": "^9.32.0", - "laravel-zero/framework": "^9.2.0", - "mockery/mockery": "^1.5.1", - "nunomaduro/larastan": "^2.2.0", - "nunomaduro/termwind": "^1.14.0", - "pestphp/pest": "^1.22.1" - }, - "bin": [ - "builds/pint" - ], - "type": "project", - "autoload": { - "psr-4": { - "App\\": "app/", - "Database\\Seeders\\": "database/seeders/", - "Database\\Factories\\": "database/factories/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nuno Maduro", - "email": "enunomaduro@gmail.com" - } - ], - "description": "An opinionated code formatter for PHP.", - "homepage": "https://laravel.com", - "keywords": [ - "format", - "formatter", - "lint", - "linter", - "php" - ], - "support": { - "issues": "https://github.com/laravel/pint/issues", - "source": "https://github.com/laravel/pint" - }, - "time": "2022-11-29T16:25:20+00:00" - }, { "name": "league/csv", "version": "9.7.1", @@ -1972,16 +1906,16 @@ }, { "name": "utopia-php/database", - "version": "0.44.2", + "version": "0.44.3", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "591cadbc2c622a3304aae9a16ebfdbe75ef33a06" + "reference": "b2d403c25a77506e03db5736335b0cae52bcc18a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/591cadbc2c622a3304aae9a16ebfdbe75ef33a06", - "reference": "591cadbc2c622a3304aae9a16ebfdbe75ef33a06", + "url": "https://api.github.com/repos/utopia-php/database/zipball/b2d403c25a77506e03db5736335b0cae52bcc18a", + "reference": "b2d403c25a77506e03db5736335b0cae52bcc18a", "shasum": "" }, "require": { @@ -1994,7 +1928,7 @@ }, "require-dev": { "fakerphp/faker": "^1.14", - "laravel/pint": "1.4.*", + "laravel/pint": "1.13.*", "pcov/clobber": "^2.0", "phpstan/phpstan": "1.10.*", "phpunit/phpunit": "^9.4", @@ -2022,9 +1956,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.44.2" + "source": "https://github.com/utopia-php/database/tree/0.44.3" }, - "time": "2023-10-19T07:39:00+00:00" + "time": "2023-10-24T10:13:48+00:00" }, { "name": "utopia-php/domains", @@ -2808,16 +2742,16 @@ }, { "name": "utopia-php/storage", - "version": "0.17.0", + "version": "0.18.1", "source": { "type": "git", "url": "https://github.com/utopia-php/storage.git", - "reference": "efec5376c02d3d8330f1beb1469e6d6e313e21ee" + "reference": "983e6dee137012f9f57f126d3c79aab54e4e8824" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/storage/zipball/efec5376c02d3d8330f1beb1469e6d6e313e21ee", - "reference": "efec5376c02d3d8330f1beb1469e6d6e313e21ee", + "url": "https://api.github.com/repos/utopia-php/storage/zipball/983e6dee137012f9f57f126d3c79aab54e4e8824", + "reference": "983e6dee137012f9f57f126d3c79aab54e4e8824", "shasum": "" }, "require": { @@ -2857,9 +2791,9 @@ ], "support": { "issues": "https://github.com/utopia-php/storage/issues", - "source": "https://github.com/utopia-php/storage/tree/0.17.0" + "source": "https://github.com/utopia-php/storage/tree/0.18.1" }, - "time": "2023-08-21T11:28:36+00:00" + "time": "2023-10-24T14:44:19+00:00" }, { "name": "utopia-php/swoole", @@ -2914,26 +2848,25 @@ }, { "name": "utopia-php/system", - "version": "0.7.1", + "version": "0.7.2", "source": { "type": "git", "url": "https://github.com/utopia-php/system.git", - "reference": "01bf0d283aded0ee0a7a6e5ff540acf64270ab27" + "reference": "4593d4d334b0c15879c4744a826e0362924c5d66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/system/zipball/01bf0d283aded0ee0a7a6e5ff540acf64270ab27", - "reference": "01bf0d283aded0ee0a7a6e5ff540acf64270ab27", + "url": "https://api.github.com/repos/utopia-php/system/zipball/4593d4d334b0c15879c4744a826e0362924c5d66", + "reference": "4593d4d334b0c15879c4744a826e0362924c5d66", "shasum": "" }, "require": { - "laravel/pint": "1.2.*", "php": ">=8.0.0" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "^3.6", - "vimeo/psalm": "4.0.1" + "laravel/pint": "1.13.*", + "phpstan/phpstan": "1.10.*", + "phpunit/phpunit": "9.6.*" }, "type": "library", "autoload": { @@ -2965,9 +2898,9 @@ ], "support": { "issues": "https://github.com/utopia-php/system/issues", - "source": "https://github.com/utopia-php/system/tree/0.7.1" + "source": "https://github.com/utopia-php/system/tree/0.7.2" }, - "time": "2023-08-30T09:14:37+00:00" + "time": "2023-10-20T01:39:17+00:00" }, { "name": "utopia-php/vcs", @@ -5889,5 +5822,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.6.0" } From 17de0d1ea702cada2bb959c360a4f8dcd6270675 Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:55:46 +0530 Subject: [PATCH 47/57] Updated the error code for unsupported protocol --- app/config/errors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/errors.php b/app/config/errors.php index 78c633ee7..28fb69d11 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -86,7 +86,7 @@ return [ Exception::GENERAL_PROTOCOL_UNSUPPORTED => [ 'name' => Exception::GENERAL_PROTOCOL_UNSUPPORTED, 'description' => 'The request cannot be fulfilled with the current protocol. Please check the value of the _APP_OPTIONS_FORCE_HTTPS environment variable.', - 'code' => 500, + 'code' => 426, ], Exception::GENERAL_CODES_DISABLED => [ 'name' => Exception::GENERAL_CODES_DISABLED, From f9a3ae142187a8d1e11a7e11b41d1026b024d175 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 25 Oct 2023 13:35:14 +0200 Subject: [PATCH 48/57] chore: bump console version --- .gitmodules | 2 +- app/console | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 754fa9f80..6570e2a62 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "app/console"] path = app/console url = https://github.com/appwrite/console - branch = 3.2.3 + branch = 3.2.4 diff --git a/app/console b/app/console index e96573898..fe835e503 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit e9657389879c8d76a9b3a0d3486c1d86f43c3bb9 +Subproject commit fe835e50328ed80f67c66d2d449c0f7b51ade544 From 404ad8653d9a152e666d5ce2b2c3bc7a407693f1 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 25 Oct 2023 19:23:55 +0200 Subject: [PATCH 49/57] fix: worker permissions reset --- app/worker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/worker.php b/app/worker.php index 8aa52ab93..f1f19e3cc 100644 --- a/app/worker.php +++ b/app/worker.php @@ -33,7 +33,7 @@ use Utopia\Logger\Logger; use Utopia\Pools\Group; use Utopia\Queue\Connection; -Authorization::disable(); +Authorization::setDefaultStatus(false); Runtime::enableCoroutine(SWOOLE_HOOK_ALL); From 191235ecaf0d130b8cbda1f155c5e525597400ed Mon Sep 17 00:00:00 2001 From: KRISH SONI <67964054+krishvsoni@users.noreply.github.com> Date: Wed, 25 Oct 2023 23:24:26 +0530 Subject: [PATCH 50/57] added docs url --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b4980d0e6..6503f6add 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ Table of Contents: ## Installation -Appwrite is designed to run in a containerized environment. Running your server is as easy as running one command from your terminal. You can either run Appwrite on your localhost using docker-compose or on any other container orchestration tool, such as Kubernetes, Docker Swarm, or Rancher. +Appwrite is designed to run in a containerized environment. Running your server is as easy as running one command from your terminal. You can either run Appwrite on your localhost using docker-compose or on any other container orchestration tool, such as [Kubernetes](https://kubernetes.io/docs/home/), [Docker Swarm](https://docs.docker.com/engine/swarm/), or [Rancher](https://rancher.com/docs/). The easiest way to start running your Appwrite server is by running our docker-compose file. Before running the installation command, make sure you have [Docker](https://www.docker.com/products/docker-desktop) installed on your machine: From 995c404f352ff40a9fbf89de3820b8ebc465482b Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 26 Oct 2023 21:24:30 +1300 Subject: [PATCH 51/57] Update db --- app/worker.php | 3 +-- composer.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/worker.php b/app/worker.php index f1f19e3cc..32a8b9804 100644 --- a/app/worker.php +++ b/app/worker.php @@ -33,10 +33,9 @@ use Utopia\Logger\Logger; use Utopia\Pools\Group; use Utopia\Queue\Connection; -Authorization::setDefaultStatus(false); +Authorization::disable(); Runtime::enableCoroutine(SWOOLE_HOOK_ALL); - Server::setResource('register', fn () => $register); Server::setResource('dbForConsole', function (Cache $cache, Registry $register) { diff --git a/composer.lock b/composer.lock index a9121a6dc..cb467be2d 100644 --- a/composer.lock +++ b/composer.lock @@ -1906,16 +1906,16 @@ }, { "name": "utopia-php/database", - "version": "0.44.3", + "version": "0.44.4", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "b2d403c25a77506e03db5736335b0cae52bcc18a" + "reference": "b0c3fd8ecfedc3646d7780f2d6b38955a66baf48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/b2d403c25a77506e03db5736335b0cae52bcc18a", - "reference": "b2d403c25a77506e03db5736335b0cae52bcc18a", + "url": "https://api.github.com/repos/utopia-php/database/zipball/b0c3fd8ecfedc3646d7780f2d6b38955a66baf48", + "reference": "b0c3fd8ecfedc3646d7780f2d6b38955a66baf48", "shasum": "" }, "require": { @@ -1956,9 +1956,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.44.3" + "source": "https://github.com/utopia-php/database/tree/0.44.4" }, - "time": "2023-10-24T10:13:48+00:00" + "time": "2023-10-26T07:08:12+00:00" }, { "name": "utopia-php/domains", From c3a80dcebc44fa4b39de5ac9427230672f82c2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 26 Oct 2023 16:50:35 +0200 Subject: [PATCH 52/57] Fix GraphQL function test --- tests/e2e/Services/GraphQL/Base.php | 11 +++++++++++ tests/e2e/Services/GraphQL/FunctionsClientTest.php | 6 +++++- tests/e2e/Services/GraphQL/FunctionsServerTest.php | 6 +++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/e2e/Services/GraphQL/Base.php b/tests/e2e/Services/GraphQL/Base.php index 3a4b88e2c..f705e8d77 100644 --- a/tests/e2e/Services/GraphQL/Base.php +++ b/tests/e2e/Services/GraphQL/Base.php @@ -2,6 +2,8 @@ namespace Tests\E2E\Services\GraphQL; +use Utopia\CLI\Console; + trait Base { // Databases @@ -1933,4 +1935,13 @@ trait Base throw new \InvalidArgumentException('Invalid query type'); } + + // Function-related methods + protected string $stdout = ''; + protected string $stderr = ''; + + protected function packageCode($folder) + { + Console::execute('cd ' . realpath(__DIR__ . "/../../../resources/functions") . "/$folder && tar --exclude code.tar.gz -czf code.tar.gz .", '', $this->stdout, $this->stderr); + } } diff --git a/tests/e2e/Services/GraphQL/FunctionsClientTest.php b/tests/e2e/Services/GraphQL/FunctionsClientTest.php index 363f7a0fb..3f0ee1966 100644 --- a/tests/e2e/Services/GraphQL/FunctionsClientTest.php +++ b/tests/e2e/Services/GraphQL/FunctionsClientTest.php @@ -82,7 +82,11 @@ class FunctionsClientTest extends Scope { $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::$CREATE_DEPLOYMENT); - $code = realpath(__DIR__ . '/../../../resources/functions') . "/php/code.tar.gz"; + + $folder = 'php'; + $code = realpath(__DIR__ . '/../../../resources/functions') . "/$folder/code.tar.gz"; + $this->packageCode($folder); + $gqlPayload = [ 'operations' => \json_encode([ 'query' => $query, diff --git a/tests/e2e/Services/GraphQL/FunctionsServerTest.php b/tests/e2e/Services/GraphQL/FunctionsServerTest.php index 49a8fd61f..25a671fa1 100644 --- a/tests/e2e/Services/GraphQL/FunctionsServerTest.php +++ b/tests/e2e/Services/GraphQL/FunctionsServerTest.php @@ -81,7 +81,11 @@ class FunctionsServerTest extends Scope { $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::$CREATE_DEPLOYMENT); - $code = realpath(__DIR__ . '/../../../resources/functions') . "/php/code.tar.gz"; + + $folder = 'php'; + $code = realpath(__DIR__ . '/../../../resources/functions') . "/$folder/code.tar.gz"; + $this->packageCode($folder); + $gqlPayload = [ 'operations' => \json_encode([ 'query' => $query, From a4c59b838a8c8357c978807465b54f8311aa795e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=B7=E5=8D=8E=20=E5=88=98?= Date: Thu, 26 Oct 2023 16:15:52 +0000 Subject: [PATCH 53/57] chore: remove commented files --- .github/workflows/tests.yml | 98 +++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d9d94e843..d68bef11d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,48 +14,34 @@ jobs: name: Setup & Build Appwrite Image runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: recursive + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - - name: Build Appwrite - uses: docker/build-push-action@v3 - with: - context: . - push: false - tags: ${{ env.IMAGE }} - load: true - cache-from: type=gha - cache-to: type=gha,mode=max - outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar - build-args: | - DEBUG=false - TESTING=true - VERSION=dev + - name: Build Appwrite + uses: docker/build-push-action@v3 + with: + context: . + push: false + tags: ${{ env.IMAGE }} + load: true + cache-from: type=gha + cache-to: type=gha,mode=max + outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar + build-args: | + DEBUG=false + TESTING=true + VERSION=dev - # - name: Pull Docker Images - # run: docker compose pull --ignore-pull-failures --ignore-buildable - - # - name: List Files and images - # run: | - # docker compose config --images | sort -u - # docker save $(docker compose config --images | sort -u) -o /tmp/allinone.tar - - - name: Cache Docker Image - uses: actions/cache@v3 - with: - key: ${{ env.IMAGE }}-${{ github.sha }} - path: /tmp/${{ env.IMAGE }}.tar - - # - name: Upload Docker Image - # uses: actions/upload-artifact@v3 - # with: - # name: ${{ env.IMAGE }} - # path: /tmp/${{ env.IMAGE }}.tar + - name: Cache Docker Image + uses: actions/cache@v3 + with: + key: ${{ env.IMAGE }}-${{ github.sha }} + path: /tmp/${{ env.IMAGE }}.tar unit_test: name: Unit Test @@ -65,16 +51,16 @@ jobs: steps: - name: checkout uses: actions/checkout@v2 - + - name: Load Cache uses: actions/cache@v3 with: key: ${{ env.IMAGE }}-${{ github.sha }} path: /tmp/${{ env.IMAGE }}.tar fail-on-cache-miss: true - + - name: Load and Start Appwrite - run: | + run: | docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d sleep 10 @@ -83,10 +69,10 @@ jobs: run: docker compose exec -T appwrite doctor - name: Environment Variables - run: docker compose exec -T appwrite vars + run: docker compose exec -T appwrite vars - name: Run Unit Tests - run: docker compose exec appwrite test /usr/src/code/tests/unit + run: docker compose exec appwrite test /usr/src/code/tests/unit e2e_test: name: E2E Test @@ -95,7 +81,23 @@ jobs: strategy: fail-fast: false matrix: - services: [Account,Avatars,Console,Databases,Functions,GraphQL,Health,Locale,Projects,Realtime,Storage,Teams,Users,Webhooks] + services: + [ + Account, + Avatars, + Console, + Databases, + Functions, + GraphQL, + Health, + Locale, + Projects, + Realtime, + Storage, + Teams, + Users, + Webhooks, + ] steps: - name: checkout @@ -109,14 +111,14 @@ jobs: fail-on-cache-miss: true - name: Load and Start Appwrite - run: | + run: | docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d sleep 10 - + - name: Run ${{matrix.services}} Tests run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug - name: Output build logs if: always() && ${{ matrix.services == 'GraphQL' }} - run: docker compose logs appwrite-worker-builds \ No newline at end of file + run: docker compose logs appwrite-worker-builds From 5d634384c8f6165a961378530909bd558350f200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=B7=E5=8D=8E=20=E5=88=98?= Date: Thu, 26 Oct 2023 16:24:14 +0000 Subject: [PATCH 54/57] chore: update CI --- .github/workflows/tests.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d68bef11d..1ed5b6c0a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,6 +6,7 @@ concurrency: env: IMAGE: appwrite-dev + CACHE_KEY: ${{ env.IMAGE }}-${{ github.sha }} on: [pull_request] @@ -40,7 +41,7 @@ jobs: - name: Cache Docker Image uses: actions/cache@v3 with: - key: ${{ env.IMAGE }}-${{ github.sha }} + key: ${{ env.CACHE_KEY }} path: /tmp/${{ env.IMAGE }}.tar unit_test: @@ -55,7 +56,7 @@ jobs: - name: Load Cache uses: actions/cache@v3 with: - key: ${{ env.IMAGE }}-${{ github.sha }} + key: ${{ env.CACHE_KEY }} path: /tmp/${{ env.IMAGE }}.tar fail-on-cache-miss: true @@ -101,12 +102,12 @@ jobs: steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Load Cache uses: actions/cache@v3 with: - key: ${{ env.IMAGE }}-${{ github.sha }} + key: ${{ env.CACHE_KEY }} path: /tmp/${{ env.IMAGE }}.tar fail-on-cache-miss: true @@ -117,8 +118,4 @@ jobs: sleep 10 - name: Run ${{matrix.services}} Tests - run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug - - - name: Output build logs - if: always() && ${{ matrix.services == 'GraphQL' }} - run: docker compose logs appwrite-worker-builds + run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file From c9c688c592246bc1f3f2ca38d65f476df3b0c151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=B7=E5=8D=8E=20=E5=88=98?= Date: Thu, 26 Oct 2023 16:26:13 +0000 Subject: [PATCH 55/57] chore: update CI --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1ed5b6c0a..7c6f85cb2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ concurrency: env: IMAGE: appwrite-dev - CACHE_KEY: ${{ env.IMAGE }}-${{ github.sha }} + CACHE_KEY: appwrite-dev-${{ github.sha }} on: [pull_request] @@ -82,7 +82,7 @@ jobs: strategy: fail-fast: false matrix: - services: + service: [ Account, Avatars, @@ -117,5 +117,5 @@ jobs: docker compose up -d sleep 10 - - name: Run ${{matrix.services}} Tests - run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug \ No newline at end of file + - name: Run ${{matrix.service}} Tests + run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.service}} --debug \ No newline at end of file From 09912592cf3ff959d4b6b32075603e87088ba456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=B7=E5=8D=8E=20=E5=88=98?= Date: Thu, 26 Oct 2023 16:27:57 +0000 Subject: [PATCH 56/57] chore: update CI --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7c6f85cb2..6db2cdbdd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,6 +15,8 @@ jobs: name: Setup & Build Appwrite Image runs-on: ubuntu-latest steps: + - name: Log + run: echo ${{ github.sha }} - name: Checkout repository uses: actions/checkout@v3 with: From c8788e2a131e66df4191425efc74416e10870b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=B7=E5=8D=8E=20=E5=88=98?= Date: Thu, 26 Oct 2023 16:43:50 +0000 Subject: [PATCH 57/57] chore: update CI --- .github/workflows/tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6db2cdbdd..ed9d7d1f1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ concurrency: env: IMAGE: appwrite-dev - CACHE_KEY: appwrite-dev-${{ github.sha }} + CACHE_KEY: appwrite-dev-${{ github.event.pull_request.head.sha }} on: [pull_request] @@ -15,8 +15,6 @@ jobs: name: Setup & Build Appwrite Image runs-on: ubuntu-latest steps: - - name: Log - run: echo ${{ github.sha }} - name: Checkout repository uses: actions/checkout@v3 with: