Skip to content

Commit e6e8448

Browse files
authored
Merge pull request #787 from nextcloud/fix/noid/reduce-duplicated-jobs
fix: Combine changes and matrix jobs
2 parents 6739f64 + b1039df commit e6e8448

5 files changed

Lines changed: 103 additions & 113 deletions

File tree

‎workflow-templates/phpunit-mariadb.yml‎

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,16 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21-
matrix:
22-
runs-on: ubuntu-latest-low
23-
outputs:
24-
php-version: ${{ steps.versions.outputs.php-available-list }}
25-
server-max: ${{ steps.versions.outputs.branches-max-list }}
26-
steps:
27-
- name: Checkout app
28-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
29-
with:
30-
persist-credentials: false
31-
32-
- name: Get version matrix
33-
id: versions
34-
uses: nextcloud-libraries/nextcloud-version-matrix@cd0211ffcef1065e2020cd579e4843b8746e7a58 # v1.3.3
35-
36-
changes:
21+
changes-and-matrix:
3722
runs-on: ubuntu-latest-low
3823
permissions:
3924
contents: read
4025
pull-requests: read
4126

4227
outputs:
43-
src: ${{ steps.changes.outputs.src}}
28+
src: ${{ steps.changes.outputs.src }}
29+
php-version: ${{ steps.versions.outputs.php-available-list }}
30+
server-max: ${{ steps.versions.outputs.branches-max-list }}
4431

4532
steps:
4633
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
@@ -60,17 +47,28 @@ jobs:
6047
- 'composer.json'
6148
- 'composer.lock'
6249
50+
- name: Checkout app
51+
if: steps.changes.outputs.src != 'false'
52+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
53+
with:
54+
persist-credentials: false
55+
56+
- name: Get version matrix
57+
if: steps.changes.outputs.src != 'false'
58+
id: versions
59+
uses: nextcloud-libraries/nextcloud-version-matrix@cd0211ffcef1065e2020cd579e4843b8746e7a58 # v1.3.3
60+
6361
phpunit-mariadb:
6462
runs-on: ubuntu-latest
6563

66-
needs: [changes, matrix]
67-
if: needs.changes.outputs.src != 'false'
64+
needs: changes-and-matrix
65+
if: needs.changes-and-matrix.outputs.src != 'false'
6866

6967
strategy:
7068
fail-fast: false
7169
matrix:
72-
php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
73-
server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
70+
php-versions: ${{ fromJson(needs.changes-and-matrix.outputs.php-version) }}
71+
server-versions: ${{ fromJson(needs.changes-and-matrix.outputs.server-max) }}
7472
mariadb-versions: ['10.6', '11.4']
7573

7674
name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
@@ -196,12 +194,12 @@ jobs:
196194
permissions:
197195
contents: none
198196
runs-on: ubuntu-latest-low
199-
needs: [changes, phpunit-mariadb]
197+
needs: [changes-and-matrix, phpunit-mariadb]
200198

201199
if: always()
202200

203201
name: phpunit-mariadb-summary
204202

205203
steps:
206204
- name: Summary status
207-
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mariadb.result != 'success' }}; then exit 1; fi
205+
run: if ${{ needs.changes-and-matrix.outputs.src != 'false' && needs.phpunit-mariadb.result != 'success' }}; then exit 1; fi

‎workflow-templates/phpunit-mysql.yml‎

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,15 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21-
matrix:
22-
runs-on: ubuntu-latest-low
23-
outputs:
24-
matrix: ${{ steps.versions.outputs.sparse-matrix }}
25-
steps:
26-
- name: Checkout app
27-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28-
with:
29-
persist-credentials: false
30-
31-
- name: Get version matrix
32-
id: versions
33-
uses: nextcloud-libraries/nextcloud-version-matrix@cd0211ffcef1065e2020cd579e4843b8746e7a58 # v1.3.3
34-
with:
35-
matrix: '{"mysql-versions": ["8.4"]}'
36-
37-
changes:
21+
changes-and-matrix:
3822
runs-on: ubuntu-latest-low
3923
permissions:
4024
contents: read
4125
pull-requests: read
4226

4327
outputs:
44-
src: ${{ steps.changes.outputs.src}}
28+
src: ${{ steps.changes.outputs.src }}
29+
matrix: ${{ steps.versions.outputs.sparse-matrix }}
4530

4631
steps:
4732
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
@@ -61,15 +46,28 @@ jobs:
6146
- 'composer.json'
6247
- 'composer.lock'
6348
49+
- name: Checkout app
50+
if: steps.changes.outputs.src != 'false'
51+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
52+
with:
53+
persist-credentials: false
54+
55+
- name: Get version matrix
56+
if: steps.changes.outputs.src != 'false'
57+
id: versions
58+
uses: nextcloud-libraries/nextcloud-version-matrix@cd0211ffcef1065e2020cd579e4843b8746e7a58 # v1.3.3
59+
with:
60+
matrix: '{"mysql-versions": ["8.4"]}'
61+
6462
phpunit-mysql:
6563
runs-on: ubuntu-latest
6664

67-
needs: [changes, matrix]
68-
if: needs.changes.outputs.src != 'false'
65+
needs: changes-and-matrix
66+
if: needs.changes-and-matrix.outputs.src != 'false'
6967

7068
strategy:
7169
fail-fast: false
72-
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
70+
matrix: ${{ fromJson(needs.changes-and-matrix.outputs.matrix) }}
7371

7472
name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
7573

@@ -194,12 +192,12 @@ jobs:
194192
permissions:
195193
contents: none
196194
runs-on: ubuntu-latest-low
197-
needs: [changes, phpunit-mysql]
195+
needs: [changes-and-matrix, phpunit-mysql]
198196

199197
if: always()
200198

201199
name: phpunit-mysql-summary
202200

203201
steps:
204202
- name: Summary status
205-
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi
203+
run: if ${{ needs.changes-and-matrix.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi

‎workflow-templates/phpunit-oci.yml‎

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,16 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21-
matrix:
22-
runs-on: ubuntu-latest-low
23-
outputs:
24-
php-version: ${{ steps.versions.outputs.php-available-list }}
25-
server-max: ${{ steps.versions.outputs.branches-max-list }}
26-
steps:
27-
- name: Checkout app
28-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
29-
with:
30-
persist-credentials: false
31-
32-
- name: Get version matrix
33-
id: versions
34-
uses: nextcloud-libraries/nextcloud-version-matrix@cd0211ffcef1065e2020cd579e4843b8746e7a58 # v1.3.3
35-
36-
changes:
21+
changes-and-matrix:
3722
runs-on: ubuntu-latest-low
3823
permissions:
3924
contents: read
4025
pull-requests: read
4126

4227
outputs:
4328
src: ${{ steps.changes.outputs.src }}
29+
php-version: ${{ steps.versions.outputs.php-available-list }}
30+
server-max: ${{ steps.versions.outputs.branches-max-list }}
4431

4532
steps:
4633
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
@@ -60,17 +47,28 @@ jobs:
6047
- 'composer.json'
6148
- 'composer.lock'
6249
50+
- name: Checkout app
51+
if: steps.changes.outputs.src != 'false'
52+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
53+
with:
54+
persist-credentials: false
55+
56+
- name: Get version matrix
57+
if: steps.changes.outputs.src != 'false'
58+
id: versions
59+
uses: nextcloud-libraries/nextcloud-version-matrix@cd0211ffcef1065e2020cd579e4843b8746e7a58 # v1.3.3
60+
6361
phpunit-oci:
6462
runs-on: ubuntu-latest
6563

66-
needs: [changes, matrix]
67-
if: needs.changes.outputs.src != 'false'
64+
needs: changes-and-matrix
65+
if: needs.changes-and-matrix.outputs.src != 'false'
6866

6967
strategy:
7068
fail-fast: false
7169
matrix:
72-
php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
73-
server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
70+
php-versions: ${{ fromJson(needs.changes-and-matrix.outputs.php-version) }}
71+
server-versions: ${{ fromJson(needs.changes-and-matrix.outputs.server-max) }}
7472
oci-versions: ['18', '21', '23']
7573

7674
name: OCI ${{ matrix.oci-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
@@ -201,12 +199,12 @@ jobs:
201199
permissions:
202200
contents: none
203201
runs-on: ubuntu-latest-low
204-
needs: [changes, phpunit-oci]
202+
needs: [changes-and-matrix, phpunit-oci]
205203

206204
if: always()
207205

208206
name: phpunit-oci-summary
209207

210208
steps:
211209
- name: Summary status
212-
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-oci.result != 'success' }}; then exit 1; fi
210+
run: if ${{ needs.changes-and-matrix.outputs.src != 'false' && needs.phpunit-oci.result != 'success' }}; then exit 1; fi

‎workflow-templates/phpunit-pgsql.yml‎

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,16 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21-
matrix:
22-
runs-on: ubuntu-latest-low
23-
outputs:
24-
php-version: ${{ steps.versions.outputs.php-available-list }}
25-
server-max: ${{ steps.versions.outputs.branches-max-list }}
26-
steps:
27-
- name: Checkout app
28-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
29-
with:
30-
persist-credentials: false
31-
32-
- name: Get version matrix
33-
id: versions
34-
uses: nextcloud-libraries/nextcloud-version-matrix@cd0211ffcef1065e2020cd579e4843b8746e7a58 # v1.3.3
35-
36-
changes:
21+
changes-and-matrix:
3722
runs-on: ubuntu-latest-low
3823
permissions:
3924
contents: read
4025
pull-requests: read
4126

4227
outputs:
4328
src: ${{ steps.changes.outputs.src }}
29+
php-version: ${{ steps.versions.outputs.php-available-list }}
30+
server-max: ${{ steps.versions.outputs.branches-max-list }}
4431

4532
steps:
4633
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
@@ -60,17 +47,28 @@ jobs:
6047
- 'composer.json'
6148
- 'composer.lock'
6249
50+
- name: Checkout app
51+
if: steps.changes.outputs.src != 'false'
52+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
53+
with:
54+
persist-credentials: false
55+
56+
- name: Get version matrix
57+
if: steps.changes.outputs.src != 'false'
58+
id: versions
59+
uses: nextcloud-libraries/nextcloud-version-matrix@cd0211ffcef1065e2020cd579e4843b8746e7a58 # v1.3.3
60+
6361
phpunit-pgsql:
6462
runs-on: ubuntu-latest
6563

66-
needs: [changes, matrix]
67-
if: needs.changes.outputs.src != 'false'
64+
needs: changes-and-matrix
65+
if: needs.changes-and-matrix.outputs.src != 'false'
6866

6967
strategy:
7068
fail-fast: false
7169
matrix:
72-
php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
73-
server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
70+
php-versions: ${{ fromJson(needs.changes-and-matrix.outputs.php-version) }}
71+
server-versions: ${{ fromJson(needs.changes-and-matrix.outputs.server-max) }}
7472

7573
name: PostgreSQL PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
7674

@@ -192,12 +190,12 @@ jobs:
192190
permissions:
193191
contents: none
194192
runs-on: ubuntu-latest-low
195-
needs: [changes, phpunit-pgsql]
193+
needs: [changes-and-matrix, phpunit-pgsql]
196194

197195
if: always()
198196

199197
name: phpunit-pgsql-summary
200198

201199
steps:
202200
- name: Summary status
203-
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi
201+
run: if ${{ needs.changes-and-matrix.outputs.src != 'false' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi

0 commit comments

Comments
 (0)