Repository navigation
227 lines (196 loc) · 8.15 KB
/
Copy pathbehat-pgsql.yml
File metadata and controls
227 lines (196 loc) · 8.15 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Behat PostgreSQL
on: pull_request
permissions:
contents: read
concurrency:
group: behat-pgsql-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
php-version: ${{ steps.versions.outputs.php-available-list }}
server-max: ${{ steps.versions.outputs.branches-max-list }}
steps:
- name: Checkout app
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Get version matrix
id: versions
uses: nextcloud-libraries/nextcloud-version-matrix@71959de73c244b11ecbf4503b87c41d65b0f64ae # v1.3.4
changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.src}}
steps:
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/behat*'
- 'behat.php'
- 'appinfo/**'
- 'lib/**'
- 'templates/**'
- 'tests/**'
- '3rdparty/**'
- 'vendor-bin/**'
- '.php-cs-fixer.dist.php'
- 'composer.json'
- 'composer.lock'
behat-pgsql:
runs-on: ubuntu-latest
needs: [changes, matrix]
if: needs.changes.outputs.src != 'false'
strategy:
matrix:
php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
shard: [0, 1, 2, 3]
name: PostgreSQL 18 PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} Shard ${{ matrix.shard }}
services:
postgres:
image: postgres:18 # zizmor: ignore[unpinned-images]
ports:
- 4444:5432/tcp
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: nextcloud
options: >-
--mount type=tmpfs,destination=/var/lib/postgresql
--health-cmd="pg_isready -U root -d nextcloud"
--health-interval 5s
--health-timeout 2s
--health-retries 5
mailpit:
image: axllent/mailpit
ports:
- 8025:8025/tcp
- 1025:1025/tcp
steps:
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Install system dependencies
run: sudo apt update && sudo apt install poppler-utils
- name: Install PHP crash diagnostics
if: runner.debug == '1'
run: sudo apt install -y gdb systemd-coredump
- name: Checkout server
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: true
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql, imagick
coverage: none
ini-file: development
# disable_functions: re-enable pcntl_* functions
# opcache.jit: PHP 8.3 function JIT corrupts OPcache SHM with first-class callables (fixed in 8.4+)
ini-values: disable_functions=, opcache.jit=${{ matrix.php-versions == '8.3' && 'disable' || '1235' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check composer file existence
id: check_composer
uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.0
with:
files: apps/${{ env.APP_NAME }}/composer.json
- name: Set up dependencies
# Only run if phpunit config file exists
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: |
composer remove nextcloud/ocp --dev --no-scripts
composer install --no-dev
composer --working-dir=vendor-bin/behat install
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
sudo echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts
mkdir data
./occ maintenance:install \
--verbose \
--database=pgsql \
--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
./occ --version
# CI-only: use fast password hashing for disposable Behat users.
./occ config:system:set hashing_default_password --value=true --type=boolean
./occ config:system:set hashingCost --value=4 --type=integer
./occ app:enable --force ${{ env.APP_NAME }}
git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/notifications apps/notifications
composer --working-dir=apps/notifications install --no-dev
./occ app:enable --force notifications
git clone --depth 1 -b ${{ matrix.server-versions == 'master' && 'main' || matrix.server-versions }} https://github.com/nextcloud/activity apps/activity
composer --working-dir=apps/activity install --no-dev
./occ app:enable --force activity
git clone --depth 1 -b main https://github.com/nextcloud/guests apps/guests
composer --working-dir=apps/guests install --no-dev
./occ app:enable --force guests
./occ config:system:set allow_local_remote_servers --value true --type boolean
./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean
./occ config:system:set mail_smtphost --value mailpit
./occ config:system:set mail_smtpport --value 1025 --type integer
./occ config:system:set ratelimit.protection.enabled --value false --type boolean
./occ config:app:set dav enableDefaultContact --value false --type boolean
- name: Run behat
working-directory: apps/${{ env.APP_NAME }}
env:
BEHAT_ROOT_DIR: ${{ github.workspace }}
SHARD_INDEX: ${{ matrix.shard }}
SHARD_TOTAL: '4'
run: |
export BEHAT_RUN_AS=runner
export BEHAT_VERBOSE="$RUNNER_DEBUG"
vendor-bin/behat/vendor/bin/behat --profile=ci --colors
- name: Print logs
if: always()
run: |
cat data/nextcloud.log
- name: List PHP core dumps
if: failure() && runner.debug == '1'
run: |
sudo coredumpctl --no-pager list || true
- name: Upload PHP server diagnostics
if: failure() && runner.debug == '1'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: behat-pgsql-server-diagnostics-php${{ matrix.php-versions }}-nc${{ matrix.server-versions }}-shard-${{ matrix.shard }}
path: /tmp/behat-php-server-*
if-no-files-found: ignore
summary:
permissions:
contents: none
runs-on: ubuntu-latest
needs: [changes, behat-pgsql]
if: always()
name: behat-pgsql-summary
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.behat-pgsql.result != 'success' }}; then exit 1; fi