diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6a27f9b..ac990f0 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,35 +1,62 @@ name: tests -on: [ push, pull_request ] +on: + - push + - pull_request jobs: - build: + test: runs-on: ubuntu-latest + + strategy: + #fail-fast: true + matrix: + php: [8.0, 8.1, 8.2, 8.3] + laravel: ['9.*', '10.*', '11.*'] + dependency-version: [prefer-lowest, prefer-stable] + exclude: + - laravel: 9.* + php: 8.2 + - laravel: 9.* + php: 8.3 + - laravel: 10.* + php: 8.0 + - laravel: 11.* + php: 8.0 + - laravel: 11.* + php: 8.1 + include: + - laravel: 9.* + testbench: 7.* + - laravel: 10.* + testbench: 8.* + - laravel: 11.* + testbench: 9.* + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} + steps: - - name: Make chown - run: sudo chown -R $USER:$USER ${{ github.workspace }} - - uses: actions/checkout@v2 - - name: Docker compose up - run: docker-compose up -d - - name: Validate composer.json and composer.lock - run: composer validate - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - uses: actions/cache@v2 + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v2 with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- + path: ~/.composer/cache/files + key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis, memcached + tools: composer:v2 + coverage: none + - name: Install dependencies - if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer install --prefer-dist --no-progress --no-suggest - - name: Run test suite - run: vendor/bin/phpunit --coverage-clover coverage.xml -# - uses: codecov/codecov-action@v1 -# with: -# file: ./coverage.xml -# flags: unittests -# fail_ci_if_error: true + run: | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction + + - name: Execute tests + run: vendor/bin/phpunit --testdox diff --git a/composer.json b/composer.json index 6235501..9388d4d 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "illuminate/contracts": "^8.0|^9.0|^10.1.3|^11.0", "illuminate/filesystem": "^8.0|^9.0|^10.1.3|^11.0", "illuminate/support": "^8.0|^9.0|^10.1.3|^11.0", - "smi2/phpclickhouse": "^1.4" + "smi2/phpclickhouse": "^1.5.3" }, "require-dev": { "orchestra/testbench": "^7.0|^8.0|^9.0", @@ -61,5 +61,5 @@ "sort-packages": true }, "minimum-stability": "dev", - "prefer-stable" : true + "prefer-stable": true } diff --git a/tests/Factory/ClickhouseClientFactoryTest.php b/tests/Factory/ClickhouseClientFactoryTest.php index 2e044a9..33313f4 100644 --- a/tests/Factory/ClickhouseClientFactoryTest.php +++ b/tests/Factory/ClickhouseClientFactoryTest.php @@ -25,7 +25,7 @@ public function testInitializationWithMainConfig(): void $clickhouse = new ClickhouseClientFactory( [ 'host' => 'example.com', - 'port' => 9000, + 'port' => '9000', 'username' => 'test_user', 'password' => 'secret', 'options' => [ @@ -39,12 +39,12 @@ public function testInitializationWithMainConfig(): void $client = $clickhouse->create(); self::assertSame('example.com', $client->getConnectHost()); - self::assertSame(9000, $client->getConnectPort()); + self::assertSame('9000', $client->getConnectPort()); self::assertSame('test_user', $client->getConnectUsername()); self::assertSame('secret', $client->getConnectPassword()); self::assertSame('test_database', $client->settings()->getDatabase()); - self::assertSame(150.0, $client->getTimeout()); - self::assertSame(151, $client->getConnectTimeOut()); + self::assertSame(150, $client->getTimeout()); + self::assertSame(151.0, $client->getConnectTimeOut()); } public function testInitializationWithNonExistsOption(): void @@ -52,7 +52,7 @@ public function testInitializationWithNonExistsOption(): void $clickhouseFactory = new ClickhouseClientFactory( [ 'host' => 'example.com', - 'port' => 9000, + 'port' => '9000', 'username' => 'test_user', 'password' => 'secret', 'options' => [