Skip to content

Commit c216329

Browse files
committed
add ci for integration tests with mysql partitioning
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent d34c992 commit c216329

1 file changed

Lines changed: 219 additions & 0 deletions

File tree

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: MIT
3+
name: Integration mariadb-partitioning
4+
5+
on:
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: integration-mariadb-partitioning-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
changes:
17+
runs-on: ubuntu-latest-low
18+
19+
outputs:
20+
src: ${{ steps.changes.outputs.src}}
21+
22+
steps:
23+
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
24+
id: changes
25+
continue-on-error: true
26+
with:
27+
filters: |
28+
src:
29+
- '.github/workflows/**'
30+
- '3rdparty/**'
31+
- '**/*.php'
32+
- '**/lib/**'
33+
- '**/tests/**'
34+
- '**/vendor-bin/**'
35+
- 'build/integration/**'
36+
- '.php-cs-fixer.dist.php'
37+
- 'composer.json'
38+
- 'composer.lock'
39+
- 'core/shipped.json'
40+
41+
integration-mariadb-partitioning:
42+
runs-on: ubuntu-latest
43+
44+
needs: changes
45+
if: needs.changes.outputs.src != 'false'
46+
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
test-suite:
51+
- 'capabilities_features'
52+
- 'collaboration_features'
53+
- 'comments_features'
54+
- '--tags ~@requires-s3 dav_features'
55+
- 'features'
56+
- 'federation_features'
57+
- '--tags ~@large files_features'
58+
- 'filesdrop_features'
59+
- 'file_conversions'
60+
- 'files_reminders'
61+
- 'openldap_features'
62+
- 'openldap_numerical_features'
63+
- 'ldap_features'
64+
- 'routing_features'
65+
- 'setup_features'
66+
- 'sharees_features'
67+
- 'sharing_features'
68+
- 'theming_features'
69+
- 'videoverification_features'
70+
- 'guests_features'
71+
72+
php-versions: ['8.5']
73+
mysql-versions: ['9.7']
74+
guests-versions: ['main']
75+
spreed-versions: ['main']
76+
activity-versions: ['master']
77+
78+
services:
79+
redis:
80+
image: ghcr.io/nextcloud/continuous-integration-redis:latest # zizmor: ignore[unpinned-images]
81+
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
82+
ports:
83+
- 6379:6379/tcp
84+
openldap:
85+
image: ghcr.io/nextcloud/continuous-integration-openldap:openldap-8 # zizmor: ignore[unpinned-images]
86+
ports:
87+
- 389:389
88+
- 636:636
89+
env:
90+
SLAPD_DOMAIN: nextcloud.ci
91+
SLAPD_ORGANIZATION: Nextcloud
92+
SLAPD_PASSWORD: admin
93+
SLAPD_ADDITIONAL_MODULES: memberof
94+
95+
mysql:
96+
image: mysql:${{ matrix.mysql-versions }} # zizmor: ignore[unpinned-images]
97+
ports:
98+
- 4444:3306/tcp
99+
env:
100+
MYSQL_ROOT_PASSWORD: rootpassword
101+
MYSQL_USER: oc_autotest
102+
MYSQL_PASSWORD: nextcloud
103+
MYSQL_DATABASE: oc_autotest
104+
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 10
105+
106+
steps:
107+
- name: Checkout server
108+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
109+
with:
110+
persist-credentials: false
111+
submodules: true
112+
113+
- name: Checkout Talk app
114+
if: ${{ matrix.test-suite == 'videoverification_features' }}
115+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
116+
with:
117+
persist-credentials: false
118+
repository: nextcloud/spreed
119+
path: apps/spreed
120+
ref: ${{ matrix.spreed-versions }}
121+
122+
- name: Checkout Guests app
123+
if: ${{ matrix.test-suite == 'guests_features' }}
124+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
125+
with:
126+
persist-credentials: false
127+
repository: nextcloud/guests
128+
path: apps/guests
129+
ref: ${{ matrix.guests-versions }}
130+
131+
- name: Checkout Activity app
132+
if: ${{ matrix.test-suite == 'sharing_features' }}
133+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
134+
with:
135+
persist-credentials: false
136+
repository: nextcloud/activity
137+
path: apps/activity
138+
ref: ${{ matrix.activity-versions }}
139+
140+
- name: Set up php ${{ matrix.php-versions }}
141+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 #v2.37.2
142+
timeout-minutes: 5
143+
with:
144+
php-version: ${{ matrix.php-versions }}
145+
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
146+
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, imagick, intl, json, ldap, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql
147+
coverage: none
148+
ini-file: development
149+
ini-values: disable_functions=""
150+
env:
151+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152+
153+
- name: Set up dependencies
154+
run: |
155+
composer install
156+
157+
- name: Enable ONLY_FULL_GROUP_BY MySQL option
158+
run: |
159+
echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
160+
echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
161+
162+
- name: Set up Talk dependencies
163+
if: ${{ matrix.test-suite == 'videoverification_features' }}
164+
working-directory: apps/spreed
165+
run: composer i --no-dev
166+
167+
- name: Set up Nextcloud
168+
env:
169+
DB_PORT: 4444
170+
run: |
171+
mkdir data
172+
./occ maintenance:install --verbose ${{ contains(matrix.test-suite,'ldap') && '--data-dir=/dev/shm/nc_int' || '' }} --database=mysql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
173+
./occ config:system:set hashing_default_password --value=true --type=boolean
174+
175+
- name: Enable sharding for oc_filecache
176+
run: |
177+
echo "alter table oc_filecache drop primary key, add primary key (fileid, storage);" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword nextcloud
178+
echo "alter table oc_filecache partition by hash(storage) partitions 5;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword nextcloud
179+
180+
- name: Configure caching
181+
if: ${{ contains(matrix.test-suite,'ldap') }}
182+
run: |
183+
./occ config:system:set redis host --value=localhost
184+
./occ config:system:set redis port --value=6379 --type=integer
185+
./occ config:system:set redis timeout --value=0 --type=integer
186+
./occ config:system:set memcache.local --value='\OC\Memcache\Redis'
187+
./occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
188+
189+
- name: Run integration
190+
working-directory: build/integration
191+
env:
192+
LDAP_HOST: localhost
193+
run: bash run.sh ${{ matrix.test-suite }} no-tail-log
194+
195+
- name: Show partition info
196+
run: |
197+
echo "SELECT table_name, partition_name, table_rows FROM information_schema.partitions WHERE partition_name is not null;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword nextcloud
198+
echo "SELECT table_rows FROM information_schema.tables WHERE table_name = 'oc_filecache';" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword nextcloud
199+
200+
- name: Print logs
201+
if: always()
202+
run: |
203+
cat $(./occ log:file |grep "Log file"|cut -d" " -f3)
204+
docker ps -a
205+
docker ps -aq | while read container ; do IMAGE=$(docker inspect --format='{{.Config.Image}}' $container); echo $IMAGE; docker logs $container; echo "\n\n" ; done
206+
207+
summary:
208+
permissions:
209+
contents: none
210+
runs-on: ubuntu-latest-low
211+
needs: [changes, integration-sqlite]
212+
213+
if: always()
214+
215+
name: integration-sqlite-summary
216+
217+
steps:
218+
- name: Summary status
219+
run: if ${{ needs.changes.outputs.src != 'false' && needs.integration-sqlite.result != 'success' }}; then exit 1; fi

0 commit comments

Comments
 (0)