Skip to content

Commit 6996b23

Browse files
nickvergessenartonge
authored andcommitted
chore(CI): Update master php testing versions and workflow templates
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent cdba2b7 commit 6996b23

14 files changed

Lines changed: 158 additions & 101 deletions

.github/workflows/command-compile.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

5555
steps:
5656
- name: Checkout ${{ needs.init.outputs.head_ref }}
57-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
57+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
5858
with:
5959
token: ${{ secrets.COMMAND_BOT_PAT }}
6060
fetch-depth: 0
@@ -69,8 +69,8 @@ jobs:
6969
uses: skjnldsv/read-package-engines-version-actions@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2
7070
id: package-engines-versions
7171
with:
72-
fallbackNode: '^12'
73-
fallbackNpm: '^6'
72+
fallbackNode: '^16'
73+
fallbackNpm: '^7'
7474

7575
- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
7676
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3

.github/workflows/command-rebase.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
reaction-type: "+1"
3232

3333
- name: Checkout the latest code
34-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
34+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
3535
with:
3636
fetch-depth: 0
3737
token: ${{ secrets.COMMAND_BOT_PAT }}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
name: info.xml lint
2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
30+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
3131

3232
- name: Download schema
3333
run: wget https://raw.githubusercontent.com/nextcloud/server/master/resources/app-info-shipped.xsd
@@ -37,3 +37,4 @@ jobs:
3737
with:
3838
xml-file: ./appinfo/info.xml
3939
xml-schema-file: ./app-info-shipped.xsd
40+

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
25+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
2626

2727
- name: Set up php
2828
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2

.github/workflows/lint-php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
steps:
3333
- name: Checkout
34-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
34+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
3535

3636
- name: Set up php ${{ matrix.php-versions }}
3737
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
# Use node together with node-when-unrelated to make eslint a required check for GitHub actions
7+
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
8+
9+
name: Node
10+
11+
on:
12+
pull_request:
13+
paths-ignore:
14+
- '.github/workflows/**'
15+
- 'src/**'
16+
- 'appinfo/info.xml'
17+
- 'package.json'
18+
- 'package-lock.json'
19+
- 'tsconfig.json'
20+
- '**.js'
21+
- '**.ts'
22+
- '**.vue'
23+
push:
24+
branches:
25+
- main
26+
- master
27+
- stable*
28+
29+
concurrency:
30+
group: node-${{ github.head_ref || github.run_id }}
31+
cancel-in-progress: true
32+
33+
jobs:
34+
build:
35+
permissions:
36+
contents: none
37+
38+
runs-on: ubuntu-latest
39+
40+
name: node
41+
steps:
42+
- name: Skip
43+
run: 'echo "No JS/TS files changed, skipped Node"'

.github/workflows/node.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ jobs:
3737
name: node
3838
steps:
3939
- name: Checkout
40-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
40+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
4141

4242
- name: Read package.json node and npm engines version
4343
uses: skjnldsv/read-package-engines-version-actions@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2
4444
id: versions
4545
with:
46-
fallbackNode: '^12'
47-
fallbackNpm: '^6'
46+
fallbackNode: '^16'
47+
fallbackNpm: '^7'
4848

4949
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
5050
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3

.github/workflows/phpunit-mysql.yml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ concurrency:
3232
group: phpunit-mysql-${{ github.head_ref || github.run_id }}
3333
cancel-in-progress: true
3434

35-
env:
36-
# Location of the phpunit.xml and phpunit.integration.xml files
37-
PHPUNIT_CONFIG: ./tests/phpunit.xml
38-
PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
39-
4035
jobs:
4136
phpunit-mysql:
4237
runs-on: ubuntu-latest
@@ -67,22 +62,21 @@ jobs:
6762
echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
6863
6964
- name: Checkout server
70-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
65+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
7166
with:
7267
submodules: true
7368
repository: nextcloud/server
7469
ref: ${{ matrix.server-versions }}
7570

7671
- name: Checkout app
77-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
72+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
7873
with:
7974
path: apps/${{ env.APP_NAME }}
8075

8176
- name: Set up php ${{ matrix.php-versions }}
8277
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2
8378
with:
8479
php-version: ${{ matrix.php-versions }}
85-
tools: phpunit
8680
extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql
8781
coverage: none
8882
env:
@@ -94,7 +88,7 @@ jobs:
9488
with:
9589
files: apps/${{ env.APP_NAME }}/composer.json
9690

97-
- name: Set up PHPUnit
91+
- name: Set up dependencies
9892
# Only run if phpunit config file exists
9993
if: steps.check_composer.outputs.files_exists == 'true'
10094
working-directory: apps/${{ env.APP_NAME }}
@@ -108,34 +102,43 @@ jobs:
108102
./occ maintenance:install --verbose --database=mysql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
109103
./occ app:enable --force ${{ env.APP_NAME }}
110104
111-
- name: Check PHPUnit config file existence
105+
- name: Check PHPUnit script is defined
112106
id: check_phpunit
113-
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
114-
with:
115-
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
107+
continue-on-error: true
108+
working-directory: apps/${{ env.APP_NAME }}
109+
run: |
110+
composer run --list | grep "^ test:unit " | wc -l | grep 1
116111
117112
- name: PHPUnit
118113
# Only run if phpunit config file exists
119-
if: steps.check_phpunit.outputs.files_exists == 'true'
114+
if: steps.check_phpunit.outcome == 'success'
120115
working-directory: apps/${{ env.APP_NAME }}
121-
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
116+
run: composer run test:unit
122117

123-
- name: Check PHPUnit integration config file existence
118+
- name: Check PHPUnit integration script is defined
124119
id: check_integration
125-
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
126-
with:
127-
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
120+
continue-on-error: true
121+
working-directory: apps/${{ env.APP_NAME }}
122+
run: |
123+
composer run --list | grep "^ test:integration " | wc -l | grep 1
128124
129125
- name: Run Nextcloud
130126
# Only run if phpunit integration config file exists
131-
if: steps.check_integration.outputs.files_exists == 'true'
127+
if: steps.check_integration.outcome == 'success'
132128
run: php -S localhost:8080 &
133129

134130
- name: PHPUnit integration
135131
# Only run if phpunit integration config file exists
136-
if: steps.check_integration.outputs.files_exists == 'true'
132+
if: steps.check_integration.outcome == 'success'
137133
working-directory: apps/${{ env.APP_NAME }}
138-
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
134+
run: composer run test:integration
135+
136+
- name: Skipped
137+
# Fail the action when neither unit nor integration tests ran
138+
if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
139+
run: |
140+
echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
141+
exit 1
139142
140143
summary:
141144
permissions:

.github/workflows/phpunit-oci.yml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ concurrency:
3232
group: phpunit-oci-${{ github.head_ref || github.run_id }}
3333
cancel-in-progress: true
3434

35-
env:
36-
# Location of the phpunit.xml and phpunit.integration.xml files
37-
PHPUNIT_CONFIG: ./tests/phpunit.xml
38-
PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
39-
4035
jobs:
4136
phpunit-oci:
4237
runs-on: ubuntu-latest
@@ -59,14 +54,14 @@ jobs:
5954
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
6055
6156
- name: Checkout server
62-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
57+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
6358
with:
6459
submodules: true
6560
repository: nextcloud/server
6661
ref: ${{ matrix.server-versions }}
6762

6863
- name: Checkout app
69-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
64+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
7065
with:
7166
path: apps/${{ env.APP_NAME }}
7267

@@ -75,7 +70,6 @@ jobs:
7570
with:
7671
php-version: ${{ matrix.php-versions }}
7772
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, oci8
78-
tools: phpunit
7973
coverage: none
8074
env:
8175
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -86,7 +80,7 @@ jobs:
8680
with:
8781
files: apps/${{ env.APP_NAME }}/composer.json
8882

89-
- name: Set up PHPUnit
83+
- name: Set up dependencies
9084
# Only run if phpunit config file exists
9185
if: steps.check_composer.outputs.files_exists == 'true'
9286
working-directory: apps/${{ env.APP_NAME }}
@@ -100,34 +94,43 @@ jobs:
10094
./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin
10195
./occ app:enable --force ${{ env.APP_NAME }}
10296
103-
- name: Check PHPUnit config file existence
97+
- name: Check PHPUnit script is defined
10498
id: check_phpunit
105-
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
106-
with:
107-
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
99+
continue-on-error: true
100+
working-directory: apps/${{ env.APP_NAME }}
101+
run: |
102+
composer run --list | grep "^ test:unit " | wc -l | grep 1
108103
109104
- name: PHPUnit
110105
# Only run if phpunit config file exists
111-
if: steps.check_phpunit.outputs.files_exists == 'true'
106+
if: steps.check_phpunit.outcome == 'success'
112107
working-directory: apps/${{ env.APP_NAME }}
113-
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
108+
run: composer run test:unit
114109

115-
- name: Check PHPUnit integration config file existence
110+
- name: Check PHPUnit integration script is defined
116111
id: check_integration
117-
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
118-
with:
119-
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
112+
continue-on-error: true
113+
working-directory: apps/${{ env.APP_NAME }}
114+
run: |
115+
composer run --list | grep "^ test:integration " | wc -l | grep 1
120116
121117
- name: Run Nextcloud
122118
# Only run if phpunit integration config file exists
123-
if: steps.check_integration.outputs.files_exists == 'true'
119+
if: steps.check_integration.outcome == 'success'
124120
run: php -S localhost:8080 &
125121

126122
- name: PHPUnit integration
127123
# Only run if phpunit integration config file exists
128-
if: steps.check_integration.outputs.files_exists == 'true'
124+
if: steps.check_integration.outcome == 'success'
129125
working-directory: apps/${{ env.APP_NAME }}
130-
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
126+
run: composer run test:integration
127+
128+
- name: Skipped
129+
# Fail the action when neither unit nor integration tests ran
130+
if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
131+
run: |
132+
echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
133+
exit 1
131134
132135
summary:
133136
permissions:

0 commit comments

Comments
 (0)