From ad10b80a718c5d29797e525700a7321f46c7374c Mon Sep 17 00:00:00 2001 From: faisalill Date: Thu, 3 Aug 2023 20:13:46 +0530 Subject: [PATCH 01/14] Add tests.yml --- .github/workflows/tests.yml | 21 +++++++++++++++++++++ composer.json | 1 + 2 files changed, 22 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..0a1d8b8 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,21 @@ +name: "Tests" + +on: [pull_request] +jobs: + lint: + name: Linter + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 + - name: Setup PHP Action + uses: shivammathur/setup-php@2.25.5 + with: + php-version: '8.0' + - name: Install Dependencies + run: composer install --ignore-platform-reqs + - name: Run Tests + run: composer test \ No newline at end of file diff --git a/composer.json b/composer.json index c6bb164..14fed7d 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "psr-4": {"Utopia\\Analytics\\": "src/Analytics"} }, "scripts": { + "test": "vendor/bin/phpunit --configuration phpunit.xml", "lint": "./vendor/bin/pint --test", "format": "./vendor/bin/pint" }, From fd267a9b582b4abf7baca5bcc897741bf5c3a789 Mon Sep 17 00:00:00 2001 From: faisalill Date: Fri, 4 Aug 2023 20:26:12 +0530 Subject: [PATCH 02/14] Clean Code --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0a1d8b8..9c2df59 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,15 +7,15 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Checkout uses: actions/checkout@v3 - with: - fetch-depth: 2 + - name: Setup PHP Action uses: shivammathur/setup-php@2.25.5 with: php-version: '8.0' - name: Install Dependencies run: composer install --ignore-platform-reqs + - name: Run Tests run: composer test \ No newline at end of file From 26edda82a10121f5d068acb9bf53727410812a8c Mon Sep 17 00:00:00 2001 From: faisalill Date: Fri, 4 Aug 2023 21:07:45 +0530 Subject: [PATCH 03/14] Fix Job name --- .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 9c2df59..0aff57c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,8 +2,8 @@ name: "Tests" on: [pull_request] jobs: - lint: - name: Linter + tests: + name: Tests runs-on: ubuntu-latest steps: From 5d9d587e1ffcda5419e4240ac7d75c78648b0b71 Mon Sep 17 00:00:00 2001 From: faisalill Date: Fri, 4 Aug 2023 21:08:09 +0530 Subject: [PATCH 04/14] Remove travis.yml --- .travis.yml | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2d973a3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: php - -php: -- 8.0 - -notifications: - email: - - team@appwrite.io - -before_script: composer install --ignore-platform-reqs - -script: -- vendor/bin/phpunit --configuration phpunit.xml \ No newline at end of file From 52a014324174f84caf6dc9595f9b2bf8249c719f Mon Sep 17 00:00:00 2001 From: faisalill Date: Fri, 4 Aug 2023 21:54:13 +0530 Subject: [PATCH 05/14] Add Setup ENVS step in github actions --- .github/workflows/tests.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0aff57c..84eedf7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,6 +16,20 @@ jobs: php-version: '8.0' - name: Install Dependencies run: composer install --ignore-platform-reqs + + - name: Setup Environment Variables + run: | + export GA_TID= ${{ secrets.GA_TID }}} + export GA_CID= ${{ secrets.GA_CID }}} + export OR_WORKSPACEID= ${{ secrets.OR_WORKSPACEID }}} + export OR_APIKEY= ${{ secrets.OR_APIKEY }}} + export PA_APIKEY= ${{ secrets.PA_APIKEY }} + export PA_DOMAIN= ${{ secrets.PA_DOMAIN }} + export AC_ORGID= ${{ secrets.AC_ORGID }} + export AC_APIKEY= ${{ secrets.AC_APIKEY }} + export AC_KEY= ${{ secrets.AC_KEY }} + export AC_ACTID= ${{ secrets.AC_ACTID }} + export MP_PROJECT_TOKEN= ${{ secrets.MP_PROJECT_TOKEN }} - name: Run Tests run: composer test \ No newline at end of file From 81a6f4ea0e753f507dffef9bb099be63c65c1eb5 Mon Sep 17 00:00:00 2001 From: faisalill Date: Fri, 4 Aug 2023 22:37:11 +0530 Subject: [PATCH 06/14] Clean Code --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 84eedf7..4cd9212 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,6 +14,7 @@ jobs: uses: shivammathur/setup-php@2.25.5 with: php-version: '8.0' + - name: Install Dependencies run: composer install --ignore-platform-reqs From 3defd75c04b614457ec83c1f3dd79f98a3a5e2ef Mon Sep 17 00:00:00 2001 From: faisalill Date: Sat, 12 Aug 2023 18:00:26 +0530 Subject: [PATCH 07/14] Fix Env Variables --- .github/workflows/tests.yml | 38 +++++++++++++++++-------------------- Dockerfile | 21 ++++++++++++++++++++ 2 files changed, 38 insertions(+), 21 deletions(-) create mode 100644 Dockerfile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4cd9212..786e822 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,27 +10,23 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Setup PHP Action - uses: shivammathur/setup-php@2.25.5 - with: - php-version: '8.0' - - - name: Install Dependencies - run: composer install --ignore-platform-reqs - - - name: Setup Environment Variables + - name: Setup Environment run: | - export GA_TID= ${{ secrets.GA_TID }}} - export GA_CID= ${{ secrets.GA_CID }}} - export OR_WORKSPACEID= ${{ secrets.OR_WORKSPACEID }}} - export OR_APIKEY= ${{ secrets.OR_APIKEY }}} - export PA_APIKEY= ${{ secrets.PA_APIKEY }} - export PA_DOMAIN= ${{ secrets.PA_DOMAIN }} - export AC_ORGID= ${{ secrets.AC_ORGID }} - export AC_APIKEY= ${{ secrets.AC_APIKEY }} - export AC_KEY= ${{ secrets.AC_KEY }} - export AC_ACTID= ${{ secrets.AC_ACTID }} - export MP_PROJECT_TOKEN= ${{ secrets.MP_PROJECT_TOKEN }} + docker build . -t php8-env + docker run -d --name tests + -e GA_TID=${{ secrets.GA_TID }} + -e GA_CID=${{ secrets.GA_CID }} + -e OR_WORKSPACEID=${{ secrets.OR_WORKSPACEID }} + -e OR_APIKEY=${{ secrets.OR_APIKEY }} + -e PA_APIKEY=${{ secrets.PA_APIKEY }} + -e PA_DOMAIN=${{ secrets.PA_DOMAIN }} + -e AC_ORGID=${{ secrets.AC_ORGID }} + -e AC_APIKEY=${{ secrets.AC_APIKEY }} + -e AC_KEY=${{ secrets.AC_KEY }} + -e AC_ACTID=${{ secrets.AC_ACTID }} + -e MP_PROJECT_TOKEN=${{ secrets.MP_PROJECT_TOKEN }} + php8-env - name: Run Tests - run: composer test \ No newline at end of file + run: | + docker exec tests composer test \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c3991ad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM php:8.0-cli-alpine + +WORKDIR /usr/src/app + +RUN apk update && apk add \ + zip \ + unzip + +# Install composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# Copy composer.json +COPY composer.json ./ + +# Install dependencies +RUN composer install --ignore-platform-reqs + +# Copy source code +COPY . . + +CMD [ "tail", "-f", "/dev/null" ] \ No newline at end of file From 2373d0418be90263296a0cab54829e6d4974d80d Mon Sep 17 00:00:00 2001 From: faisalill Date: Sat, 12 Aug 2023 18:03:19 +0530 Subject: [PATCH 08/14] Fix Setup Environment Step --- .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 786e822..bfe0a3a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,18 +13,18 @@ jobs: - name: Setup Environment run: | docker build . -t php8-env - docker run -d --name tests - -e GA_TID=${{ secrets.GA_TID }} - -e GA_CID=${{ secrets.GA_CID }} - -e OR_WORKSPACEID=${{ secrets.OR_WORKSPACEID }} - -e OR_APIKEY=${{ secrets.OR_APIKEY }} - -e PA_APIKEY=${{ secrets.PA_APIKEY }} - -e PA_DOMAIN=${{ secrets.PA_DOMAIN }} - -e AC_ORGID=${{ secrets.AC_ORGID }} - -e AC_APIKEY=${{ secrets.AC_APIKEY }} - -e AC_KEY=${{ secrets.AC_KEY }} - -e AC_ACTID=${{ secrets.AC_ACTID }} - -e MP_PROJECT_TOKEN=${{ secrets.MP_PROJECT_TOKEN }} + docker run -d --name tests \ + -e GA_TID=${{ secrets.GA_TID }} \ + -e GA_CID=${{ secrets.GA_CID }} \ + -e OR_WORKSPACEID=${{ secrets.OR_WORKSPACEID }} \ + -e OR_APIKEY=${{ secrets.OR_APIKEY }} \ + -e PA_APIKEY=${{ secrets.PA_APIKEY }} \ + -e PA_DOMAIN=${{ secrets.PA_DOMAIN }} \ + -e AC_ORGID=${{ secrets.AC_ORGID }} \ + -e AC_APIKEY=${{ secrets.AC_APIKEY }} \ + -e AC_KEY=${{ secrets.AC_KEY }} \ + -e AC_ACTID=${{ secrets.AC_ACTID }} \ + -e MP_PROJECT_TOKEN=${{ secrets.MP_PROJECT_TOKEN }} \ php8-env - name: Run Tests From d7ea7835256e676f301010e153595c941616a503 Mon Sep 17 00:00:00 2001 From: faisalill Date: Sat, 12 Aug 2023 18:07:48 +0530 Subject: [PATCH 09/14] Fix format --- .github/workflows/tests.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bfe0a3a..d917504 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,8 +13,7 @@ jobs: - name: Setup Environment run: | docker build . -t php8-env - docker run -d --name tests \ - -e GA_TID=${{ secrets.GA_TID }} \ + docker run -d -e GA_TID=${{ secrets.GA_TID }} \ -e GA_CID=${{ secrets.GA_CID }} \ -e OR_WORKSPACEID=${{ secrets.OR_WORKSPACEID }} \ -e OR_APIKEY=${{ secrets.OR_APIKEY }} \ @@ -25,7 +24,7 @@ jobs: -e AC_KEY=${{ secrets.AC_KEY }} \ -e AC_ACTID=${{ secrets.AC_ACTID }} \ -e MP_PROJECT_TOKEN=${{ secrets.MP_PROJECT_TOKEN }} \ - php8-env + --name tests php8-env - name: Run Tests run: | From e22b100723a72d3ac4ea1f7771284607e415add9 Mon Sep 17 00:00:00 2001 From: faisalill Date: Sat, 12 Aug 2023 19:57:56 +0530 Subject: [PATCH 10/14] Try different approach for tests --- .github/workflows/tests.yml | 41 ++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d917504..55c9ca6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,25 +7,28 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v3 - - - name: Setup Environment - run: | - docker build . -t php8-env - docker run -d -e GA_TID=${{ secrets.GA_TID }} \ - -e GA_CID=${{ secrets.GA_CID }} \ - -e OR_WORKSPACEID=${{ secrets.OR_WORKSPACEID }} \ - -e OR_APIKEY=${{ secrets.OR_APIKEY }} \ - -e PA_APIKEY=${{ secrets.PA_APIKEY }} \ - -e PA_DOMAIN=${{ secrets.PA_DOMAIN }} \ - -e AC_ORGID=${{ secrets.AC_ORGID }} \ - -e AC_APIKEY=${{ secrets.AC_APIKEY }} \ - -e AC_KEY=${{ secrets.AC_KEY }} \ - -e AC_ACTID=${{ secrets.AC_ACTID }} \ - -e MP_PROJECT_TOKEN=${{ secrets.MP_PROJECT_TOKEN }} \ - --name tests php8-env - + with: + fetch-depth: 2 + + - run: git checkout HEAD^2 + - name: Run Tests run: | - docker exec tests composer test \ No newline at end of file + docker run --rm + -e GA_TID=${{ secrets.GA_TID }} \ + -e GA_CID=${{ secrets.GA_CID }} \ + -e OR_WORKSPACEID=${{ secrets.OR_WORKSPACEID }} \ + -e OR_APIKEY=${{ secrets.OR_APIKEY }} \ + -e PA_APIKEY=${{ secrets.PA_APIKEY }} \ + -e PA_DOMAIN=${{ secrets.PA_DOMAIN }} \ + -e AC_ORGID=${{ secrets.AC_ORGID }} \ + -e AC_APIKEY=${{ secrets.AC_APIKEY }} \ + -e AC_KEY=${{ secrets.AC_KEY }} \ + -e AC_ACTID=${{ secrets.AC_ACTID }} \ + -e MP_PROJECT_TOKEN=${{ secrets.MP_PROJECT_TOKEN }} \ + -v $PWD:/app composer sh -c \ + "composer install --profile --ignore-platform-reqs && composer lint" + + \ No newline at end of file From c80b2fe8a41f243857f33f35e4430885b154e316 Mon Sep 17 00:00:00 2001 From: faisalill Date: Sat, 12 Aug 2023 20:01:10 +0530 Subject: [PATCH 11/14] Fix slash in Run Tests step --- .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 55c9ca6..3b51740 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: - name: Run Tests run: | - docker run --rm + docker run --rm \ -e GA_TID=${{ secrets.GA_TID }} \ -e GA_CID=${{ secrets.GA_CID }} \ -e OR_WORKSPACEID=${{ secrets.OR_WORKSPACEID }} \ @@ -29,6 +29,6 @@ jobs: -e AC_ACTID=${{ secrets.AC_ACTID }} \ -e MP_PROJECT_TOKEN=${{ secrets.MP_PROJECT_TOKEN }} \ -v $PWD:/app composer sh -c \ - "composer install --profile --ignore-platform-reqs && composer lint" + "composer install --profile --ignore-platform-reqs && composer test" \ No newline at end of file From 484a10b116b563df70ae7b9ee1cfc6c2020ab2d3 Mon Sep 17 00:00:00 2001 From: faisalill Date: Sat, 12 Aug 2023 20:02:41 +0530 Subject: [PATCH 12/14] Remove Dockerfile --- Dockerfile | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index c3991ad..0000000 --- a/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM php:8.0-cli-alpine - -WORKDIR /usr/src/app - -RUN apk update && apk add \ - zip \ - unzip - -# Install composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - -# Copy composer.json -COPY composer.json ./ - -# Install dependencies -RUN composer install --ignore-platform-reqs - -# Copy source code -COPY . . - -CMD [ "tail", "-f", "/dev/null" ] \ No newline at end of file From 7cc4f70cae4274058a2096b646c31b8fe3f6e0e1 Mon Sep 17 00:00:00 2001 From: faisalill Date: Tue, 15 Aug 2023 08:13:32 +0530 Subject: [PATCH 13/14] Add on push to github workflow tests --- .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 3b51740..540a4f2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,6 +1,6 @@ name: "Tests" -on: [pull_request] +on: [push, pull_request] jobs: tests: name: Tests From 8264923803dd0d13a89296bb87b01ff272a027c8 Mon Sep 17 00:00:00 2001 From: faisalill Date: Tue, 15 Aug 2023 08:18:59 +0530 Subject: [PATCH 14/14] Remove fetch depth --- .github/workflows/tests.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 540a4f2..aa8b6f8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,10 +9,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - run: git checkout HEAD^2 - name: Run Tests run: |