Skip to content

Commit ef55390

Browse files
authored
Merge pull request #767 from nextcloud/chore/noid/workflow-update-29
[stable29] chore: update workflows
2 parents 2b4b172 + 95dc8af commit ef55390

15 files changed

+264
-88
lines changed

.github/workflows/block-merge-freeze.yml

+25-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#
33
# https://github.com/nextcloud/.github
44
# 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
58

69
name: Block merges during freezes
710

@@ -26,11 +29,29 @@ jobs:
2629

2730
steps:
2831
- name: Register server reference to fallback to master branch
29-
run: |
30-
server_ref="$(if [ "${{ github.base_ref }}" = "main" ]; then echo -n "master"; else echo -n "${{ github.base_ref }}"; fi)"
31-
echo "server_ref=$server_ref" >> $GITHUB_ENV
32+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
33+
with:
34+
github-token: ${{secrets.GITHUB_TOKEN}}
35+
script: |
36+
const baseRef = context.payload.pull_request.base.ref
37+
if (baseRef === 'main' || baseRef === 'master') {
38+
core.exportVariable('server_ref', 'master');
39+
console.log('Setting server_ref to master');
40+
} else {
41+
const regex = /^stable(\d+)$/
42+
const match = baseRef.match(regex)
43+
if (match) {
44+
core.exportVariable('server_ref', match[0]);
45+
console.log('Setting server_ref to ' + match[0]);
46+
} else {
47+
console.log('Not based on master/main/stable*, so skipping freeze check');
48+
}
49+
}
50+
3251
- name: Download version.php from ${{ env.server_ref }}
33-
run: curl https://raw.githubusercontent.com/nextcloud/server/${{ env.server_ref }}/version.php --output version.php
52+
if: ${{ env.server_ref != '' }}
53+
run: curl 'https://raw.githubusercontent.com/nextcloud/server/${{ env.server_ref }}/version.php' --output version.php
3454

3555
- name: Run check
56+
if: ${{ env.server_ref != '' }}
3657
run: cat version.php | grep 'OC_VersionString' | grep -i -v 'RC'

.github/workflows/dependabot-approve-merge.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
#
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
58

69
name: Dependabot
710

811
on:
9-
pull_request_target:
12+
pull_request_target: # zizmor: ignore[dangerous-triggers]
1013
branches:
1114
- main
1215
- master
@@ -21,14 +24,20 @@ concurrency:
2124

2225
jobs:
2326
auto-approve-merge:
24-
if: github.actor == 'dependabot[bot]'
27+
if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]'
2528
runs-on: ubuntu-latest-low
2629
permissions:
2730
# for hmarr/auto-approve-action to approve PRs
2831
pull-requests: write
2932

3033
steps:
31-
# Github actions bot approve
34+
- name: Disabled on forks
35+
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
36+
run: |
37+
echo 'Can not approve PRs from forks'
38+
exit 1
39+
40+
# GitHub actions bot approve
3241
- uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2
3342
with:
3443
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/fixup.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
58

69
name: Block fixup and squash commits
710

@@ -28,6 +31,6 @@ jobs:
2831

2932
steps:
3033
- name: Run check
31-
uses: skjnldsv/block-fixup-merge-action@42d26e1b536ce61e5cf467d65fb76caf4aa85acf # v1
34+
uses: skjnldsv/block-fixup-merge-action@c138ea99e45e186567b64cf065ce90f7158c236a # v2
3235
with:
3336
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint-php-cs.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
58

69
name: Lint php-cs
710

@@ -22,24 +25,28 @@ jobs:
2225

2326
steps:
2427
- name: Checkout
25-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
with:
30+
persist-credentials: false
2631

2732
- name: Get php version
2833
id: versions
2934
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
3035

31-
- name: Set up php${{ steps.versions.outputs.php-available }}
32-
uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2
36+
- name: Set up php${{ steps.versions.outputs.php-min }}
37+
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
3338
with:
34-
php-version: ${{ steps.versions.outputs.php-available }}
39+
php-version: ${{ steps.versions.outputs.php-min }}
3540
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
3641
coverage: none
3742
ini-file: development
3843
env:
3944
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4045

4146
- name: Install dependencies
42-
run: composer i
47+
run: |
48+
composer remove nextcloud/ocp --dev
49+
composer i
4350
4451
- name: Lint
4552
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

.github/workflows/lint-php.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
58

69
name: Lint php
710

@@ -21,7 +24,10 @@ jobs:
2124
php-versions: ${{ steps.versions.outputs.php-versions }}
2225
steps:
2326
- name: Checkout app
24-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
persist-credentials: false
30+
2531
- name: Get version matrix
2632
id: versions
2733
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0
@@ -37,10 +43,12 @@ jobs:
3743

3844
steps:
3945
- name: Checkout
40-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
46+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47+
with:
48+
persist-credentials: false
4149

4250
- name: Set up php ${{ matrix.php-versions }}
43-
uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2
51+
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
4452
with:
4553
php-version: ${{ matrix.php-versions }}
4654
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite

.github/workflows/phpunit-mariadb.yml

+27-12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
58

69
name: PHPUnit MariaDB
710

@@ -22,14 +25,19 @@ jobs:
2225
server-max: ${{ steps.versions.outputs.branches-max-list }}
2326
steps:
2427
- name: Checkout app
25-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
with:
30+
persist-credentials: false
2631

2732
- name: Get version matrix
2833
id: versions
2934
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
3035

3136
changes:
3237
runs-on: ubuntu-latest-low
38+
permissions:
39+
contents: read
40+
pull-requests: read
3341

3442
outputs:
3543
src: ${{ steps.changes.outputs.src}}
@@ -62,7 +70,7 @@ jobs:
6270
matrix:
6371
php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
6472
server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
65-
mariadb-versions: ['10.6', '10.11']
73+
mariadb-versions: ['10.6', '11.4']
6674

6775
name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
6876

@@ -72,54 +80,61 @@ jobs:
7280
ports:
7381
- 4444:3306/tcp
7482
env:
75-
MYSQL_ROOT_PASSWORD: rootpassword
76-
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
83+
MARIADB_ROOT_PASSWORD: rootpassword
84+
options: --health-cmd="mariadb-admin ping" --health-interval 5s --health-timeout 2s --health-retries 5
7785

7886
steps:
7987
- name: Set app env
88+
if: ${{ env.APP_NAME == '' }}
8089
run: |
8190
# Split and keep last
8291
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
8392
8493
- name: Checkout server
85-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
94+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8695
with:
96+
persist-credentials: false
8797
submodules: true
8898
repository: nextcloud/server
8999
ref: ${{ matrix.server-versions }}
90100

91101
- name: Checkout app
92-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
102+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
93103
with:
104+
persist-credentials: false
94105
path: apps/${{ env.APP_NAME }}
95106

96107
- name: Set up php ${{ matrix.php-versions }}
97-
uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2
108+
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
98109
with:
99110
php-version: ${{ matrix.php-versions }}
100111
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
101112
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql
102113
coverage: none
103114
ini-file: development
115+
# Temporary workaround for missing pcntl_* in PHP 8.3
116+
ini-values: disable_functions=
104117
env:
105118
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106119

107120
- name: Enable ONLY_FULL_GROUP_BY MariaDB option
108121
run: |
109122
echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
110-
echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
123+
echo 'SELECT @@sql_mode;' | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
111124
112125
- name: Check composer file existence
113126
id: check_composer
114-
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
127+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
115128
with:
116129
files: apps/${{ env.APP_NAME }}/composer.json
117130

118131
- name: Set up dependencies
119132
# Only run if phpunit config file exists
120133
if: steps.check_composer.outputs.files_exists == 'true'
121134
working-directory: apps/${{ env.APP_NAME }}
122-
run: composer i
135+
run: |
136+
composer remove nextcloud/ocp --dev
137+
composer i
123138
124139
- name: Set up Nextcloud
125140
env:
@@ -134,7 +149,7 @@ jobs:
134149
continue-on-error: true
135150
working-directory: apps/${{ env.APP_NAME }}
136151
run: |
137-
composer run --list | grep "^ test:unit " | wc -l | grep 1
152+
composer run --list | grep '^ test:unit ' | wc -l | grep 1
138153
139154
- name: PHPUnit
140155
# Only run if phpunit config file exists
@@ -147,7 +162,7 @@ jobs:
147162
continue-on-error: true
148163
working-directory: apps/${{ env.APP_NAME }}
149164
run: |
150-
composer run --list | grep "^ test:integration " | wc -l | grep 1
165+
composer run --list | grep '^ test:integration ' | wc -l | grep 1
151166
152167
- name: Run Nextcloud
153168
# Only run if phpunit integration config file exists

0 commit comments

Comments
 (0)