From e8eca0c65d7e02f2bed5cdcc45911482be85ea3c Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Fri, 29 Sep 2023 11:56:17 -0300 Subject: [PATCH 1/7] Raise min version to `PHP 7.3`, check compatibility `PHP 8.3`. --- .github/workflows/build.yml | 153 +++++++++++++----------- composer.json | 12 +- tests/ActiveDataProviderTest.php | 2 +- tests/ActiveFixtureTest.php | 2 +- tests/ActiveQueryTest.php | 6 +- tests/ActiveRecordTest.php | 10 +- tests/ActiveRelationTest.php | 2 +- tests/BatchQueryResultTest.php | 4 +- tests/CommandTest.php | 10 +- tests/ExternalActiveRelationTest.php | 2 +- tests/QueryTest.php | 22 ++-- tests/TestCase.php | 6 +- tests/bootstrap.php | 2 - tests/compatibility.php | 32 ----- tests/data/actions/sphinx-setup.sh | 8 ++ tests/data/fixture/MySphinxTestCase.php | 6 +- tests/data/travis/README.md | 8 -- tests/data/travis/sphinx-setup.sh | 20 ---- 18 files changed, 139 insertions(+), 168 deletions(-) delete mode 100644 tests/compatibility.php delete mode 100644 tests/data/travis/README.md delete mode 100755 tests/data/travis/sphinx-setup.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73f47542d..b91829788 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,77 +1,86 @@ on: - - pull_request - - push + pull_request: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'psalm.xml' + + push: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'psalm.xml' name: build jobs: - tests: - name: PHP ${{ matrix.php }}-${{ matrix.os }} - - env: - extensions: pdo, pdo_mysql - key: cache-v1 - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-18.04 - - php: - - "5.4" - - "5.5" - - "5.6" - - "7.0" - - "7.1" - - "7.2" - - "7.3" - - "7.4" - - steps: - - name: Checkout - uses: actions/checkout@v2.3.4 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: ${{ env.extensions }} - ini-values: date.timezone='UTC' - coverage: pcov - tools: composer:v2 - - - name: Update composer - run: composer self-update - - - name: Install dependencies with composer php < 8.0 - if: matrix.php != '8.0' - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Install dependencies with composer php 8.0 - if: matrix.php == '8.0' - run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Setup source database - run: | - sudo /etc/init.d/mysql start - mysql -uroot -proot -e 'CREATE DATABASE `yiitest`;' - mysql -D yiitest -uroot -proot < tests/data/source.sql - - - name: Install sphinx - run: cd tests/data/actions && sh sphinx-setup.sh - - - name: Run tests with phpunit - if: matrix.php != '7.4' - run: vendor/bin/phpunit --colors=always - - - name: Run tests with phpunit - if: matrix.php == '7.4' - run: vendor/bin/phpunit --coverage-clover=clover.xml --colors=always - - - name: Upload code coverage scrutinizer - if: matrix.php == '7.4' - run: | - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover coverage.clover + tests: + name: PHP ${{ matrix.php }}-${{ matrix.os }} + + env: + extensions: pdo, pdo_mysql + key: cache-v1 + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: + - ubuntu-latest + + php: + - 7.4 + - 8.0 + - 8.1 + - 8.2 + - 8.3 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ${{ env.extensions }} + ini-values: date.timezone='UTC' + coverage: pcov + tools: composer:v2 + + - name: Update composer + run: composer self-update + + - name: Install dependencies with composer. + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + + - name: Setup source database + run: | + sudo /etc/init.d/mysql start + mysql -uroot -proot -e 'CREATE DATABASE `yiitest`;' + mysql -D yiitest -uroot -proot < tests/data/source.sql + + - name: Install sphinx + run: cd tests/data/actions && sh sphinx-setup.sh + + - name: Run tests with phpunit + if: matrix.php != '8.1' + run: vendor/bin/phpunit --colors=always + + - name: Run tests with phpunit + if: matrix.php == '8.1' + run: vendor/bin/phpunit --coverage-clover=coverage.xml--colors=always + + - name: Upload coverage to Codecov. + if: matrix.os == 'ubuntu-latest' + uses: codecov/codecov-action@v3 + with: + files: ./coverage.xml diff --git a/composer.json b/composer.json index 447f29a8e..a26eeb141 100644 --- a/composer.json +++ b/composer.json @@ -18,12 +18,13 @@ } ], "require": { - "yiisoft/yii2": "~2.0.13", + "php": ">=7.3", "ext-pdo": "*", - "ext-pdo_mysql": "*" + "ext-pdo_mysql": "*", + "yiisoft/yii2": "~2.0.13" }, "require-dev": { - "phpunit/phpunit": "4.8.27|~5.7.21|^6.2" + "phpunit/phpunit": "^9.6" }, "repositories": [ { @@ -38,5 +39,10 @@ "branch-alias": { "dev-master": "2.0.x-dev" } + }, + "config": { + "allow-plugins": { + "yiisoft/yii2-composer": true + } } } diff --git a/tests/ActiveDataProviderTest.php b/tests/ActiveDataProviderTest.php index 75c4efac8..9a0c7cec9 100644 --- a/tests/ActiveDataProviderTest.php +++ b/tests/ActiveDataProviderTest.php @@ -14,7 +14,7 @@ */ class ActiveDataProviderTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); diff --git a/tests/ActiveFixtureTest.php b/tests/ActiveFixtureTest.php index db88cc148..10ed7e310 100644 --- a/tests/ActiveFixtureTest.php +++ b/tests/ActiveFixtureTest.php @@ -11,7 +11,7 @@ class ActiveFixtureTest extends TestCase { - public function setUp() + protected function setUp(): void { parent::setUp(); \Yii::$app->set('sphinx', $this->getConnection()); diff --git a/tests/ActiveQueryTest.php b/tests/ActiveQueryTest.php index ceefe821d..350658d32 100644 --- a/tests/ActiveQueryTest.php +++ b/tests/ActiveQueryTest.php @@ -10,7 +10,7 @@ */ class ActiveQueryTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); @@ -31,10 +31,10 @@ public function testFacet() $this->assertTrue($results['hits'][0] instanceof ArticleIndex, 'Unable to populate results as AR object'); } - public function testIndexBy() + public function testIndexBy() { $results = ArticleIndex::find()->indexBy('id')->all(); - $result = reset($results); + $result = reset($results); $this->assertTrue($result->id == key($results), 'Unable to index results by column'); } } diff --git a/tests/ActiveRecordTest.php b/tests/ActiveRecordTest.php index a6075f6a2..6dac96a1c 100644 --- a/tests/ActiveRecordTest.php +++ b/tests/ActiveRecordTest.php @@ -12,13 +12,13 @@ */ class ActiveRecordTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); } - protected function tearDown() + protected function tearDown(): void { $this->truncateIndex('yii2_test_rt_index'); parent::tearDown(); @@ -262,11 +262,11 @@ public function testCallSnippets() $snippet = ArticleIndex::callSnippets($source, $query); $this->assertNotEmpty($snippet, 'Unable to call snippets!'); - $this->assertContains('' . $query . '', $snippet, 'Query not present in the snippet!'); + $this->assertStringContainsString('' . $query . '', $snippet, 'Query not present in the snippet!'); $rows = ArticleIndex::callSnippets([$source], $query); $this->assertNotEmpty($rows, 'Unable to call snippets!'); - $this->assertContains('' . $query . '', $rows[0], 'Query not present in the snippet!'); + $this->assertStringContainsString('' . $query . '', $rows[0], 'Query not present in the snippet!'); } public function testCallKeywords() @@ -371,4 +371,4 @@ public function testEmulateExecution() ->search(); $this->assertSame(['hits' => [], 'facets' => [], 'meta' => []], $rows); } -} \ No newline at end of file +} diff --git a/tests/ActiveRelationTest.php b/tests/ActiveRelationTest.php index 11b89d41d..03b2ca4e2 100644 --- a/tests/ActiveRelationTest.php +++ b/tests/ActiveRelationTest.php @@ -12,7 +12,7 @@ */ class ActiveRelationTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); diff --git a/tests/BatchQueryResultTest.php b/tests/BatchQueryResultTest.php index a637ce841..443648ebf 100644 --- a/tests/BatchQueryResultTest.php +++ b/tests/BatchQueryResultTest.php @@ -10,7 +10,7 @@ class BatchQueryResultTest extends TestCase { - public function setUp() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); @@ -154,4 +154,4 @@ public function testActiveQuery() $this->assertCount(2, $allModels[1]->tags); $this->assertCount(0, $allModels[2]->tags); } -} \ No newline at end of file +} diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 7b892e33e..aa2f4e058 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -9,7 +9,7 @@ */ class CommandTest extends TestCase { - protected function tearDown() + protected function tearDown(): void { $this->truncateIndex('yii2_test_rt_index'); parent::tearDown(); @@ -373,7 +373,7 @@ public function testCallSnippets() $rows = $db->createCommand()->callSnippets('yii2_test_item_index', $source, $query)->queryColumn(); $this->assertNotEmpty($rows, 'Unable to call snippets!'); - $this->assertContains('' . $query . '', $rows[0], 'Query not present in the snippet!'); + $this->assertStringContainsString('' . $query . '', $rows[0], 'Query not present in the snippet!'); $rows = $db->createCommand()->callSnippets('yii2_test_item_index', [$source], $query)->queryColumn(); $this->assertNotEmpty($rows, 'Unable to call snippets for array source!'); @@ -384,7 +384,11 @@ public function testCallSnippets() 'limit' => 20, ]; $snippet = $db->createCommand()->callSnippets('yii2_test_item_index', $source, $query, $options)->queryScalar(); - $this->assertContains($options['before_match'] . $query . $options['after_match'], $snippet, 'Unable to apply options!'); + $this->assertStringContainsString( + $options['before_match'] . $query . $options['after_match'], + $snippet, + 'Unable to apply options!', + ); } /** diff --git a/tests/ExternalActiveRelationTest.php b/tests/ExternalActiveRelationTest.php index d56b61f63..1793d2c13 100644 --- a/tests/ExternalActiveRelationTest.php +++ b/tests/ExternalActiveRelationTest.php @@ -16,7 +16,7 @@ class ExternalActiveRelationTest extends TestCase /** * {@inheritdoc} */ - protected function setUp() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); diff --git a/tests/QueryTest.php b/tests/QueryTest.php index 2ff9b16dc..1786d1cfe 100644 --- a/tests/QueryTest.php +++ b/tests/QueryTest.php @@ -18,8 +18,8 @@ public function testSelect() $query = new Query(); $query->select('*'); $this->assertEquals(['*' => '*'], $query->select); - $this->assertNull($query->distinct); - $this->assertEquals(null, $query->selectOption); + $this->assertFalse($query->distinct); + $this->assertNull($query->selectOption); $query = new Query(); $query->select('id, name', 'something')->distinct(true); @@ -43,7 +43,7 @@ public function testMatch() $this->assertEquals($match, $query->match); $command = $query->createCommand($this->getConnection(false)); - $this->assertContains('MATCH(', $command->getSql(), 'No MATCH operator present!'); + $this->assertStringContainsString('MATCH(', $command->getSql(), 'No MATCH operator present!'); $this->assertContains($match, $command->params, 'No match query among params!'); } @@ -73,7 +73,7 @@ public function testWhereExpression() $query->where($expression); $command = $query->createCommand($this->getConnection(false)); - $this->assertContains($expression->expression, $command->getSql()); + $this->assertStringContainsString($expression->expression, $command->getSql()); $this->assertEquals($expression->params, $command->params); } @@ -271,8 +271,11 @@ public function testSnippet() ->all($connection); $this->assertNotEmpty($rows); foreach ($rows as $row) { - $this->assertContains($snippetPrefix, $row['snippet'], 'Snippet source not present!'); - $this->assertContains($snippetOptions['before_match'] . $match, $row['snippet'] . $snippetOptions['after_match'], 'Options not applied!'); + $this->assertStringContainsString($snippetPrefix, $row['snippet'], 'Snippet source not present!'); + $this->assertStringContainsString( + $snippetOptions['before_match'] . $match, $row['snippet'] . $snippetOptions['after_match'], + 'Options not applied!', + ); } // @see https://github.com/yiisoft/yii2-sphinx/issues/61 @@ -284,8 +287,11 @@ public function testSnippet() ->all($connection); $this->assertNotEmpty($rows); foreach ($rows as $row) { - $this->assertContains($snippetPrefix, $row['snippet'], 'Snippet source not present!'); - $this->assertContains($snippetOptions['before_match'] . $match, $row['snippet'] . $snippetOptions['after_match'], 'Options not applied!'); + $this->assertStringContainsString($snippetPrefix, $row['snippet'], 'Snippet source not present!'); + $this->assertStringContainsString( + $snippetOptions['before_match'] . $match, $row['snippet'] . $snippetOptions['after_match'], + 'Options not applied!', + ); } // @see https://github.com/yiisoft/yii2-sphinx/pull/93 diff --git a/tests/TestCase.php b/tests/TestCase.php index ec1972e9c..b474e5333 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -38,13 +38,13 @@ class TestCase extends \PHPUnit\Framework\TestCase */ protected $db; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->sphinxConfig = self::getParam('sphinx'); $this->dbConfig = self::getParam('db'); - + $this->assertTrue(extension_loaded('pdo') && extension_loaded('pdo_mysql'), 'pdo and pdo_mysql extension are required.'); // check whether sphinx is running @@ -57,7 +57,7 @@ protected function setUp() $this->mockApplication(); } - protected function tearDown() + protected function tearDown(): void { if ($this->sphinx) { $this->sphinx->close(); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 9368de923..87ffde790 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -13,5 +13,3 @@ Yii::setAlias('@yiiunit/extensions/sphinx', __DIR__); Yii::setAlias('@yii/sphinx', dirname(__DIR__) . '/src'); - -require_once(__DIR__ . '/compatibility.php'); \ No newline at end of file diff --git a/tests/compatibility.php b/tests/compatibility.php deleted file mode 100644 index f7fd3f29d..000000000 --- a/tests/compatibility.php +++ /dev/null @@ -1,32 +0,0 @@ -setExpectedException($exception); - } - - /** - * @param string $message - */ - public function expectExceptionMessage($message) - { - $this->setExpectedException($this->getExpectedException(), $message); - } - } - } -} diff --git a/tests/data/actions/sphinx-setup.sh b/tests/data/actions/sphinx-setup.sh index 4e67fdb42..aa3508ab5 100644 --- a/tests/data/actions/sphinx-setup.sh +++ b/tests/data/actions/sphinx-setup.sh @@ -2,6 +2,14 @@ SCRIPT=$(readlink -f "$0") CWD=$(dirname "$SCRIPT") +# install mysql client library +echo 'deb http://security.ubuntu.com/ubuntu xenial-security main' | sudo tee /etc/apt/sources.list.d/xenial-security.list +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 +sudo apt update +sudo apt install libmysqlclient20 +sudo apt-get install libodbc1 + # install sphinx from https://sphinxsearch.com/downloads/release/ wget http://sphinxsearch.com/files/sphinxsearch_2.2.11-release-1~xenial_amd64.deb sudo dpkg -i sphinxsearch_2.2.11-release-1~xenial_amd64.deb diff --git a/tests/data/fixture/MySphinxTestCase.php b/tests/data/fixture/MySphinxTestCase.php index 9efccd01e..87040bac2 100644 --- a/tests/data/fixture/MySphinxTestCase.php +++ b/tests/data/fixture/MySphinxTestCase.php @@ -5,17 +5,17 @@ use yii\test\FixtureTrait; use yiiunit\extensions\sphinx\data\fixture\RtIndexFixture; -class MySphinxTestCase +class MySphinxTestCase extends \yiiunit\extensions\sphinx\TestCase { use FixtureTrait; - public function setUp() + protected function setUp(): void { $this->unloadFixtures(); $this->loadFixtures(); } - public function tearDown() + protected function tearDown(): void { } diff --git a/tests/data/travis/README.md b/tests/data/travis/README.md deleted file mode 100644 index 8cfcfe2c8..000000000 --- a/tests/data/travis/README.md +++ /dev/null @@ -1,8 +0,0 @@ -This directory contains scripts for automated test runs via the [Travis CI](https://travis-ci.com) build service. They are used for the preparation of worker instances by setting up needed extensions and configuring database access. - -These scripts might be used to configure your own system for test runs. But since their primary purpose remains to support Travis in running the test cases, you would be best advised to stick to the setup notes in the tests themselves. - -The scripts are: - - - [`sphinx-setup.sh`](sphinx-setup.sh) - Prepares the [Sphinx](https://sphinxsearch.com/) server instances by installing the server and attaching it to MySQL diff --git a/tests/data/travis/sphinx-setup.sh b/tests/data/travis/sphinx-setup.sh deleted file mode 100755 index 970247af8..000000000 --- a/tests/data/travis/sphinx-setup.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -e -SCRIPT=$(readlink -f "$0") -CWD=$(dirname "$SCRIPT") - -# install sphinx from https://sphinxsearch.com/downloads/release/ -wget http://sphinxsearch.com/files/sphinxsearch_2.2.11-release-1~trusty_amd64.deb -sudo dpkg -i sphinxsearch_2.2.11-release-1~trusty_amd64.deb - -# make dir that is used in sphinx config -mkdir -p sphinx -sed -i s\~SPHINX_BASE_DIR~$PWD/sphinx~g $CWD/../sphinx.conf - -# Setup source database -mysql -D yiitest -u travis < $CWD/../source.sql - -# setup test Sphinx indexes: -indexer --config $CWD/../sphinx.conf --all - -# run searchd: -searchd --config $CWD/../sphinx.conf From 69748958443ad84564bd5adf8f0d6e3b0c8d31e6 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Fri, 29 Sep 2023 12:10:18 -0300 Subject: [PATCH 2/7] Update `phpunit.xml.dist`. --- phpunit.xml.dist | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b977e1d9c..4c6af9a72 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,23 @@ - - - - ./tests - - + + + + + ./tests + + + + + + src/ + + From 7820c78969459f9e695b58861019e9c2e572eefa Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Fri, 29 Sep 2023 12:18:05 -0300 Subject: [PATCH 3/7] Update workflow. --- .github/workflows/build.yml | 2 +- phpunit.xml.dist | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b91829788..713b63c5e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,7 +80,7 @@ jobs: run: vendor/bin/phpunit --coverage-clover=coverage.xml--colors=always - name: Upload coverage to Codecov. - if: matrix.os == 'ubuntu-latest' + if: matrix.php == '8.1' uses: codecov/codecov-action@v3 with: files: ./coverage.xml diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4c6af9a72..438a71f33 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,15 +9,19 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" > + + + + ./tests - + - src/ + ./src - + From 238f2376e055bc61bfb3d5443813a18e93bf92d3 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Fri, 29 Sep 2023 12:23:31 -0300 Subject: [PATCH 4/7] Fix error typo. --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 713b63c5e..6a86c81e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -77,10 +77,11 @@ jobs: - name: Run tests with phpunit if: matrix.php == '8.1' - run: vendor/bin/phpunit --coverage-clover=coverage.xml--colors=always + run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always - name: Upload coverage to Codecov. if: matrix.php == '8.1' uses: codecov/codecov-action@v3 with: - files: ./coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml From 8024a4ab2e28aaa3b463cd4580817cd2f22f207a Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Fri, 29 Sep 2023 12:28:06 -0300 Subject: [PATCH 5/7] Update `README.md`. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c63740213..dfed424ea 100644 --- a/README.md +++ b/README.md @@ -16,15 +16,16 @@ Documentation is at [docs/guide/README.md](docs/guide/README.md). [![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-sphinx/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-sphinx) [![Total Downloads](https://poser.pugx.org/yiisoft/yii2-sphinx/downloads.png)](https://packagist.org/packages/yiisoft/yii2-sphinx) [![Build status](https://github.com/yiisoft/yii2-sphinx/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-sphinx/actions?query=workflow%3Abuild) +[![codecov](https://codecov.io/gh/yiisoft/yii2-sphinx/graph/badge.svg?token=eEgiSUaKxc)](https://codecov.io/gh/yiisoft/yii2-sphinx) Requirements ------------ -At least Sphinx version 2.0 is required. However, in order to use all extension features, Sphinx version 2.2.3 or +- PHP 7.3 or higher. +- At least Sphinx version 2.0 is required. However, in order to use all extension features, Sphinx version 2.2.3 or higher is required. - Installation ------------ From 0a9614d7e91fd44203fd70af6afa8f9c0ddeb67d Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Fri, 29 Sep 2023 12:33:05 -0300 Subject: [PATCH 6/7] Fix minor corrections. --- .github/workflows/build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a86c81e4..03a14702b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,10 +44,10 @@ jobs: - 8.3 steps: - - name: Checkout + - name: Checkout. uses: actions/checkout@v3 - - name: Install PHP + - name: Install PHP. uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} @@ -56,26 +56,26 @@ jobs: coverage: pcov tools: composer:v2 - - name: Update composer + - name: Update composer. run: composer self-update - name: Install dependencies with composer. run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - name: Setup source database + - name: Setup source database. run: | sudo /etc/init.d/mysql start mysql -uroot -proot -e 'CREATE DATABASE `yiitest`;' mysql -D yiitest -uroot -proot < tests/data/source.sql - - name: Install sphinx + - name: Install sphinx. run: cd tests/data/actions && sh sphinx-setup.sh - - name: Run tests with phpunit + - name: Run tests with phpunit. if: matrix.php != '8.1' run: vendor/bin/phpunit --colors=always - - name: Run tests with phpunit + - name: Run tests with phpunit and generate coverage. if: matrix.php == '8.1' run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always From 897a74cc7f8bd2c91fdfddadb8a2397658952ba0 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Fri, 29 Sep 2023 12:51:08 -0300 Subject: [PATCH 7/7] fix minor correction. --- .editorconfig | 3 + .github/workflows/build.yml | 164 ++++++++++++++++++------------------ 2 files changed, 85 insertions(+), 82 deletions(-) diff --git a/.editorconfig b/.editorconfig index 257221d23..5e9a93ea5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,3 +12,6 @@ trim_trailing_whitespace = true [*.md] trim_trailing_whitespace = false + +[*.yml] +indent_size = 2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 03a14702b..0ec1405f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,87 +1,87 @@ on: - pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' - - push: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' + pull_request: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'psalm.xml' + + push: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'psalm.xml' name: build jobs: - tests: - name: PHP ${{ matrix.php }}-${{ matrix.os }} - - env: - extensions: pdo, pdo_mysql - key: cache-v1 - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php: - - 7.4 - - 8.0 - - 8.1 - - 8.2 - - 8.3 - - steps: - - name: Checkout. - uses: actions/checkout@v3 - - - name: Install PHP. - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: ${{ env.extensions }} - ini-values: date.timezone='UTC' - coverage: pcov - tools: composer:v2 - - - name: Update composer. - run: composer self-update - - - name: Install dependencies with composer. - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Setup source database. - run: | - sudo /etc/init.d/mysql start - mysql -uroot -proot -e 'CREATE DATABASE `yiitest`;' - mysql -D yiitest -uroot -proot < tests/data/source.sql - - - name: Install sphinx. - run: cd tests/data/actions && sh sphinx-setup.sh - - - name: Run tests with phpunit. - if: matrix.php != '8.1' - run: vendor/bin/phpunit --colors=always - - - name: Run tests with phpunit and generate coverage. - if: matrix.php == '8.1' - run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always - - - name: Upload coverage to Codecov. - if: matrix.php == '8.1' - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./coverage.xml + tests: + name: PHP ${{ matrix.php }}-${{ matrix.os }} + + env: + extensions: pdo, pdo_mysql + key: cache-v1 + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: + - ubuntu-latest + + php: + - 7.4 + - 8.0 + - 8.1 + - 8.2 + - 8.3 + + steps: + - name: Checkout. + uses: actions/checkout@v3 + + - name: Install PHP. + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ${{ env.extensions }} + ini-values: date.timezone='UTC' + coverage: pcov + tools: composer:v2 + + - name: Update composer. + run: composer self-update + + - name: Install dependencies with composer. + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + + - name: Setup source database. + run: | + sudo /etc/init.d/mysql start + mysql -uroot -proot -e 'CREATE DATABASE `yiitest`;' + mysql -D yiitest -uroot -proot < tests/data/source.sql + + - name: Install sphinx. + run: cd tests/data/actions && sh sphinx-setup.sh + + - name: Run tests with phpunit. + if: matrix.php != '8.1' + run: vendor/bin/phpunit --colors=always + + - name: Run tests with phpunit and generate coverage. + if: matrix.php == '8.1' + run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always + + - name: Upload coverage to Codecov. + if: matrix.php == '8.1' + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml