Skip to content

Commit 11da08e

Browse files
committed
test: add ci test for mariadb with filecache partitioning
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 865f6bd commit 11da08e

1 file changed

Lines changed: 155 additions & 0 deletions

File tree

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: PHPUnit mysql
10+
11+
on:
12+
pull_request:
13+
schedule:
14+
- cron: "5 2 * * *"
15+
16+
permissions:
17+
contents: read
18+
19+
concurrency:
20+
group: phpunit-mysql-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
changes:
25+
runs-on: ubuntu-latest-low
26+
permissions:
27+
contents: read
28+
pull-requests: read
29+
30+
outputs:
31+
src: ${{ steps.changes.outputs.src }}
32+
33+
steps:
34+
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2
35+
id: changes
36+
continue-on-error: true
37+
with:
38+
filters: |
39+
src:
40+
- '.github/workflows/**'
41+
- '3rdparty/**'
42+
- '**/appinfo/**'
43+
- '**/lib/**'
44+
- '**/templates/**'
45+
- '**/tests/**'
46+
- 'vendor/**'
47+
- 'vendor-bin/**'
48+
- '.php-cs-fixer.dist.php'
49+
- 'composer.json'
50+
- 'composer.lock'
51+
- '**.php'
52+
53+
phpunit-mysql:
54+
runs-on: ubuntu-latest
55+
56+
needs: changes
57+
if: needs.changes.outputs.src != 'false'
58+
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
include:
63+
- mysql-versions: '8.4'
64+
php-versions: '8.3'
65+
- mysql-versions: '9.7'
66+
php-versions: '8.5'
67+
68+
name: MySQL ${{ matrix.mysql-versions }} (PHP ${{ matrix.php-versions }}) - database tests
69+
70+
services:
71+
cache:
72+
image: ghcr.io/nextcloud/continuous-integration-redis:latest # zizmor: ignore[unpinned-images]
73+
ports:
74+
- 6379:6379/tcp
75+
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
76+
77+
mysql:
78+
image: mysql:${{ matrix.mysql-versions }} # zizmor: ignore[unpinned-images]
79+
ports:
80+
- 4444:3306/tcp
81+
env:
82+
MYSQL_ROOT_PASSWORD: rootpassword
83+
MYSQL_USER: oc_autotest
84+
MYSQL_PASSWORD: nextcloud
85+
MYSQL_DATABASE: oc_autotest
86+
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 10
87+
88+
steps:
89+
- name: Checkout server
90+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
91+
with:
92+
persist-credentials: false
93+
submodules: true
94+
95+
- name: Set up php ${{ matrix.php-versions }}
96+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
97+
timeout-minutes: 5
98+
with:
99+
php-version: ${{ matrix.php-versions }}
100+
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
101+
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql
102+
coverage: none
103+
ini-file: development
104+
ini-values: disable_functions=""
105+
env:
106+
fail-fast: true
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
109+
- name: Set up dependencies
110+
run: composer i
111+
112+
- name: Enable ONLY_FULL_GROUP_BY MySQL option
113+
run: |
114+
echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
115+
echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
116+
117+
- name: Set up Nextcloud
118+
env:
119+
DB_PORT: 4444
120+
run: |
121+
mkdir data
122+
cp tests/redis.config.php config/
123+
cp tests/preseed-config.php config/config.php
124+
./occ maintenance:install --verbose --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
125+
php -f tests/enable_all.php
126+
127+
- name: Enable sharding for oc_filecache
128+
run: |
129+
echo "alter table oc_filecache drop primary key, add primary key (fileid, storage);" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
130+
echo "alter table oc_filecache partition by hash(storage) partitions 5;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
131+
132+
- name: PHPUnit
133+
run: composer run test:db -- --log-junit junit.xml
134+
env:
135+
DB_ROOT_USER: root
136+
DB_ROOT_PASS: rootpassword
137+
138+
- name: Print logs
139+
if: always()
140+
run: |
141+
cat data/nextcloud.log
142+
143+
summary:
144+
permissions:
145+
contents: none
146+
runs-on: ubuntu-latest-low
147+
needs: [changes, phpunit-mysql]
148+
149+
if: always()
150+
151+
name: phpunit-mysql-summary
152+
153+
steps:
154+
- name: Summary status
155+
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi

0 commit comments

Comments
 (0)