summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-01-16 16:00:00 +0100
committerJoas Schilling <coding@schilljs.com>2023-01-16 16:00:00 +0100
commitb20f90d7444ce0f8e156406a34fcc111f4420bce (patch)
tree78f766dbf629ac31ecadac4c2513c8b3e0d60b3f
parent5ba554c3f751ba8b8035c7fc8404ca6194d3c16a (diff)
chore(CI): Update master php testing versions and workflow templates
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--.github/workflows/appstore-build-publish.yml12
-rw-r--r--.github/workflows/lint-eslint-when-unrelated.yml39
-rw-r--r--.github/workflows/lint-eslint.yml11
-rw-r--r--.github/workflows/lint-info-xml.yml2
-rw-r--r--.github/workflows/lint-php-cs.yml2
-rw-r--r--.github/workflows/lint-php.yml2
-rw-r--r--.github/workflows/lint-stylelint.yml6
-rw-r--r--.github/workflows/node-when-unrelated.yml43
-rw-r--r--.github/workflows/node.yml6
-rw-r--r--.github/workflows/phpunit-mysql.yml46
-rw-r--r--.github/workflows/phpunit-oci.yml46
-rw-r--r--.github/workflows/phpunit-pgsql.yml46
-rw-r--r--.github/workflows/phpunit-sqlite.yml46
-rw-r--r--.github/workflows/psalm.yml2
-rw-r--r--.github/workflows/update-nextcloud-ocp.yml4
-rw-r--r--composer.json2
16 files changed, 209 insertions, 106 deletions
diff --git a/.github/workflows/appstore-build-publish.yml b/.github/workflows/appstore-build-publish.yml
index 9f61bcb4c..90453eb0c 100644
--- a/.github/workflows/appstore-build-publish.yml
+++ b/.github/workflows/appstore-build-publish.yml
@@ -32,7 +32,7 @@ jobs:
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Checkout
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
path: ${{ env.APP_NAME }}
@@ -50,8 +50,8 @@ jobs:
continue-on-error: true
with:
path: ${{ env.APP_NAME }}
- fallbackNode: "^12"
- fallbackNpm: "^6"
+ fallbackNode: "^16"
+ fallbackNpm: "^7"
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
# Skip if no package.json
@@ -102,8 +102,8 @@ jobs:
- name: Install Krankerl
if: steps.krankerl.outputs.files_exists == 'true'
run: |
- wget https://github.com/ChristophWurst/krankerl/releases/download/v0.13.0/krankerl_0.13.0_amd64.deb
- sudo dpkg -i krankerl_0.13.0_amd64.deb
+ wget https://github.com/ChristophWurst/krankerl/releases/download/v0.14.0/krankerl_0.14.0_amd64.deb
+ sudo dpkg -i krankerl_0.14.0_amd64.deb
- name: Package ${{ env.APP_NAME }} ${{ env.APP_VERSION }} with krankerl
if: steps.krankerl.outputs.files_exists == 'true'
@@ -126,7 +126,7 @@ jobs:
unzip latest-$NCVERSION.zip
- name: Checkout server master fallback
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
if: ${{ steps.server-checkout.outcome != 'success' }}
with:
repository: nextcloud/server
diff --git a/.github/workflows/lint-eslint-when-unrelated.yml b/.github/workflows/lint-eslint-when-unrelated.yml
new file mode 100644
index 000000000..63710eb66
--- /dev/null
+++ b/.github/workflows/lint-eslint-when-unrelated.yml
@@ -0,0 +1,39 @@
+# This workflow is provided via the organization template repository
+#
+# https://github.com/nextcloud/.github
+# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
+#
+# Use lint-eslint together with lint-eslint-when-unrelated to make eslint a required check for GitHub actions
+# 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
+
+name: Lint
+
+on:
+ pull_request:
+ paths-ignore:
+ - '.github/workflows/**'
+ - 'src/**'
+ - 'appinfo/info.xml'
+ - 'package.json'
+ - 'package-lock.json'
+ - 'tsconfig.json'
+ - '.eslintrc.*'
+ - '.eslintignore'
+ - '**.js'
+ - '**.ts'
+ - '**.vue'
+
+permissions:
+ contents: read
+
+jobs:
+ lint:
+ permissions:
+ contents: none
+
+ runs-on: ubuntu-latest
+
+ name: eslint
+
+ steps:
+ - run: 'echo "No eslint required"'
diff --git a/.github/workflows/lint-eslint.yml b/.github/workflows/lint-eslint.yml
index 80ec2445e..628e8fefa 100644
--- a/.github/workflows/lint-eslint.yml
+++ b/.github/workflows/lint-eslint.yml
@@ -2,6 +2,9 @@
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
+#
+# Use lint-eslint together with lint-eslint-when-unrelated to make eslint a required check for GitHub actions
+# 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
name: Lint
@@ -14,6 +17,8 @@ on:
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
+ - '.eslintrc.*'
+ - '.eslintignore'
- '**.js'
- '**.ts'
- '**.vue'
@@ -33,14 +38,14 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2
id: versions
with:
- fallbackNode: '^12'
- fallbackNpm: '^6'
+ fallbackNode: '^16'
+ fallbackNpm: '^7'
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
diff --git a/.github/workflows/lint-info-xml.yml b/.github/workflows/lint-info-xml.yml
index c5f57dd5e..8f024cfcb 100644
--- a/.github/workflows/lint-info-xml.yml
+++ b/.github/workflows/lint-info-xml.yml
@@ -27,7 +27,7 @@ jobs:
name: info.xml lint
steps:
- name: Checkout
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- name: Download schema
run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd
diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml
index 85cb03664..df490fb23 100644
--- a/.github/workflows/lint-php-cs.yml
+++ b/.github/workflows/lint-php-cs.yml
@@ -22,7 +22,7 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- name: Set up php
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2
diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml
index 5a7cbffb0..45bf08292 100644
--- a/.github/workflows/lint-php.yml
+++ b/.github/workflows/lint-php.yml
@@ -31,7 +31,7 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2
diff --git a/.github/workflows/lint-stylelint.yml b/.github/workflows/lint-stylelint.yml
index a035b1765..6cdf20cc9 100644
--- a/.github/workflows/lint-stylelint.yml
+++ b/.github/workflows/lint-stylelint.yml
@@ -22,14 +22,14 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2
id: versions
with:
- fallbackNode: '^12'
- fallbackNpm: '^6'
+ fallbackNode: '^16'
+ fallbackNpm: '^7'
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
diff --git a/.github/workflows/node-when-unrelated.yml b/.github/workflows/node-when-unrelated.yml
new file mode 100644
index 000000000..db32b0dba
--- /dev/null
+++ b/.github/workflows/node-when-unrelated.yml
@@ -0,0 +1,43 @@
+# This workflow is provided via the organization template repository
+#
+# https://github.com/nextcloud/.github
+# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
+#
+# Use node together with node-when-unrelated to make eslint a required check for GitHub actions
+# 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
+
+name: Node
+
+on:
+ pull_request:
+ paths-ignore:
+ - '.github/workflows/**'
+ - 'src/**'
+ - 'appinfo/info.xml'
+ - 'package.json'
+ - 'package-lock.json'
+ - 'tsconfig.json'
+ - '**.js'
+ - '**.ts'
+ - '**.vue'
+ push:
+ branches:
+ - main
+ - master
+ - stable*
+
+concurrency:
+ group: node-${{ github.head_ref || github.run_id }}
+ cancel-in-progress: true
+
+jobs:
+ build:
+ permissions:
+ contents: none
+
+ runs-on: ubuntu-latest
+
+ name: node
+ steps:
+ - name: Skip
+ run: 'echo "No JS/TS files changed, skipped Node"'
diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml
index f0db34e83..e3310644e 100644
--- a/.github/workflows/node.yml
+++ b/.github/workflows/node.yml
@@ -37,14 +37,14 @@ jobs:
name: node
steps:
- name: Checkout
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2
id: versions
with:
- fallbackNode: '^12'
- fallbackNpm: '^6'
+ fallbackNode: '^16'
+ fallbackNpm: '^7'
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml
index a30adf5b5..bf3aaa5c5 100644
--- a/.github/workflows/phpunit-mysql.yml
+++ b/.github/workflows/phpunit-mysql.yml
@@ -32,11 +32,6 @@ concurrency:
group: phpunit-mysql-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
-env:
- # Location of the phpunit.xml and phpunit.integration.xml files
- PHPUNIT_CONFIG: ./tests/php/phpunit.xml
- PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
-
jobs:
phpunit-mysql:
runs-on: ubuntu-latest
@@ -67,14 +62,14 @@ jobs:
echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
- name: Checkout server
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
path: apps/${{ env.APP_NAME }}
@@ -93,7 +88,7 @@ jobs:
with:
files: apps/${{ env.APP_NAME }}/composer.json
- - name: Set up PHPUnit
+ - 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 }}
@@ -107,34 +102,43 @@ jobs:
./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
./occ app:enable --force ${{ env.APP_NAME }}
- - name: Check PHPUnit config file existence
+ - name: Check PHPUnit script is defined
id: check_phpunit
- uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
- with:
- files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
+ continue-on-error: true
+ working-directory: apps/${{ env.APP_NAME }}
+ run: |
+ composer run --list | grep "^ test:unit " | wc -l | grep 1
- name: PHPUnit
# Only run if phpunit config file exists
- if: steps.check_phpunit.outputs.files_exists == 'true'
+ if: steps.check_phpunit.outcome == 'success'
working-directory: apps/${{ env.APP_NAME }}
- run: composer run test
+ run: composer run test:unit
- - name: Check PHPUnit integration config file existence
+ - name: Check PHPUnit integration script is defined
id: check_integration
- uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
- with:
- files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+ continue-on-error: true
+ working-directory: apps/${{ env.APP_NAME }}
+ run: |
+ composer run --list | grep "^ test:integration " | wc -l | grep 1
- name: Run Nextcloud
# Only run if phpunit integration config file exists
- if: steps.check_integration.outputs.files_exists == 'true'
+ if: steps.check_integration.outcome == 'success'
run: php -S localhost:8080 &
- name: PHPUnit integration
# Only run if phpunit integration config file exists
- if: steps.check_integration.outputs.files_exists == 'true'
+ if: steps.check_integration.outcome == 'success'
working-directory: apps/${{ env.APP_NAME }}
- run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+ run: composer run test:integration
+
+ - name: Skipped
+ # Fail the action when neither unit nor integration tests ran
+ if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
+ run: |
+ echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
+ exit 1
summary:
permissions:
diff --git a/.github/workflows/phpunit-oci.yml b/.github/workflows/phpunit-oci.yml
index 9750fbb1f..930d2c243 100644
--- a/.github/workflows/phpunit-oci.yml
+++ b/.github/workflows/phpunit-oci.yml
@@ -32,11 +32,6 @@ concurrency:
group: phpunit-oci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
-env:
- # Location of the phpunit.xml and phpunit.integration.xml files
- PHPUNIT_CONFIG: ./tests/php/phpunit.xml
- PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
-
jobs:
phpunit-oci:
runs-on: ubuntu-latest
@@ -59,14 +54,14 @@ jobs:
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
path: apps/${{ env.APP_NAME }}
@@ -85,7 +80,7 @@ jobs:
with:
files: apps/${{ env.APP_NAME }}/composer.json
- - name: Set up PHPUnit
+ - 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 }}
@@ -99,34 +94,43 @@ jobs:
./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
./occ app:enable --force ${{ env.APP_NAME }}
- - name: Check PHPUnit config file existence
+ - name: Check PHPUnit script is defined
id: check_phpunit
- uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
- with:
- files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
+ continue-on-error: true
+ working-directory: apps/${{ env.APP_NAME }}
+ run: |
+ composer run --list | grep "^ test:unit " | wc -l | grep 1
- name: PHPUnit
# Only run if phpunit config file exists
- if: steps.check_phpunit.outputs.files_exists == 'true'
+ if: steps.check_phpunit.outcome == 'success'
working-directory: apps/${{ env.APP_NAME }}
- run: composer run test
+ run: composer run test:unit
- - name: Check PHPUnit integration config file existence
+ - name: Check PHPUnit integration script is defined
id: check_integration
- uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
- with:
- files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+ continue-on-error: true
+ working-directory: apps/${{ env.APP_NAME }}
+ run: |
+ composer run --list | grep "^ test:integration " | wc -l | grep 1
- name: Run Nextcloud
# Only run if phpunit integration config file exists
- if: steps.check_integration.outputs.files_exists == 'true'
+ if: steps.check_integration.outcome == 'success'
run: php -S localhost:8080 &
- name: PHPUnit integration
# Only run if phpunit integration config file exists
- if: steps.check_integration.outputs.files_exists == 'true'
+ if: steps.check_integration.outcome == 'success'
working-directory: apps/${{ env.APP_NAME }}
- run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+ run: composer run test:integration
+
+ - name: Skipped
+ # Fail the action when neither unit nor integration tests ran
+ if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
+ run: |
+ echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
+ exit 1
summary:
permissions:
diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml
index ee80c6c76..8ec26389d 100644
--- a/.github/workflows/phpunit-pgsql.yml
+++ b/.github/workflows/phpunit-pgsql.yml
@@ -32,11 +32,6 @@ concurrency:
group: phpunit-pgsql-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
-env:
- # Location of the phpunit.xml and phpunit.integration.xml files
- PHPUNIT_CONFIG: ./tests/php/phpunit.xml
- PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
-
jobs:
phpunit-pgsql:
runs-on: ubuntu-latest
@@ -64,14 +59,14 @@ jobs:
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
path: apps/${{ env.APP_NAME }}
@@ -90,7 +85,7 @@ jobs:
with:
files: apps/${{ env.APP_NAME }}/composer.json
- - name: Set up PHPUnit
+ - 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 }}
@@ -104,34 +99,43 @@ jobs:
./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 password
./occ app:enable --force ${{ env.APP_NAME }}
- - name: Check PHPUnit config file existence
+ - name: Check PHPUnit script is defined
id: check_phpunit
- uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
- with:
- files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
+ continue-on-error: true
+ working-directory: apps/${{ env.APP_NAME }}
+ run: |
+ composer run --list | grep "^ test:unit " | wc -l | grep 1
- name: PHPUnit
# Only run if phpunit config file exists
- if: steps.check_phpunit.outputs.files_exists == 'true'
+ if: steps.check_phpunit.outcome == 'success'
working-directory: apps/${{ env.APP_NAME }}
- run: composer run test
+ run: composer run test:unit