Skip to content

Commit

Permalink
Sync CI test workflows (#666)
Browse files Browse the repository at this point in the history
  • Loading branch information
norkunas authored Aug 1, 2024
1 parent 3c237bb commit 8da7c14
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 77 deletions.
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"
78 changes: 47 additions & 31 deletions .github/workflows/meilisearch-beta-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ 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']
Expand All @@ -34,41 +37,54 @@ jobs:
- '7700:7700'
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'

name: integration-tests-against-rc (PHP ${{ matrix.php-version }}) (${{ matrix.http-client }})
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
124 changes: 78 additions & 46 deletions .github/workflows/pre-release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,83 +4,115 @@ 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 }}
env:
MEILI_MASTER_KEY: 'masterKey'
MEILI_NO_ANALYTICS: 'true'
ports:
- '7700:7700'
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
name: integration-tests-against-rc (PHP ${{ matrix.php-versions }})
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

0 comments on commit 8da7c14

Please sign in to comment.