From 6918e45ab0d007e072669c86ce140ddfcbab2bcb Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Thu, 2 Nov 2023 13:24:45 -0400 Subject: [PATCH 01/19] Tests for PHP 8.2 --- .github/workflows/tests.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 970fc22de..d792dd183 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,11 +1,17 @@ name: "Tests" on: [pull_request] + jobs: tests: - name: Unit & E2E + name: Unit & E2E (PHP ${{ matrix.php_version }}) runs-on: ubuntu-latest + strategy: + matrix: + php_version: ['7.4', '8.0', '8.1'] + fail-fast: false # this makes sure all versions are tested even if one fails + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -23,18 +29,23 @@ jobs: with: context: . push: false - tags: database-dev + tags: database-dev-${{ matrix.php_version }} load: true cache-from: type=gha cache-to: type=gha,mode=max + # Assuming you have Dockerfiles named like Dockerfile-7.4, Dockerfile-8.0, etc. + # This step chooses the correct Dockerfile based on PHP version + - name: Choose Dockerfile + run: echo "DOCKERFILE=Dockerfile-${{ matrix.php_version }}" >> $GITHUB_ENV + - name: Start Databases run: | - docker compose up -d + docker compose -f $DOCKERFILE up -d sleep 10 - name: Run Tests run: docker compose exec -T tests vendor/bin/phpunit --configuration phpunit.xml - name: Check Coverage - run: docker compose exec -T tests vendor/bin/coverage-check tmp/clover.xml 90 \ No newline at end of file + run: docker compose exec -T tests vendor/bin/coverage-check tmp/clover.xml 90 From 4e6ff2efc8cd09c7c0e7c7377ca9ad85e5e47b65 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Thu, 2 Nov 2023 13:27:37 -0400 Subject: [PATCH 02/19] Update tests.yml --- .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 d792dd183..102aebd1e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - php_version: ['7.4', '8.0', '8.1'] + php_version: ['8.0', '8.1', '8.2'] fail-fast: false # this makes sure all versions are tested even if one fails steps: From d7a20c55465b44a2880895bccb1cf13ccefe3024 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Thu, 2 Nov 2023 13:29:04 -0400 Subject: [PATCH 03/19] Update linter.yml --- .github/workflows/linter.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 15853dbe0..944db634a 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,11 +1,17 @@ name: "Linter" on: [ pull_request ] + jobs: lint: - name: Linter + name: Linter (PHP ${{ matrix.php_version }}) runs-on: ubuntu-latest + strategy: + matrix: + php_version: ['7.4', '8.0', '8.1'] + fail-fast: false # this ensures all versions are tested even if one fails + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -16,5 +22,5 @@ jobs: - name: Run Linter run: | - docker run --rm -v $PWD:/app composer sh -c \ + docker run --rm -v $PWD:/app php:${{ matrix.php_version }}-cli sh -c \ "composer install --profile --ignore-platform-reqs && composer lint" From b10171d123f9e5063e01829061b5a6c4f446d665 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Thu, 2 Nov 2023 13:29:35 -0400 Subject: [PATCH 04/19] Update linter.yml --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 944db634a..5810eab51 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - php_version: ['7.4', '8.0', '8.1'] + php_version: ['8.0', '8.1', '8.2'] fail-fast: false # this ensures all versions are tested even if one fails steps: From 4f6ef015116975e1d3ab055b380514adf95320e4 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Thu, 2 Nov 2023 13:32:05 -0400 Subject: [PATCH 05/19] Update linter.yml --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 5810eab51..df4a92a75 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -22,5 +22,5 @@ jobs: - name: Run Linter run: | - docker run --rm -v $PWD:/app php:${{ matrix.php_version }}-cli sh -c \ + docker run --rm -v $PWD:/app php:${{ matrix.php_version }}-cli-alpine3.18 sh -c \ "composer install --profile --ignore-platform-reqs && composer lint" From e7f7e2f3d7b6f22aaf498c3a7f8a42d6dcdb2ec8 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Thu, 2 Nov 2023 13:33:54 -0400 Subject: [PATCH 06/19] Update linter.yml --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index df4a92a75..5810eab51 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -22,5 +22,5 @@ jobs: - name: Run Linter run: | - docker run --rm -v $PWD:/app php:${{ matrix.php_version }}-cli-alpine3.18 sh -c \ + docker run --rm -v $PWD:/app php:${{ matrix.php_version }}-cli sh -c \ "composer install --profile --ignore-platform-reqs && composer lint" From 9da13bca89c74932272076461cb0ac98aba674c1 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Thu, 2 Nov 2023 13:37:05 -0400 Subject: [PATCH 07/19] Update linter.yml --- .github/workflows/linter.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 5810eab51..09af535f8 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -4,23 +4,27 @@ on: [ pull_request ] jobs: lint: - name: Linter (PHP ${{ matrix.php_version }}) + name: Run Linter on PHP ${{ matrix.php }} runs-on: ubuntu-latest strategy: matrix: - php_version: ['8.0', '8.1', '8.2'] - fail-fast: false # this ensures all versions are tested even if one fails + php: ['8.0', '8.1', '8.2'] steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} - - run: git checkout HEAD^2 + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 - - name: Run Linter - run: | - docker run --rm -v $PWD:/app php:${{ matrix.php_version }}-cli sh -c \ - "composer install --profile --ignore-platform-reqs && composer lint" + - run: git checkout HEAD^2 + + - name: Install dependencies + run: composer update --ignore-platform-reqs --optimize-autoloader --no-plugins --no-scripts --prefer-dist + + - run: composer lint From 27f56e4b2be769c87153b28824a2d74de295c61f Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 13:42:03 -0400 Subject: [PATCH 08/19] Test --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 09af535f8..153c5300c 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - php: ['8.0', '8.1', '8.2'] + php: ['8.1', '8.2'] steps: - name: Setup PHP From 4bd532466becfceaefec7f300101990c3358027d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 13:47:41 -0400 Subject: [PATCH 09/19] Fixed PHP 8.2 syntax --- src/Database/Adapter/MariaDB.php | 2 +- src/Database/Query.php | 2 +- tests/Database/Base.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Database/Adapter/MariaDB.php b/src/Database/Adapter/MariaDB.php index 05d66ef60..583a68d5b 100644 --- a/src/Database/Adapter/MariaDB.php +++ b/src/Database/Adapter/MariaDB.php @@ -1439,7 +1439,7 @@ public function find(string $collection, array $queries = [], ?int $limit = 25, $orderType = $orderType === Database::ORDER_ASC ? Database::ORDER_DESC : Database::ORDER_ASC; } - $orders[] = "`${attribute}` ${orderType}"; + $orders[] = "`{$attribute}` {$orderType}"; } // Allow after pagination without any order diff --git a/src/Database/Query.php b/src/Database/Query.php index f2ed42416..38c6f96af 100644 --- a/src/Database/Query.php +++ b/src/Database/Query.php @@ -822,7 +822,7 @@ public static function parseQueries(array $queries): array try { $parsed[] = Query::parse($query); } catch (\Throwable $th) { - throw new QueryException("Invalid query: ${query}", previous: $th); + throw new QueryException("Invalid query: {$query}", previous: $th); } } diff --git a/tests/Database/Base.php b/tests/Database/Base.php index 31b0dc9df..4718297b0 100644 --- a/tests/Database/Base.php +++ b/tests/Database/Base.php @@ -4515,7 +4515,7 @@ public function testKeywords(): void $this->assertEquals('reservedKeyDocument', $documents[0]->getId()); $this->assertEquals('Reserved:' . $keyword, $documents[0]->getAttribute($keyword)); - $documents = $database->find($collectionName, [Query::equal($keyword, ["Reserved:${keyword}"])]); + $documents = $database->find($collectionName, [Query::equal($keyword, ["Reserved:{$keyword}"])]); $this->assertCount(1, $documents); $this->assertEquals('reservedKeyDocument', $documents[0]->getId()); From 5efee9258ead7c244e36eb89af73c676e222c150 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 13:54:00 -0400 Subject: [PATCH 10/19] Added multiple PHP images --- Dockerfile => Dockerfile8.0 | 0 Dockerfile8.1 | 93 +++++++++++++++++++++++++++++++++++++ Dockerfile8.2 | 93 +++++++++++++++++++++++++++++++++++++ 3 files changed, 186 insertions(+) rename Dockerfile => Dockerfile8.0 (100%) create mode 100755 Dockerfile8.1 create mode 100755 Dockerfile8.2 diff --git a/Dockerfile b/Dockerfile8.0 similarity index 100% rename from Dockerfile rename to Dockerfile8.0 diff --git a/Dockerfile8.1 b/Dockerfile8.1 new file mode 100755 index 000000000..688d66326 --- /dev/null +++ b/Dockerfile8.1 @@ -0,0 +1,93 @@ +FROM composer:2.0 as composer + +ARG TESTING=false +ENV TESTING=$TESTING + +WORKDIR /usr/local/src/ + +COPY composer.lock /usr/local/src/ +COPY composer.json /usr/local/src/ + +RUN composer install --ignore-platform-reqs --optimize-autoloader \ + --no-plugins --no-scripts --prefer-dist + +FROM php:8.1-cli-alpine as compile + +ENV PHP_REDIS_VERSION=5.3.4 \ + PHP_SWOOLE_VERSION=v4.8.0 \ + PHP_MONGO_VERSION=1.11.1 + +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN \ + apk update \ + && apk add --no-cache postgresql-libs postgresql-dev make automake autoconf gcc g++ git brotli-dev \ + && docker-php-ext-install opcache pgsql pdo_mysql pdo_pgsql \ + && apk del postgresql-dev \ + && rm -rf /var/cache/apk/* + +# Redis Extension +FROM compile AS redis +RUN \ + git clone --depth 1 --branch $PHP_REDIS_VERSION https://github.com/phpredis/phpredis.git \ + && cd phpredis \ + && phpize \ + && ./configure \ + && make && make install + +## Swoole Extension +FROM compile AS swoole +RUN \ + git clone --depth 1 --branch $PHP_SWOOLE_VERSION https://github.com/swoole/swoole-src.git \ + && cd swoole-src \ + && phpize \ + && ./configure --enable-http2 \ + && make && make install + +## MongoDB Extension +FROM compile AS mongodb +RUN \ + git clone --depth 1 --branch $PHP_MONGO_VERSION https://github.com/mongodb/mongo-php-driver.git \ + && cd mongo-php-driver \ + && git submodule update --init \ + && phpize \ + && ./configure \ + && make && make install + +## PCOV Extension +FROM compile AS pcov +RUN \ + git clone https://github.com/krakjoe/pcov.git \ + && cd pcov \ + && phpize \ + && ./configure --enable-pcov \ + && make && make install + +FROM compile as final + +LABEL maintainer="team@appwrite.io" + +WORKDIR /usr/src/code + +RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini +RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini +RUN echo extension=mongodb.so >> /usr/local/etc/php/conf.d/mongodb.ini +RUN echo extension=pcov.so >> /usr/local/etc/php/conf.d/pcov.ini + +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + +RUN echo "opcache.enable_cli=1" >> $PHP_INI_DIR/php.ini + +RUN echo "memory_limit=1024M" >> $PHP_INI_DIR/php.ini + +COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor +COPY --from=swoole /usr/local/lib/php/extensions/no-debug-non-zts-20210902/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20210902/ +COPY --from=redis /usr/local/lib/php/extensions/no-debug-non-zts-20210902/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20210902/ +COPY --from=mongodb /usr/local/lib/php/extensions/no-debug-non-zts-20210902/mongodb.so /usr/local/lib/php/extensions/no-debug-non-zts-20210902/ +COPY --from=pcov /usr/local/lib/php/extensions/no-debug-non-zts-20210902/pcov.so /usr/local/lib/php/extensions/no-debug-non-zts-20210902/ + +# Add Source Code +COPY ./bin /usr/src/code/bin +COPY ./src /usr/src/code/src + +CMD [ "tail", "-f", "/dev/null" ] diff --git a/Dockerfile8.2 b/Dockerfile8.2 new file mode 100755 index 000000000..3fa39f3f2 --- /dev/null +++ b/Dockerfile8.2 @@ -0,0 +1,93 @@ +FROM composer:2.0 as composer + +ARG TESTING=false +ENV TESTING=$TESTING + +WORKDIR /usr/local/src/ + +COPY composer.lock /usr/local/src/ +COPY composer.json /usr/local/src/ + +RUN composer install --ignore-platform-reqs --optimize-autoloader \ + --no-plugins --no-scripts --prefer-dist + +FROM php:8.1-cli-alpine as compile + +ENV PHP_REDIS_VERSION=5.3.4 \ + PHP_SWOOLE_VERSION=v4.8.0 \ + PHP_MONGO_VERSION=1.11.1 + +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN \ + apk update \ + && apk add --no-cache postgresql-libs postgresql-dev make automake autoconf gcc g++ git brotli-dev \ + && docker-php-ext-install opcache pgsql pdo_mysql pdo_pgsql \ + && apk del postgresql-dev \ + && rm -rf /var/cache/apk/* + +# Redis Extension +FROM compile AS redis +RUN \ + git clone --depth 1 --branch $PHP_REDIS_VERSION https://github.com/phpredis/phpredis.git \ + && cd phpredis \ + && phpize \ + && ./configure \ + && make && make install + +## Swoole Extension +FROM compile AS swoole +RUN \ + git clone --depth 1 --branch $PHP_SWOOLE_VERSION https://github.com/swoole/swoole-src.git \ + && cd swoole-src \ + && phpize \ + && ./configure --enable-http2 \ + && make && make install + +## MongoDB Extension +FROM compile AS mongodb +RUN \ + git clone --depth 1 --branch $PHP_MONGO_VERSION https://github.com/mongodb/mongo-php-driver.git \ + && cd mongo-php-driver \ + && git submodule update --init \ + && phpize \ + && ./configure \ + && make && make install + +## PCOV Extension +FROM compile AS pcov +RUN \ + git clone https://github.com/krakjoe/pcov.git \ + && cd pcov \ + && phpize \ + && ./configure --enable-pcov \ + && make && make install + +FROM compile as final + +LABEL maintainer="team@appwrite.io" + +WORKDIR /usr/src/code + +RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini +RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini +RUN echo extension=mongodb.so >> /usr/local/etc/php/conf.d/mongodb.ini +RUN echo extension=pcov.so >> /usr/local/etc/php/conf.d/pcov.ini + +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + +RUN echo "opcache.enable_cli=1" >> $PHP_INI_DIR/php.ini + +RUN echo "memory_limit=1024M" >> $PHP_INI_DIR/php.ini + +COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor +COPY --from=swoole /usr/local/lib/php/extensions/no-debug-non-zts-20220829/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20220829/ +COPY --from=redis /usr/local/lib/php/extensions/no-debug-non-zts-20220829/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20220829/ +COPY --from=mongodb /usr/local/lib/php/extensions/no-debug-non-zts-20220829/mongodb.so /usr/local/lib/php/extensions/no-debug-non-zts-20220829/ +COPY --from=pcov /usr/local/lib/php/extensions/no-debug-non-zts-20220829/pcov.so /usr/local/lib/php/extensions/no-debug-non-zts-20220829/ + +# Add Source Code +COPY ./bin /usr/src/code/bin +COPY ./src /usr/src/code/src + +CMD [ "tail", "-f", "/dev/null" ] From faf594e264fc9d180e2ab3928b3034611b7adcbf Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 13:56:18 -0400 Subject: [PATCH 11/19] Updated images --- Dockerfile8.0 => Dockerfile-8.0 | 0 Dockerfile8.1 => Dockerfile-8.1 | 0 Dockerfile8.2 => Dockerfile-8.2 | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename Dockerfile8.0 => Dockerfile-8.0 (100%) rename Dockerfile8.1 => Dockerfile-8.1 (100%) rename Dockerfile8.2 => Dockerfile-8.2 (98%) diff --git a/Dockerfile8.0 b/Dockerfile-8.0 similarity index 100% rename from Dockerfile8.0 rename to Dockerfile-8.0 diff --git a/Dockerfile8.1 b/Dockerfile-8.1 similarity index 100% rename from Dockerfile8.1 rename to Dockerfile-8.1 diff --git a/Dockerfile8.2 b/Dockerfile-8.2 similarity index 98% rename from Dockerfile8.2 rename to Dockerfile-8.2 index 3fa39f3f2..937fbe463 100755 --- a/Dockerfile8.2 +++ b/Dockerfile-8.2 @@ -11,7 +11,7 @@ COPY composer.json /usr/local/src/ RUN composer install --ignore-platform-reqs --optimize-autoloader \ --no-plugins --no-scripts --prefer-dist -FROM php:8.1-cli-alpine as compile +FROM php:8.2-cli-alpine as compile ENV PHP_REDIS_VERSION=5.3.4 \ PHP_SWOOLE_VERSION=v4.8.0 \ From 3ab1fde3c3b2be60eb47404ae17104b266605912 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 14:11:04 -0400 Subject: [PATCH 12/19] Test test --- .github/workflows/tests.yml | 27 +++++++++++-------------- docker-compose.yml | 39 ++++++++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 102aebd1e..762a06d11 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,17 +1,11 @@ name: "Tests" on: [pull_request] - jobs: tests: - name: Unit & E2E (PHP ${{ matrix.php_version }}) + name: Unit & E2E runs-on: ubuntu-latest - strategy: - matrix: - php_version: ['8.0', '8.1', '8.2'] - fail-fast: false # this makes sure all versions are tested even if one fails - steps: - name: Checkout repository uses: actions/checkout@v3 @@ -29,23 +23,24 @@ jobs: with: context: . push: false - tags: database-dev-${{ matrix.php_version }} + tags: database-dev load: true cache-from: type=gha cache-to: type=gha,mode=max - # Assuming you have Dockerfiles named like Dockerfile-7.4, Dockerfile-8.0, etc. - # This step chooses the correct Dockerfile based on PHP version - - name: Choose Dockerfile - run: echo "DOCKERFILE=Dockerfile-${{ matrix.php_version }}" >> $GITHUB_ENV - - name: Start Databases run: | - docker compose -f $DOCKERFILE up -d + docker compose up -d sleep 10 - - name: Run Tests - run: docker compose exec -T tests vendor/bin/phpunit --configuration phpunit.xml + - name: Run Tests (PHP 8.0) + run: docker compose exec -T tests80 vendor/bin/phpunit --configuration phpunit.xml + + - name: Run Tests (PHP 8.1) + run: docker compose exec -T tests81 vendor/bin/phpunit --configuration phpunit.xml + + - name: Run Tests (PHP 8.2) + run: docker compose exec -T tests82 vendor/bin/phpunit --configuration phpunit.xml - name: Check Coverage run: docker compose exec -T tests vendor/bin/coverage-check tmp/clover.xml 90 diff --git a/docker-compose.yml b/docker-compose.yml index 296cd6095..79c69e091 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,11 +2,44 @@ version: '3.1' services: - tests: - container_name: tests - image: database-dev + tests80: + container_name: tests80 + image: database-80 build: context: . + dockerfile: Dockerfile8.0 + networks: + - database + volumes: + - ./bin:/usr/src/code/bin + - ./src:/usr/src/code/src + - ./tests:/usr/src/code/tests + - ./phpunit.xml:/usr/src/code/phpunit.xml + ports: + - "8708:8708" + + tests81: + container_name: tests81 + image: database-81 + build: + context: . + dockerfile: Dockerfile8.1 + networks: + - database + volumes: + - ./bin:/usr/src/code/bin + - ./src:/usr/src/code/src + - ./tests:/usr/src/code/tests + - ./phpunit.xml:/usr/src/code/phpunit.xml + ports: + - "8708:8708" + + tests82: + container_name: tests82 + image: database-82 + build: + context: . + dockerfile: Dockerfile8.2 networks: - database volumes: From b20cac2b84ed144d346e075f85fd53373e49e1a3 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 14:57:53 -0400 Subject: [PATCH 13/19] Fix for tests --- .github/workflows/tests.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 762a06d11..b5e40ed67 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,12 +18,35 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Build image + - name: Build image (8.0) uses: docker/build-push-action@v3 with: context: . push: false - tags: database-dev + dockerfile: Dockerfile-8.0 + tags: database-80 + load: true + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build image (8.1) + uses: docker/build-push-action@v3 + with: + context: . + dockerfile: Dockerfile-8.1 + push: false + tags: database-81 + load: true + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build image (8.2) + uses: docker/build-push-action@v3 + with: + context: . + dockerfile: Dockerfile-8.2 + push: false + tags: database-82 load: true cache-from: type=gha cache-to: type=gha,mode=max From 1773a5e58d7d5ab24bf58150e4f8b636be6c1a9e Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 14:59:04 -0400 Subject: [PATCH 14/19] Fix for tests --- .github/workflows/tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b5e40ed67..fb70cd661 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,7 +23,6 @@ jobs: with: context: . push: false - dockerfile: Dockerfile-8.0 tags: database-80 load: true cache-from: type=gha @@ -33,7 +32,6 @@ jobs: uses: docker/build-push-action@v3 with: context: . - dockerfile: Dockerfile-8.1 push: false tags: database-81 load: true @@ -44,7 +42,6 @@ jobs: uses: docker/build-push-action@v3 with: context: . - dockerfile: Dockerfile-8.2 push: false tags: database-82 load: true From 0f8e00e9a5c1a8d5ed703c4389d6381480065cc8 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 15:02:19 -0400 Subject: [PATCH 15/19] Fix for tests --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fb70cd661..de90b1bb6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,6 +22,7 @@ jobs: uses: docker/build-push-action@v3 with: context: . + file: ./Dockerfile.8.0 push: false tags: database-80 load: true @@ -32,6 +33,7 @@ jobs: uses: docker/build-push-action@v3 with: context: . + file: ./Dockerfile.8.1 push: false tags: database-81 load: true @@ -42,6 +44,7 @@ jobs: uses: docker/build-push-action@v3 with: context: . + file: ./Dockerfile.8.2 push: false tags: database-82 load: true From 37daf2fbba2d46f05835da0f20c9f22f131d7540 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 15:05:06 -0400 Subject: [PATCH 16/19] Fix for tests --- .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 de90b1bb6..5f12abcb4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,7 +22,7 @@ jobs: uses: docker/build-push-action@v3 with: context: . - file: ./Dockerfile.8.0 + file: ./Dockerfile-8.0 push: false tags: database-80 load: true @@ -33,7 +33,7 @@ jobs: uses: docker/build-push-action@v3 with: context: . - file: ./Dockerfile.8.1 + file: ./Dockerfile-8.1 push: false tags: database-81 load: true @@ -44,7 +44,7 @@ jobs: uses: docker/build-push-action@v3 with: context: . - file: ./Dockerfile.8.2 + file: ./Dockerfile-8.2 push: false tags: database-82 load: true From e0cc5cee27eda7872da5dfd7649c8942b593143f Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 15:17:15 -0400 Subject: [PATCH 17/19] Fixed 8.2 image --- Dockerfile-8.2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile-8.2 b/Dockerfile-8.2 index 937fbe463..1b3e4b30f 100755 --- a/Dockerfile-8.2 +++ b/Dockerfile-8.2 @@ -11,7 +11,7 @@ COPY composer.json /usr/local/src/ RUN composer install --ignore-platform-reqs --optimize-autoloader \ --no-plugins --no-scripts --prefer-dist -FROM php:8.2-cli-alpine as compile +FROM php:8.2-cli-alpine3.18 as compile ENV PHP_REDIS_VERSION=5.3.4 \ PHP_SWOOLE_VERSION=v4.8.0 \ @@ -21,6 +21,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN \ apk update \ + linux-headers \ && apk add --no-cache postgresql-libs postgresql-dev make automake autoconf gcc g++ git brotli-dev \ && docker-php-ext-install opcache pgsql pdo_mysql pdo_pgsql \ && apk del postgresql-dev \ From 7f8974149836388dd080dc568525537a93bed8bc Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 15:20:04 -0400 Subject: [PATCH 18/19] Multiple job files --- .github/workflows/test80.yml | 38 ++++++++++++++++++++ .github/workflows/test81.yml | 38 ++++++++++++++++++++ .github/workflows/test82.yml | 38 ++++++++++++++++++++ .github/workflows/tests.yml | 69 ------------------------------------ 4 files changed, 114 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/test80.yml create mode 100644 .github/workflows/test81.yml create mode 100644 .github/workflows/test82.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/test80.yml b/.github/workflows/test80.yml new file mode 100644 index 000000000..22d1a4353 --- /dev/null +++ b/.github/workflows/test80.yml @@ -0,0 +1,38 @@ +name: "Tests" + +on: [pull_request] +jobs: + test: + name: Unit & E2E (PHP 8.0) + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 + submodules: recursive + + - run: git checkout HEAD^2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build image + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile-8.0 + push: false + tags: database-80 + load: true + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Start Databases + run: | + docker compose up -d + sleep 10 + + - name: Run Tests + run: docker compose exec -T tests80 vendor/bin/phpunit --configuration phpunit.xml \ No newline at end of file diff --git a/.github/workflows/test81.yml b/.github/workflows/test81.yml new file mode 100644 index 000000000..527ddd2d0 --- /dev/null +++ b/.github/workflows/test81.yml @@ -0,0 +1,38 @@ +name: "Tests" + +on: [pull_request] +jobs: + test: + name: Unit & E2E (PHP 8.1) + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 + submodules: recursive + + - run: git checkout HEAD^2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build image + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile-8.1 + push: false + tags: database-81 + load: true + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Start Databases + run: | + docker compose up -d + sleep 10 + + - name: Run Tests + run: docker compose exec -T tests81 vendor/bin/phpunit --configuration phpunit.xml \ No newline at end of file diff --git a/.github/workflows/test82.yml b/.github/workflows/test82.yml new file mode 100644 index 000000000..a19baf58a --- /dev/null +++ b/.github/workflows/test82.yml @@ -0,0 +1,38 @@ +name: "Tests" + +on: [pull_request] +jobs: + test: + name: Unit & E2E (PHP 8.2) + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 + submodules: recursive + + - run: git checkout HEAD^2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build image + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile-8.2 + push: false + tags: database-82 + load: true + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Start Databases + run: | + docker compose up -d + sleep 10 + + - name: Run Tests + run: docker compose exec -T tests82 vendor/bin/phpunit --configuration phpunit.xml \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 5f12abcb4..000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: "Tests" - -on: [pull_request] -jobs: - tests: - name: Unit & E2E - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 2 - submodules: recursive - - - run: git checkout HEAD^2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Build image (8.0) - uses: docker/build-push-action@v3 - with: - context: . - file: ./Dockerfile-8.0 - push: false - tags: database-80 - load: true - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Build image (8.1) - uses: docker/build-push-action@v3 - with: - context: . - file: ./Dockerfile-8.1 - push: false - tags: database-81 - load: true - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Build image (8.2) - uses: docker/build-push-action@v3 - with: - context: . - file: ./Dockerfile-8.2 - push: false - tags: database-82 - load: true - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Start Databases - run: | - docker compose up -d - sleep 10 - - - name: Run Tests (PHP 8.0) - run: docker compose exec -T tests80 vendor/bin/phpunit --configuration phpunit.xml - - - name: Run Tests (PHP 8.1) - run: docker compose exec -T tests81 vendor/bin/phpunit --configuration phpunit.xml - - - name: Run Tests (PHP 8.2) - run: docker compose exec -T tests82 vendor/bin/phpunit --configuration phpunit.xml - - - name: Check Coverage - run: docker compose exec -T tests vendor/bin/coverage-check tmp/clover.xml 90 From 18222f0e83f7cbe7576bb69b76dd88dfb228fd3d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 2 Nov 2023 15:33:52 -0400 Subject: [PATCH 19/19] Fixed docker-compose file --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 79c69e091..b8ca091f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: image: database-80 build: context: . - dockerfile: Dockerfile8.0 + dockerfile: Dockerfile-8.0 networks: - database volumes: @@ -23,7 +23,7 @@ services: image: database-81 build: context: . - dockerfile: Dockerfile8.1 + dockerfile: Dockerfile-8.1 networks: - database volumes: @@ -39,7 +39,7 @@ services: image: database-82 build: context: . - dockerfile: Dockerfile8.2 + dockerfile: Dockerfile-8.2 networks: - database volumes: