Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub workflow #7

Merged
merged 9 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 54 additions & 27 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -61,5 +61,5 @@
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable" : true
"prefer-stable": true
}
10 changes: 5 additions & 5 deletions tests/Factory/ClickhouseClientFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testInitializationWithMainConfig(): void
$clickhouse = new ClickhouseClientFactory(
[
'host' => 'example.com',
'port' => 9000,
'port' => '9000',
'username' => 'test_user',
'password' => 'secret',
'options' => [
Expand All @@ -39,20 +39,20 @@ 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
{
$clickhouseFactory = new ClickhouseClientFactory(
[
'host' => 'example.com',
'port' => 9000,
'port' => '9000',
'username' => 'test_user',
'password' => 'secret',
'options' => [
Expand Down
Loading