Skip to content

Commit

Permalink
Merge pull request #658 from meilisearch/bump-meilisearch-v1.10.0
Browse files Browse the repository at this point in the history
Changes related to the next Meilisearch release (v1.10.0)
  • Loading branch information
brunoocasali authored Aug 26, 2024
2 parents c4eb8ec + 06b5a17 commit f6f1357
Show file tree
Hide file tree
Showing 18 changed files with 488 additions and 216 deletions.
26 changes: 26 additions & 0 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -744,3 +744,29 @@ search_parameter_guide_matching_strategy_3: |-
get_similar_post_1: |-
$similarQuery = new SimilarDocumentsQuery('TARGET_DOCUMENT_ID');
$client->index('INDEX_NAME')->getSimilar($similarQuery);
multi_search_federated_1: |-
$client->multiSearch([
(new SearchQuery())
->setIndexUid('movies'))
->setQuery('batman')
->setLimit(5),
(new SearchQuery())
->setIndexUid('comics')
->setQuery('batman')
->setLimit(5),
],
(new MultiSearchFederation())
);
search_parameter_reference_locales_1: |-
$client->index('INDEX_NAME')->search('進撃の巨人', [
'locales' => ['jpn']
]);
get_localized_attribute_settings_1: |-
$client->index('INDEX_NAME')->getLocalizedAttributes();
update_localized_attribute_settings_1: |-
$client->index('INDEX_NAME')->updateLocalizedAttributes([
'locales' => ['jpn'],
'attributePatterns' => ['*_ja']
]);
reset_localized_attribute_settings_1: |-
$client->index('INDEX_NAME')->resetLocalizedAttributes();
12 changes: 12 additions & 0 deletions .github/scripts/get-latest-meilisearch-rc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# This script is used in the SDK CIs to fetch the latest Meilisearch RC name (ex: v0.16.0rc2).
# The Meilisearch RC is needed when maintainers are developing features during the pre-release week because the final Meilisearch release is not out yet.

temp_file='temp_file' # temp_file needed because `grep` would start before the download is over
curl -s 'https://api.github.com/repos/meilisearch/meilisearch/releases' > "$temp_file"
latest_rc_release=$(cat "$temp_file" \
| grep -E 'tag_name' | grep 'rc' | head -1 \
| tr -d ',"' | cut -d ':' -f2 | tr -d ' ')
rm -rf "$temp_file"
echo "$latest_rc_release"
84 changes: 50 additions & 34 deletions .github/workflows/meilisearch-beta-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,64 +11,80 @@ on:
jobs:
meilisearch-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.grep-step.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Grep docker beta version of Meilisearch
id: grep-step
run: |
MEILISEARCH_VERSION=$(sh .github/scripts/beta-docker-version.sh)
echo $MEILISEARCH_VERSION
echo ::set-output name=version::$MEILISEARCH_VERSION
echo "version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
outputs:
version: ${{ steps.grep-step.outputs.version }}

tests:
runs-on: ubuntu-latest
needs: ['meilisearch-version']
name: integration-tests-against-rc (PHP ${{ matrix.php-version }}) (${{ matrix.http-client }})
services:
meilisearch:
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
env:
MEILI_MASTER_KEY: 'masterKey'
MEILI_NO_ANALYTICS: 'true'
ports:
- '7700:7700'
env:
MEILI_MASTER_KEY: masterKey
MEILI_NO_ANALYTICS: true
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']
name: integration-tests-against-rc (PHP ${{ matrix.php-versions }})
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
http-client: ['Guzzle-7', 'Guzzle-7-Adapter', 'Symfony-HttpClient', 'PHP-HTTP-CurlClient', 'Kriswallsmith-Buzz']
exclude:
- php-version: '7.4'
http-client: 'Symfony-HttpClient'
- php-version: '8.0'
http-client: 'Symfony-HttpClient'
- php-version: '8.1'
http-client: 'Symfony-HttpClient'

steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
run: |
composer remove --dev friendsofphp/php-cs-fixer --no-update --no-interaction
composer install --prefer-dist --no-progress --no-suggest
- name: Run test suite - default HTTP client (Guzzle 7)
run: |
sh scripts/tests.sh
composer remove --dev guzzlehttp/guzzle http-interop/http-factory-guzzle
- name: Run test suite - php-http/guzzle6-adapter

- name: Switch to Guzzle7 Adapter
if: matrix.http-client == 'Guzzle-7-Adapter'
run: |
composer require --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle
sh scripts/tests.sh
composer remove --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle
- name: Run test suite - symfony/http-client
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/guzzle7-adapter": "^1.0.0",/' composer.json
- name: Switch to Symfony HttpClient
if: matrix.http-client == 'Symfony-HttpClient'
run: |
composer require --dev symfony/http-client nyholm/psr7
sh scripts/tests.sh
composer remove --dev symfony/http-client nyholm/psr7
- name: Run test suite - php-http/curl-client
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"symfony\/http-client": "^7.1.1",/' composer.json
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
- name: Switch to PHP HTTP CurlClient
if: matrix.http-client == 'PHP-HTTP-CurlClient'
run: |
composer require --dev php-http/curl-client nyholm/psr7
sh scripts/tests.sh
composer remove --dev php-http/curl-client nyholm/psr7
- name: Run test suite - kriswallsmith/buzz
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/curl-client": "^2.3.2",/' composer.json
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
- name: Switch to Kriswallsmith Buzz
if: matrix.http-client == 'Kriswallsmith-Buzz'
run: |
composer require --dev kriswallsmith/buzz nyholm/psr7 --with-all-dependencies
sh scripts/tests.sh
composer remove --dev kriswallsmith/buzz nyholm/psr7
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"kriswallsmith\/buzz": "^1.2.1",/' composer.json
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
- name: Install dependencies
uses: ramsey/composer-install@v3

- name: Run test suite
run: sh scripts/tests.sh
134 changes: 87 additions & 47 deletions .github/workflows/pre-release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,83 +4,123 @@ name: Pre-Release Tests
# Will only run for PRs and pushes to bump-meilisearch-v*
on:
push:
branches: bump-meilisearch-v*
branches: ['bump-meilisearch-v*']
pull_request:
branches: bump-meilisearch-v*
branches: ['bump-meilisearch-v*']

jobs:
meilisearch-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Grep docker latest rc version of Meilisearch
id: grep-step
run: |
MEILISEARCH_VERSION=$(sh .github/scripts/get-latest-meilisearch-rc.sh)
echo $MEILISEARCH_VERSION
echo "version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
outputs:
version: ${{ steps.grep-step.outputs.version }}

tests:
runs-on: ubuntu-latest
needs: ['meilisearch-version']
name: integration-tests-against-rc (PHP ${{ matrix.php-versions }})
services:
meilisearch:
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
ports:
- '7700:7700'
env:
MEILI_MASTER_KEY: masterKey
MEILI_NO_ANALYTICS: true
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
name: integration-tests-against-rc (PHP ${{ matrix.php-versions }})
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
http-client: ['Guzzle-7', 'Guzzle-7-Adapter', 'Symfony-HttpClient', 'PHP-HTTP-CurlClient', 'Kriswallsmith-Buzz']
exclude:
- php-version: '7.4'
http-client: 'Symfony-HttpClient'
- php-version: '8.0'
http-client: 'Symfony-HttpClient'
- php-version: '8.1'
http-client: 'Symfony-HttpClient'
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none

- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
run: |
composer remove --dev friendsofphp/php-cs-fixer --no-update --no-interaction
composer install --prefer-dist --no-progress --no-suggest
- name: Get the latest Meilisearch RC
run: echo "MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
- name: Run test suite - default HTTP client (Guzzle 7)
run: |
sh scripts/tests.sh
composer remove --dev guzzlehttp/guzzle http-interop/http-factory-guzzle
- name: Run test suite - php-http/guzzle7-adapter

- name: Switch to Guzzle7 Adapter
if: matrix.http-client == 'Guzzle-7-Adapter'
run: |
composer require --dev php-http/guzzle7-adapter http-interop/http-factory-guzzle
sh scripts/tests.sh
composer remove --dev php-http/guzzle7-adapter http-interop/http-factory-guzzle
- name: Run test suite - symfony/http-client
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/guzzle7-adapter": "^1.0.0",/' composer.json
- name: Switch to Symfony HttpClient
if: matrix.http-client == 'Symfony-HttpClient'
run: |
composer require --dev symfony/http-client nyholm/psr7
sh scripts/tests.sh
composer remove --dev symfony/http-client nyholm/psr7
- name: Run test suite - php-http/curl-client
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"symfony\/http-client": "^7.1.1",/' composer.json
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
- name: Switch to PHP HTTP CurlClient
if: matrix.http-client == 'PHP-HTTP-CurlClient'
run: |
composer require --dev php-http/curl-client nyholm/psr7
sh scripts/tests.sh
composer remove --dev php-http/curl-client nyholm/psr7
- name: Run test suite - kriswallsmith/buzz
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/curl-client": "^2.3.2",/' composer.json
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
- name: Switch to Kriswallsmith Buzz
if: matrix.http-client == 'Kriswallsmith-Buzz'
run: |
composer require --dev kriswallsmith/buzz nyholm/psr7 --with-all-dependencies
composer update php-http/client-common:2.6.0 php-http/httplug:2.3.0 psr/http-message
sh scripts/tests.sh
composer remove --dev kriswallsmith/buzz nyholm/psr7
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"kriswallsmith\/buzz": "^1.2.1",/' composer.json
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
- name: Install dependencies
uses: ramsey/composer-install@v3

- name: Run test suite
run: sh scripts/tests.sh

test_php_7_guzzle_6:
runs-on: ubuntu-latest
needs: ['meilisearch-version']
name: integration-tests-against-rc (PHP 7.4 & Guzzle 6)
services:
meilisearch:
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
env:
MEILI_MASTER_KEY: 'masterKey'
MEILI_NO_ANALYTICS: 'true'
ports:
- '7700:7700'

steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none

- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies

- name: Switch to Guzzle 6
run: |
composer remove --dev friendsofphp/php-cs-fixer --no-update --no-interaction
composer update --prefer-dist --no-progress
composer remove --dev guzzlehttp/guzzle http-interop/http-factory-guzzle
composer update php-http/client-common:2.6.0 php-http/httplug:2.3.0 psr/http-message
- name: Get the latest Meilisearch RC
run: echo "MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/guzzle6-adapter": "^2.0.2",/' composer.json
- name: Install dependencies
uses: ramsey/composer-install@v3

- name: Run test suite - php-http/guzzle6-adapter
run: |
composer require --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle
sh scripts/tests.sh
run: sh scripts/tests.sh
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ jobs:
# Will still run for each push to bump-meilisearch-v*
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
runs-on: ubuntu-latest
name: integration-tests (PHP ${{ matrix.php-version }}) (${{ matrix.http-client }})
services:
meilisearch:
image: getmeili/meilisearch:latest
ports:
- 7700:7700
- '7700:7700'
env:
MEILI_MASTER_KEY: masterKey
MEILI_NO_ANALYTICS: true
Expand All @@ -86,7 +87,6 @@ jobs:
- php-version: '8.1'
http-client: 'Symfony-HttpClient'

name: integration-tests (PHP ${{ matrix.php-version }}) (${{ matrix.http-client }})
steps:
- uses: actions/checkout@v4

Expand Down
38 changes: 15 additions & 23 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
bootstrap="vendor/autoload.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
cacheResult="false"
colors="true">
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory>src/</directory>
</include>
</coverage>
<php>
<env name="MEILISEARCH_URL" value="http://localhost:7700"/>
<env name="MEILISEARCH_API_KEY" value="masterKey"/>
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" stopOnFailure="false" cacheResult="false" colors="true" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="MEILISEARCH_URL" value="http://localhost:7700"/>
<env name="MEILISEARCH_API_KEY" value="masterKey"/>
</php>
<source>
<include>
<directory>src/</directory>
</include>
</source>
</phpunit>
Loading

0 comments on commit f6f1357

Please sign in to comment.