Skip to content

Commit fbd6949

Browse files
Merge pull request #289 from nextcloud/chore/noid/update-workflows
chore: update workflows
2 parents 08f19ba + 5c53b1a commit fbd6949

5 files changed

Lines changed: 105 additions & 47 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Block merge to EOL
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: block-merge-eol-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
block-eol:
22+
name: Block merge to EOL
23+
runs-on: ubuntu-latest-low
24+
steps:
25+
- name: Parse base branch version
26+
id: parse
27+
run: |
28+
branch="${{ github.base_ref }}"
29+
if [[ $branch =~ ^stable([0-9]+)$ ]]; then
30+
echo "major=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
31+
else
32+
echo "skip=true" >> $GITHUB_OUTPUT
33+
fi
34+
35+
- name: Get current date
36+
if: ${{ !steps.parse.outputs.skip }}
37+
id: date
38+
run: echo "date=$(date -u +'%Y-%m-%d')" >> $GITHUB_OUTPUT
39+
40+
- name: Fetch EOL data
41+
if: ${{ !steps.parse.outputs.skip }}
42+
id: eol
43+
run: |
44+
data=$(curl -s https://raw.githubusercontent.com/nextcloud-releases/updater_server/production/config/major_versions.json)
45+
eol=$(echo "$data" | jq -r ".[] | select(.majorVersion == ${{ steps.parse.outputs.major }}) | .eol")
46+
echo "eol=$eol" >> $GITHUB_OUTPUT
47+
48+
- name: Check EOL date
49+
if: ${{ !steps.parse.outputs.skip }}
50+
run: |
51+
eol_date="${{ steps.eol.outputs.eol }}"
52+
current_date="${{ steps.date.outputs.date }}"
53+
if [[ "$eol_date" != "" && "$eol_date" != "null" ]]; then
54+
if [[ "$eol_date" < "$current_date" || "$eol_date" == "$current_date" ]]; then
55+
echo "This branch is EOL (End-of-Life) since $eol_date"
56+
exit 1
57+
fi
58+
fi

.github/workflows/fixup.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,19 @@ on:
1414

1515
permissions:
1616
contents: read
17+
pull-requests: write
1718

1819
concurrency:
1920
group: fixup-${{ github.head_ref || github.run_id }}
2021
cancel-in-progress: true
2122

2223
jobs:
23-
commit-message-check:
24-
if: github.event.pull_request.draft == false
25-
26-
permissions:
27-
pull-requests: write
28-
name: Block fixup and squash commits
29-
24+
block-fixup-merge:
3025
runs-on: ubuntu-latest-low
31-
26+
if: ${{ !github.event.pull_request.draft }}
27+
name: block-fixup-merge
3228
steps:
33-
- name: Run check
29+
- name: Block fixup and squash commits
3430
uses: skjnldsv/block-fixup-merge-action@c138ea99e45e186567b64cf065ce90f7158c236a # v2
3531
with:
3632
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint-info-xml.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
6-
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
6+
# SPDX-FileCopyrightText: 2021-2026 Nextcloud GmbH and Nextcloud contributors
77
# SPDX-License-Identifier: MIT
88

99
name: Lint info.xml
@@ -24,7 +24,9 @@ jobs:
2424
name: info.xml lint
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
28+
with:
29+
persist-credentials: false
2830

2931
- name: Download schema
3032
run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
77
# SPDX-License-Identifier: MIT
88

9-
name: Lint php-cs
9+
name: Lint code style
1010

1111
on: pull_request
1212

@@ -20,29 +20,29 @@ concurrency:
2020
jobs:
2121
lint:
2222
runs-on: ubuntu-latest
23-
24-
name: php-cs
25-
23+
name: lint
2624
steps:
2725
- name: Checkout
28-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27+
with:
28+
persist-credentials: false
2929

3030
- name: Get php version
3131
id: versions
32-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
32+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3333

34-
- name: Set up php${{ steps.versions.outputs.php-available }}
35-
uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0
34+
- name: Set up php${{ steps.versions.outputs.php-min }}
35+
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
3636
with:
37-
php-version: ${{ steps.versions.outputs.php-available }}
37+
php-version: ${{ steps.versions.outputs.php-min }}
3838
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
3939
coverage: none
4040
ini-file: development
4141
env:
4242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4343

44-
- name: Install dependencies
45-
run: composer i
44+
- name: Install nextcloud/ocp
45+
run: composer remove nextcloud/ocp --dev && composer i
4646

47-
- name: Lint
48-
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )
47+
- name: Check code style
48+
run: composer run cs:check || composer run cs:fix && git diff --exit-code

.github/workflows/lint-php.yml

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,48 @@
66
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
77
# SPDX-License-Identifier: MIT
88

9-
name: Lint php
9+
name: Lint
1010

1111
on: pull_request
1212

1313
permissions:
1414
contents: read
1515

1616
concurrency:
17-
group: lint-php-${{ github.head_ref || github.run_id }}
17+
group: lint-${{ github.head_ref || github.run_id }}
1818
cancel-in-progress: true
1919

2020
jobs:
2121
matrix:
2222
runs-on: ubuntu-latest-low
23+
name: Determine PHP version
2324
outputs:
2425
php-versions: ${{ steps.versions.outputs.php-versions }}
2526
steps:
26-
- name: Checkout app
27-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
28-
- name: Get version matrix
27+
- name: Checkout
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29+
with:
30+
persist-credentials: false
31+
32+
- name: Get PHP version
2933
id: versions
30-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0
34+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3135

32-
php-lint:
36+
lint:
3337
runs-on: ubuntu-latest
3438
needs: matrix
3539
strategy:
3640
matrix:
37-
php-versions: ${{fromJson(needs.matrix.outputs.php-versions)}}
38-
39-
name: php-lint
40-
41+
php-versions: ${{ fromJson(needs.matrix.outputs.php-versions) }}
42+
name: PHP-${{ matrix.php-versions }}
4143
steps:
4244
- name: Checkout
43-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
45+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
46+
with:
47+
persist-credentials: false
4448

45-
- name: Set up php ${{ matrix.php-versions }}
46-
uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0
49+
- name: Set up php${{ matrix.php-versions }}
50+
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
4751
with:
4852
php-version: ${{ matrix.php-versions }}
4953
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
@@ -52,19 +56,17 @@ jobs:
5256
env:
5357
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5458

59+
- name: Install dependencies
60+
run: composer i
61+
5562
- name: Lint
5663
run: composer run lint
5764

5865
summary:
59-
permissions:
60-
contents: none
6166
runs-on: ubuntu-latest-low
62-
needs: php-lint
63-
67+
needs: lint
6468
if: always()
65-
66-
name: php-lint-summary
67-
69+
name: Lint summary
6870
steps:
69-
- name: Summary status
70-
run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi
71+
- name: Check lint status
72+
run: if [ "${{ needs.lint.result }}" != "success" ]; then exit 1; fi

0 commit comments

Comments
 (0)