-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (121 loc) · 4.81 KB
/
test.yml
File metadata and controls
142 lines (121 loc) · 4.81 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Test
on:
push:
branches:
- '**'
paths-ignore:
- README.md
- LICENSE
- renovate.json
- .gitignore
- appinfo/info.xml
- .github/workflows/release.yml
workflow_call:
jobs:
test:
runs-on: ubuntu-latest
name: Nextcloud ${{ matrix.nextcloud }} - ${{ matrix.db.name }}
strategy:
matrix:
db:
- name: mariadb
type: mysql
image: mariadb:10.9
username: root
database: nextcloud
port: 3306
- name: mysql
type: mysql
image: mysql:8.0
username: root
database: nextcloud
port: 3306
- name: pgsql
type: pgsql
image: postgres:17
username: postgres
database: postgres
port: 5432
nextcloud:
- "31"
- "32"
services:
db:
image: ${{ matrix.db.image }}
env:
MARIADB_ROOT_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
POSTGRES_PASSWORD: password
container:
image: nextcloud:${{ matrix.nextcloud }}
steps:
- name: Copy Nextcloud source
run: ln -s /usr/src/nextcloud/* ${GITHUB_WORKSPACE}/
- uses: actions/checkout@v6
with:
path: apps/fulltextsearch_sql
# The nextcloud container doesn't have `node`, so the cache action cannot execute
# - name: Cache Composer packages
# id: composer-cache
# uses: actions/cache@v4
# with:
# path: apps/fulltextsearch_sql/vendor
# key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
# restore-keys: |
# ${{ runner.os }}-php-
- name: Install composer
run: curl -sSf https://raw.githubusercontent.com/composer/getcomposer.org/f3108f64b4e1c1ce6eb462b159956461592b3e3e/web/installer | php -- --install-dir /usr/local/bin
if: steps.composer-cache.outputs.cache-hit != 'true'
- name: Install dependencies
run: composer.phar install --prefer-dist --no-progress
working-directory: apps/fulltextsearch_sql
if: steps.composer-cache.outputs.cache-hit != 'true'
- name: Wait for database to get ready
run: while ! bash -c "echo -n > /dev/tcp/db/${{ matrix.db.port }}" 2> /dev/null; do sleep 1; done
- name: Install nextcloud
run: >
php occ -n maintenance:install \
--admin-pass=admin \
--database=${{ matrix.db.type }} \
--database-host=db \
--database-user=${{ matrix.db.username }} \
--database-pass=password \
--database-name=${{ matrix.db.database }}
- name: Enable fulltextsearch app
run: php occ -n app:enable fulltextsearch
- name: Enable fulltextsearch_sql app
run: php occ -n app:enable fulltextsearch_sql
- name: Configure fulltextsearch_sql as platform
run: >
php occ -n fulltextsearch:configure '{"search_platform": "OCA\\FullTextSearch_SQL\\Platform\\SQLPlatform"}'
- name: Output fulltextsearch_sql settings
run: php occ -n fulltextsearch:check
# This can be removed as soon as https://github.com/nextcloud/fulltextsearch/pull/915 is merged.
- name: Fix test harness
run: >
sed -i \
-e "s/'document is a simple test'/'document is a'/" \
-e "s/document is a simple -test/document -test/" \
custom_apps/fulltextsearch/lib/Command/Test.php
- name: Run fulltextsearch test
run: php occ -n fulltextsearch:test --platform_delay 1
- name: Enable files_fulltextsearch provider
run: php occ app:enable files_fulltextsearch
- name: Identify test PDF document
run: >
php occ info:file '/admin/files/Documents/Nextcloud flyer.pdf' | awk '$1 == "fileid:" { print "TEST_DOC=" $2 }' > "$GITHUB_ENV"
- name: Index test PDF document
run: php occ fulltextsearch:document:index admin files "$TEST_DOC"
- name: Search for test PDF document
run: >
php occ fulltextsearch:search admin Nextcloud | grep -e "^ - $TEST_DOC score:" -e "^ *\* id: $TEST_DOC"
- name: Create test ISO-8859-1 document
run: echo -e "F\xFCr Testzwecke" | php occ files:put - /admin/files/iso-8859-1.txt
- name: Identify test ISO-8859-1 document
run: >
php occ info:file '/admin/files/iso-8859-1.txt' | awk '$1 == "fileid:" { print "TEST_DOC=" $2 }' > "$GITHUB_ENV"
- name: Index test ISO-8859-1 document
run: php occ fulltextsearch:document:index admin files "$TEST_DOC"
- name: Search for test ISO-8859-1 document
run: >
php occ fulltextsearch:search admin Testzwecke | grep -e "^ - $TEST_DOC score:" -e "^ *\* id: $TEST_DOC"