Skip to content

Commit ff357d5

Browse files
committed
ci: merge object storage tests into one matrix
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 2efe48b commit ff357d5

5 files changed

Lines changed: 128 additions & 263 deletions

File tree

.github/workflows/object-storage-azure.yml

Lines changed: 0 additions & 81 deletions
This file was deleted.

.github/workflows/object-storage-s3.yml

Lines changed: 0 additions & 86 deletions
This file was deleted.

.github/workflows/object-storage-swift.yml

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: MIT
3+
name: Object storage
4+
on:
5+
workflow_call:
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: object-storage-${{ github.head_ref || github.run_id }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
object-storage:
16+
runs-on: ubuntu-latest
17+
18+
if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
php-versions: ['8.3', '8.5']
24+
backend: ['s3', 'azure', 'swift']
25+
26+
name: php${{ matrix.php-versions }}-${{ matrix.backend }}
27+
28+
services:
29+
cache:
30+
image: ghcr.io/nextcloud/continuous-integration-redis:latest # zizmor: ignore[unpinned-images]
31+
ports:
32+
- 6379:6379/tcp
33+
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
34+
35+
steps:
36+
- name: Checkout server
37+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
38+
with:
39+
persist-credentials: false
40+
submodules: true
41+
42+
# Object stores run as plain containers instead of job services so that a
43+
# single matrix job can pick the one it needs.
44+
- name: Start object store
45+
env:
46+
BACKEND: ${{ matrix.backend }}
47+
run: |
48+
case "$BACKEND" in
49+
s3)
50+
docker run --name minio -d -p 9000:9000 -e MINIO_ROOT_USER=nextcloud -e MINIO_ROOT_PASSWORD=bWluaW8tc2VjcmV0LWtleS1uZXh0Y2xvdWQ= -e MINIO_DEFAULT_BUCKETS=nextcloud bitnami/minio@sha256:50cec18ac4184af4671a78aedd5554942c8ae105d51a465fa82037949046da01 # v2025.4.22
51+
echo 'OBJECT_STORE=s3' >> $GITHUB_ENV
52+
echo 'OBJECT_STORE_KEY=nextcloud' >> $GITHUB_ENV
53+
echo 'OBJECT_STORE_SECRET=bWluaW8tc2VjcmV0LWtleS1uZXh0Y2xvdWQ=' >> $GITHUB_ENV
54+
;;
55+
azure)
56+
docker run --name azurite -d -p 10000:10000 -e AZURITE_ACCOUNTS=nextcloud:bmV4dGNsb3Vk mcr.microsoft.com/azure-storage/azurite@sha256:0a47e12e3693483cef5c71f35468b91d751611f172d2f97414e9c69113b106d9 # v3.34.0
57+
echo 'OBJECT_STORE=azure' >> $GITHUB_ENV
58+
echo 'OBJECT_STORE_KEY=nextcloud' >> $GITHUB_ENV
59+
echo 'OBJECT_STORE_SECRET=bmV4dGNsb3Vk' >> $GITHUB_ENV
60+
;;
61+
swift)
62+
docker run --name swift -d -p 5000:5000 -p 8080:8080 ghcr.io/cscfi/docker-keystone-swift@sha256:e8b1ec21120ab9adc6ac6a2b98785fd273676439a8633fe898e37f2aea7e0712
63+
echo 'OBJECT_STORE=swift' >> $GITHUB_ENV
64+
echo 'OBJECT_STORE_SECRET=veryfast' >> $GITHUB_ENV
65+
;;
66+
esac
67+
68+
- name: Set up php ${{ matrix.php-versions }}
69+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 #v2.37.2
70+
timeout-minutes: 5
71+
with:
72+
php-version: ${{ matrix.php-versions }}
73+
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
74+
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
75+
coverage: none
76+
ini-file: development
77+
ini-values: disable_functions=""
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
81+
- name: Set up Nextcloud
82+
run: |
83+
composer install
84+
cp tests/redis.config.php config/
85+
cp tests/preseed-config.php config/config.php
86+
./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
87+
php -f tests/enable_all.php
88+
89+
- name: Wait for object store
90+
env:
91+
BACKEND: ${{ matrix.backend }}
92+
run: |
93+
case "$BACKEND" in
94+
s3)
95+
curl -f -m 1 --retry-connrefused --retry 10 --retry-delay 10 http://localhost:9000/minio/health/ready
96+
;;
97+
azure)
98+
ready=
99+
for _ in $(seq 1 60); do
100+
if timeout 1 bash -c '< /dev/tcp/127.0.0.1/10000' 2>/dev/null; then ready=1; break; fi
101+
sleep 1
102+
done
103+
[ -n "$ready" ] || { echo 'azurite did not become ready'; exit 1; }
104+
;;
105+
esac
106+
107+
- name: PHPUnit
108+
run: composer run test -- --group PRIMARY-${{ matrix.backend }} --log-junit junit.xml
109+
110+
- name: Object store logs
111+
if: always()
112+
run: |
113+
docker ps -a
114+
docker ps -aq | while read container ; do IMAGE=$(docker inspect --format='{{.Config.Image}}' $container); echo $IMAGE; docker logs $container; echo "\n\n" ; done

0 commit comments

Comments
 (0)