-
Notifications
You must be signed in to change notification settings - Fork 99
90 lines (79 loc) · 2.72 KB
/
buddy-integration.yml
File metadata and controls
90 lines (79 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Buddy Integration
on:
workflow_dispatch:
jobs:
buddy-runtime:
name: Buddy runtime smoke (manual)
runs-on: ubuntu-22.04
timeout-minutes: 20
permissions:
contents: read
packages: read
env:
SEARCH_BUILD: MANTICORE
MANTICORE_IMAGE: manticoresearch/manticore@sha256:24835e1b590a31da0f45809b032865b1caab0a1b58f4ed14da9128a338f2d365
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
coverage: none
extensions: mysqli, pdo_mysql, mbstring
tools: composer:v2
- name: Start Manticore with Buddy extras
run: |
docker pull "$MANTICORE_IMAGE"
docker run -d --name searchd \
-e EXTRA=1 \
-p 9307:9306 \
-p 9312:9312 \
"$MANTICORE_IMAGE"
- name: Wait for searchd
run: |
n=0
while [ "$n" -lt 60 ]; do
if php -r '
try {
$pdo = new PDO("mysql:host=127.0.0.1;port=9307", "", "");
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->query("SHOW TABLES");
exit(0);
} catch (Throwable $exception) {
exit(1);
}
' >/dev/null 2>&1; then
exit 0
fi
n=$((n + 1))
sleep 1
done
echo "searchd did not become SQL-ready on 127.0.0.1:9307"
docker logs searchd || true
exit 1
- name: Seed runtime test table
run: |
cat > /tmp/seed-buddy-rt.php <<'PHP'
<?php
$pdo = new PDO('mysql:host=127.0.0.1;port=9307', '', '');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec('CREATE TABLE IF NOT EXISTS rt(title text, content text, gid uint)');
$pdo->exec('TRUNCATE TABLE rt');
$pdo->exec("REPLACE INTO rt(id, title, content, gid) VALUES (1, 'test', 'teh words', 1)");
PHP
php /tmp/seed-buddy-rt.php
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress
- name: Run Buddy-specific runtime tests (must not skip)
run: |
./vendor/bin/phpunit \
--configuration tests/travis/pdo.phpunit.xml \
--filter '/(testQSuggestExecutionWhenBuddySupported|testAutocompleteExecutionWhenBuddySupported)/' \
--fail-on-skipped
- name: Show searchd logs
if: always()
run: docker logs searchd || true
- name: Stop searchd container
if: always()
run: docker rm -f searchd || true