diff --git a/.github/workflows/lint-eslint.yml b/.github/workflows/lint-eslint.yml
index 508d7139..74c5e9c8 100644
--- a/.github/workflows/lint-eslint.yml
+++ b/.github/workflows/lint-eslint.yml
@@ -3,25 +3,12 @@
# 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
+# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: MIT
name: Lint eslint
-on:
- pull_request:
- paths:
- - '.github/workflows/**'
- - 'src/**'
- - 'appinfo/info.xml'
- - 'package.json'
- - 'package-lock.json'
- - 'tsconfig.json'
- - '.eslintrc.*'
- - '.eslintignore'
- - '**.js'
- - '**.ts'
- - '**.vue'
+on: pull_request
permissions:
contents: read
@@ -31,32 +18,81 @@ concurrency:
cancel-in-progress: true
jobs:
+ changes:
+ runs-on: ubuntu-latest-low
+ permissions:
+ contents: read
+ pull-requests: read
+
+ outputs:
+ src: ${{ steps.changes.outputs.src}}
+
+ steps:
+ - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
+ id: changes
+ continue-on-error: true
+ with:
+ filters: |
+ src:
+ - '.github/workflows/**'
+ - 'src/**'
+ - 'appinfo/info.xml'
+ - 'package.json'
+ - 'package-lock.json'
+ - 'tsconfig.json'
+ - '.eslintrc.*'
+ - '.eslintignore'
+ - '**.js'
+ - '**.ts'
+ - '**.vue'
+
lint:
runs-on: ubuntu-latest
- name: eslint
+ needs: changes
+ if: needs.changes.outputs.src != 'false'
+
+ name: NPM lint
steps:
- name: Checkout
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Read package.json node and npm engines version
- uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
+ uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
id: versions
with:
- fallbackNode: '^16'
- fallbackNpm: '^7'
+ fallbackNode: '^20'
+ fallbackNpm: '^10'
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
+ uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
- run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
+ run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
- name: Install dependencies
+ env:
+ CYPRESS_INSTALL_BINARY: 0
+ PUPPETEER_SKIP_DOWNLOAD: true
run: npm ci
- name: Lint
run: npm run lint
+
+ summary:
+ permissions:
+ contents: none
+ runs-on: ubuntu-latest-low
+ needs: [changes, lint]
+
+ if: always()
+
+ # This is the summary, we just avoid to rename it so that branch protection rules still match
+ name: eslint
+
+ steps:
+ - name: Summary status
+ run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/lint-info-xml.yml b/.github/workflows/lint-info-xml.yml
index 9206b163..702f21c9 100644
--- a/.github/workflows/lint-info-xml.yml
+++ b/.github/workflows/lint-info-xml.yml
@@ -2,20 +2,19 @@
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
+#
+# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: MIT
name: Lint info.xml
on:
pull_request:
- paths:
- - 'appinfo/info.xml'
push:
branches:
- main
- master
- stable*
- paths:
- - 'appinfo/info.xml'
permissions:
contents: read
@@ -26,18 +25,18 @@ concurrency:
jobs:
xml-linters:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-latest-low
name: info.xml lint
steps:
- name: Checkout
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Download schema
run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd
- name: Lint info.xml
- uses: ChristophWurst/xmllint-action@39155a91429af431d65fafc21fa52ba5c4f5cb71 # v1.1
+ uses: ChristophWurst/xmllint-action@36f2a302f84f8c83fceea0b9c59e1eb4a616d3c1 # v1.2
with:
xml-file: ./appinfo/info.xml
xml-schema-file: ./info.xsd
diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml
index 055c2488..3dc84333 100644
--- a/.github/workflows/lint-php-cs.yml
+++ b/.github/workflows/lint-php-cs.yml
@@ -2,19 +2,13 @@
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
+#
+# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: MIT
name: Lint php-cs
-on:
- pull_request:
- paths:
- - 'lib/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - composer.lock
- - composer.json
+on: pull_request
permissions:
contents: read
@@ -31,12 +25,17 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+
+ - name: Get php version
+ id: versions
+ uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
- - name: Set up php
- uses: shivammathur/setup-php@v2 # v2
+ - name: Set up php${{ steps.versions.outputs.php-available }}
+ uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
- php-version: 8.1
+ php-version: ${{ steps.versions.outputs.php-available }}
+ extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
coverage: none
ini-file: development
env:
@@ -44,7 +43,7 @@ jobs:
- name: Install dependencies
run: |
- composer i
+ composer remove nextcloud/ocp --dev
composer i
- name: Lint
diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml
index 498e8580..31bff37c 100644
--- a/.github/workflows/lint-php.yml
+++ b/.github/workflows/lint-php.yml
@@ -2,28 +2,19 @@
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
+#
+# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: MIT
-name: Lint
+name: Lint php
on:
pull_request:
- paths:
- - 'lib/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - composer.lock
- - composer.json
push:
branches:
- main
- master
- stable*
- paths:
- - '*.php'
- - composer.lock
- - 'vendor-bin'
permissions:
contents: read
@@ -33,22 +24,35 @@ concurrency:
cancel-in-progress: true
jobs:
+ matrix:
+ runs-on: ubuntu-latest-low
+ outputs:
+ php-versions: ${{ steps.versions.outputs.php-versions }}
+ steps:
+ - name: Checkout app
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+ - name: Get version matrix
+ id: versions
+ uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0
+
php-lint:
runs-on: ubuntu-latest
+ needs: matrix
strategy:
matrix:
- php-versions: [ '8.0', "8.1", "8.2", '8.3' ]
+ php-versions: ${{fromJson(needs.matrix.outputs.php-versions)}}
name: php-lint
steps:
- name: Checkout
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up php ${{ matrix.php-versions }}
- uses: shivammathur/setup-php@v2 # v2
+ uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
php-version: ${{ matrix.php-versions }}
+ extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
coverage: none
ini-file: development
env:
@@ -60,7 +64,7 @@ jobs:
summary:
permissions:
contents: none
- runs-on: ubuntu-latest
+ runs-on: ubuntu-latest-low
needs: php-lint
if: always()
diff --git a/.github/workflows/phpunit-mariadb.yml b/.github/workflows/phpunit-mariadb.yml
new file mode 100644
index 00000000..f38a7d2c
--- /dev/null
+++ b/.github/workflows/phpunit-mariadb.yml
@@ -0,0 +1,214 @@
+# 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
+#
+# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: MIT
+
+name: PHPUnit MariaDB
+
+on:
+ pull_request:
+ push:
+ branches:
+ - main
+ - master
+ - stable*
+
+permissions:
+ contents: read
+
+concurrency:
+ group: phpunit-mariadb-${{ github.head_ref || github.run_id }}
+ cancel-in-progress: true
+
+jobs:
+ matrix:
+ runs-on: ubuntu-latest-low
+ outputs:
+ php-version: ${{ steps.versions.outputs.php-available-list }}
+ server-max: ${{ steps.versions.outputs.branches-max-list }}
+ steps:
+ - name: Checkout app
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+
+ - name: Get version matrix
+ id: versions
+ uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
+
+ changes:
+ runs-on: ubuntu-latest-low
+ permissions:
+ contents: read
+ pull-requests: read
+
+ outputs:
+ src: ${{ steps.changes.outputs.src}}
+
+ steps:
+ - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
+ id: changes
+ continue-on-error: true
+ with:
+ filters: |
+ src:
+ - '.github/workflows/**'
+ - 'appinfo/**'
+ - 'lib/**'
+ - 'templates/**'
+ - 'tests/**'
+ - 'vendor/**'
+ - 'vendor-bin/**'
+ - '.php-cs-fixer.dist.php'
+ - 'composer.json'
+ - 'composer.lock'
+
+ phpunit-mariadb:
+ runs-on: ubuntu-latest
+
+ needs: [changes, matrix]
+ if: needs.changes.outputs.src != 'false'
+
+ strategy:
+ matrix:
+ php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
+ server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
+ mariadb-versions: ['10.6', '10.11']
+
+ name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
+
+ services:
+ mariadb:
+ image: ghcr.io/nextcloud/continuous-integration-mariadb-${{ matrix.mariadb-versions }}:latest
+ ports:
+ - 4444:3306/tcp
+ env:
+ MYSQL_ROOT_PASSWORD: rootpassword
+ options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
+
+ steps:
+ - name: Set app env
+ run: |
+ # Split and keep last
+ echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
+
+ - name: Checkout server
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+ with:
+ submodules: true
+ repository: nextcloud/server
+ ref: ${{ matrix.server-versions }}
+
+ - name: Checkout app
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+ with:
+ path: apps/${{ env.APP_NAME }}
+
+ - name: Set up php ${{ matrix.php-versions }}
+ uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
+ with:
+ php-version: ${{ matrix.php-versions }}
+ # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
+ extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql
+ coverage: none
+ ini-file: development
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Enable ONLY_FULL_GROUP_BY MariaDB option
+ run: |
+ echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
+ echo 'SELECT @@sql_mode;' | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
+
+ - name: Make
+ working-directory: apps/${{ env.APP_NAME }}
+ run: |
+ make all
+
+ - name: Check composer file existence
+ id: check_composer
+ uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
+ with:
+ files: apps/${{ env.APP_NAME }}/composer.json
+
+ - 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 }}
+ run: |
+ composer remove nextcloud/ocp --dev
+ composer i
+
+ - name: Set up repo
+ working-directory: apps/${{ env.APP_NAME }}
+ run: |
+ make remove-binaries # Make it download tfjs from scratch
+ rm -rf models # Make it download from github
+ wget https://github.com/nextcloud/recognize/releases/download/v3.4.0/test-files.zip
+ unzip test-files.zip -d tests/res/
+
+ - name: Set up Nextcloud
+ env:
+ DB_PORT: 4444
+ run: |
+ mkdir data
+ ./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 admin
+ ./occ app:enable --force ${{ env.APP_NAME }}
+
+ - name: Check PHPUnit script is defined
+ id: check_phpunit
+ 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.outcome == 'success'
+ working-directory: apps/${{ env.APP_NAME }}
+ run: composer run test:unit
+
+ - name: Check PHPUnit integration script is defined
+ id: check_integration
+ 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.outcome == 'success'
+ run: php -S localhost:8080 &
+
+ - name: PHPUnit integration
+ # Only run if phpunit integration config file exists
+ if: steps.check_integration.outcome == 'success'
+ working-directory: apps/${{ env.APP_NAME }}
+ run: composer run test:integration
+
+ - name: Print logs
+ if: always()
+ run: |
+ cat data/nextcloud.log
+
+ - 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:
+ contents: none
+ runs-on: ubuntu-latest-low
+ needs: [changes, phpunit-mariadb]
+
+ if: always()
+
+ name: phpunit-mariadb-summary
+
+ steps:
+ - name: Summary status
+ run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mariadb.result != 'success' }}; then exit 1; fi
\ No newline at end of file
diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml
index 48d64956..2a698f8d 100644
--- a/.github/workflows/phpunit-mysql.yml
+++ b/.github/workflows/phpunit-mysql.yml
@@ -2,24 +2,14 @@
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
+#
+# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: MIT
-name: PHPUnit mysql
+name: PHPUnit MySQL
on:
pull_request:
- paths:
- - '.github/workflows/**'
- - 'appinfo/**'
- - 'lib/**'
- - 'src/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - '.php-cs-fixer.dist.php'
- - 'composer.json'
- - 'composer.lock'
-
push:
branches:
- main
@@ -34,22 +24,66 @@ concurrency:
cancel-in-progress: true
jobs:
+ matrix:
+ runs-on: ubuntu-latest-low
+ outputs:
+ matrix: ${{ steps.versions.outputs.sparse-matrix }}
+ steps:
+ - name: Checkout app
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+
+ - name: Get version matrix
+ id: versions
+ uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
+ with:
+ matrix: '{"mysql-versions": ["8.4"]}'
+
+ changes:
+ runs-on: ubuntu-latest-low
+ permissions:
+ contents: read
+ pull-requests: read
+
+ outputs:
+ src: ${{ steps.changes.outputs.src}}
+
+ steps:
+ - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
+ id: changes
+ continue-on-error: true
+ with:
+ filters: |
+ src:
+ - '.github/workflows/**'
+ - 'appinfo/**'
+ - 'lib/**'
+ - 'templates/**'
+ - 'tests/**'
+ - 'vendor/**'
+ - 'vendor-bin/**'
+ - '.php-cs-fixer.dist.php'
+ - 'composer.json'
+ - 'composer.lock'
+
phpunit-mysql:
runs-on: ubuntu-latest
+ needs: [changes, matrix]
+ if: needs.changes.outputs.src != 'false'
+
strategy:
- matrix:
- php-versions: ['8.1', '8.2', '8.3']
- server-versions: ['master', 'stable30']
+ matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
+
+ name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
services:
mysql:
- image: ghcr.io/nextcloud/continuous-integration-mariadb-10.6:latest
+ image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest
ports:
- 4444:3306/tcp
env:
MYSQL_ROOT_PASSWORD: rootpassword
- options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
+ options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 10
steps:
- name: Set app env
@@ -58,19 +92,19 @@ jobs:
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
- uses: shivammathur/setup-php@v2 # v2
+ uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -80,9 +114,19 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Enable ONLY_FULL_GROUP_BY MySQL option
+ run: |
+ echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
+ echo 'SELECT @@sql_mode;' | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
+
+ - name: Make
+ working-directory: apps/${{ env.APP_NAME }}
+ run: |
+ make all
+
- name: Check composer file existence
id: check_composer
- uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
+ uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
with:
files: apps/${{ env.APP_NAME }}/composer.json
@@ -90,12 +134,13 @@ jobs:
# Only run if phpunit config file exists
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
- run: composer install --no-dev
+ run: |
+ composer remove nextcloud/ocp --dev
+ composer i
- - name: Set up test resources
+ - name: Set up repo
working-directory: apps/${{ env.APP_NAME }}
run: |
- make all
make remove-binaries # Make it download tfjs from scratch
rm -rf models # Make it download from github
wget https://github.com/nextcloud/recognize/releases/download/v3.4.0/test-files.zip
@@ -106,7 +151,7 @@ jobs:
DB_PORT: 4444
run: |
mkdir data
- ./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 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 admin
./occ app:enable --force ${{ env.APP_NAME }}
- name: Check PHPUnit script is defined
@@ -114,7 +159,7 @@ jobs:
continue-on-error: true
working-directory: apps/${{ env.APP_NAME }}
run: |
- composer run --list | grep "^ test:unit " | wc -l | grep 1
+ composer run --list | grep '^ test:unit ' | wc -l | grep 1
- name: PHPUnit
# Only run if phpunit config file exists
@@ -127,7 +172,7 @@ jobs:
continue-on-error: true
working-directory: apps/${{ env.APP_NAME }}
run: |
- composer run --list | grep "^ test:integration " | wc -l | grep 1
+ composer run --list | grep '^ test:integration ' | wc -l | grep 1
- name: Run Nextcloud
# Only run if phpunit integration config file exists
@@ -155,8 +200,8 @@ jobs:
summary:
permissions:
contents: none
- runs-on: ubuntu-latest
- needs: phpunit-mysql
+ runs-on: ubuntu-latest-low
+ needs: [changes, phpunit-mysql]
if: always()
@@ -164,4 +209,4 @@ jobs:
steps:
- name: Summary status
- run: if ${{ needs.phpunit-mysql.result != 'success' }}; then exit 1; fi
+ run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml
index 4fabd638..d8f25fa7 100644
--- a/.github/workflows/phpunit-pgsql.yml
+++ b/.github/workflows/phpunit-pgsql.yml
@@ -2,24 +2,14 @@
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
+#
+# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: MIT
-name: PHPUnit pgsql
+name: PHPUnit PostgreSQL
on:
pull_request:
- paths:
- - '.github/workflows/**'
- - 'appinfo/**'
- - 'lib/**'
- - 'src/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - '.php-cs-fixer.dist.php'
- - 'composer.json'
- - 'composer.lock'
-
push:
branches:
- main
@@ -34,14 +24,58 @@ concurrency:
cancel-in-progress: true
jobs:
+ matrix:
+ runs-on: ubuntu-latest-low
+ outputs:
+ php-version: ${{ steps.versions.outputs.php-available-list }}
+ server-max: ${{ steps.versions.outputs.branches-max-list }}
+ steps:
+ - name: Checkout app
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+
+ - name: Get version matrix
+ id: versions
+ uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
+
+ changes:
+ runs-on: ubuntu-latest-low
+ permissions:
+ contents: read
+ pull-requests: read
+
+ outputs:
+ src: ${{ steps.changes.outputs.src }}
+
+ steps:
+ - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
+ id: changes
+ continue-on-error: true
+ with:
+ filters: |
+ src:
+ - '.github/workflows/**'
+ - 'appinfo/**'
+ - 'lib/**'
+ - 'templates/**'
+ - 'tests/**'
+ - 'vendor/**'
+ - 'vendor-bin/**'
+ - '.php-cs-fixer.dist.php'
+ - 'composer.json'
+ - 'composer.lock'
+
phpunit-pgsql:
runs-on: ubuntu-latest
+ needs: [changes, matrix]
+ if: needs.changes.outputs.src != 'false'
+
strategy:
- fail-fast: false
matrix:
- php-versions: ['8.2']
- server-versions: ['master']
+ php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
+ server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
+
+ name: PostgreSQL PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
services:
postgres:
@@ -61,19 +95,19 @@ jobs:
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
- uses: shivammathur/setup-php@v2 # v2
+ uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -83,9 +117,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Make
+ working-directory: apps/${{ env.APP_NAME }}
+ run: |
+ make all
+
- name: Check composer file existence
id: check_composer
- uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
+ uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
with:
files: apps/${{ env.APP_NAME }}/composer.json
@@ -93,12 +132,13 @@ jobs:
# Only run if phpunit config file exists
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
- run: composer install --no-dev
+ run: |
+ composer remove nextcloud/ocp --dev
+ composer i
- name: Set up repo
working-directory: apps/${{ env.APP_NAME }}
run: |
- make all
make remove-binaries # Make it download tfjs from scratch
rm -rf models # Make it download from github
wget https://github.com/nextcloud/recognize/releases/download/v3.4.0/test-files.zip
@@ -109,7 +149,7 @@ jobs:
DB_PORT: 4444
run: |
mkdir data
- ./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 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 admin
./occ app:enable --force ${{ env.APP_NAME }}
- name: Check PHPUnit script is defined
@@ -117,7 +157,7 @@ jobs:
continue-on-error: true
working-directory: apps/${{ env.APP_NAME }}
run: |
- composer run --list | grep "^ test:unit " | wc -l | grep 1
+ composer run --list | grep '^ test:unit ' | wc -l | grep 1
- name: PHPUnit
# Only run if phpunit config file exists
@@ -130,7 +170,7 @@ jobs:
continue-on-error: true
working-directory: apps/${{ env.APP_NAME }}
run: |
- composer run --list | grep "^ test:integration " | wc -l | grep 1
+ composer run --list | grep '^ test:integration ' | wc -l | grep 1
- name: Run Nextcloud
# Only run if phpunit integration config file exists
@@ -158,8 +198,8 @@ jobs:
summary:
permissions:
contents: none
- runs-on: ubuntu-latest
- needs: phpunit-pgsql
+ runs-on: ubuntu-latest-low
+ needs: [changes, phpunit-pgsql]
if: always()
@@ -167,4 +207,4 @@ jobs:
steps:
- name: Summary status
- run: if ${{ needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi
+ run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml
index c9a4bafe..ec4917b5 100644
--- a/.github/workflows/phpunit-sqlite.yml
+++ b/.github/workflows/phpunit-sqlite.yml
@@ -2,24 +2,14 @@
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
+#
+# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: MIT
-name: PHPUnit sqlite
+name: PHPUnit SQLite
on:
pull_request:
- paths:
- - '.github/workflows/**'
- - 'appinfo/**'
- - 'lib/**'
- - 'src/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - '.php-cs-fixer.dist.php'
- - 'composer.json'
- - 'composer.lock'
-
push:
branches:
- main
@@ -34,15 +24,58 @@ concurrency:
cancel-in-progress: true
jobs:
+ matrix:
+ runs-on: ubuntu-latest-low
+ outputs:
+ php-version: ${{ steps.versions.outputs.php-available-list }}
+ server-max: ${{ steps.versions.outputs.branches-max-list }}
+ steps:
+ - name: Checkout app
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+
+ - name: Get version matrix
+ id: versions
+ uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
+
+ changes:
+ runs-on: ubuntu-latest-low
+ permissions:
+ contents: read
+ pull-requests: read
+
+ outputs:
+ src: ${{ steps.changes.outputs.src}}
+
+ steps:
+ - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
+ id: changes
+ continue-on-error: true
+ with:
+ filters: |
+ src:
+ - '.github/workflows/**'
+ - 'appinfo/**'
+ - 'lib/**'
+ - 'templates/**'
+ - 'tests/**'
+ - 'vendor/**'
+ - 'vendor-bin/**'
+ - '.php-cs-fixer.dist.php'
+ - 'composer.json'
+ - 'composer.lock'
+
phpunit-sqlite:
runs-on: ubuntu-latest
+ needs: [changes, matrix]
+ if: needs.changes.outputs.src != 'false'
+
strategy:
- # do not stop on another job's failure
- fail-fast: false
matrix:
- php-versions: ['8.2']
- server-versions: ['master']
+ php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
+ server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
+
+ name: SQLite PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
steps:
- name: Set app env
@@ -51,19 +84,19 @@ jobs:
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
- uses: shivammathur/setup-php@v2 # v2
+ uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -73,9 +106,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Make
+ working-directory: apps/${{ env.APP_NAME }}
+ run: |
+ make all
+
- name: Check composer file existence
id: check_composer
- uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
+ uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
with:
files: apps/${{ env.APP_NAME }}/composer.json
@@ -83,12 +121,13 @@ jobs:
# Only run if phpunit config file exists
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
- run: composer install --no-dev
+ run: |
+ composer remove nextcloud/ocp --dev
+ composer i
- name: Set up repo
working-directory: apps/${{ env.APP_NAME }}
run: |
- make all
make remove-binaries # Make it download tfjs from scratch
rm -rf models # Make it download from github
wget https://github.com/nextcloud/recognize/releases/download/v3.4.0/test-files.zip
@@ -99,7 +138,7 @@ jobs:
DB_PORT: 4444
run: |
mkdir data
- ./occ maintenance:install --verbose --database=sqlite --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 maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
./occ app:enable --force ${{ env.APP_NAME }}
- name: Check PHPUnit script is defined
@@ -107,7 +146,7 @@ jobs:
continue-on-error: true
working-directory: apps/${{ env.APP_NAME }}
run: |
- composer run --list | grep "^ test:unit " | wc -l | grep 1
+ composer run --list | grep '^ test:unit ' | wc -l | grep 1
- name: PHPUnit
# Only run if phpunit config file exists
@@ -120,7 +159,7 @@ jobs:
continue-on-error: true
working-directory: apps/${{ env.APP_NAME }}
run: |
- composer run --list | grep "^ test:integration " | wc -l | grep 1
+ composer run --list | grep '^ test:integration ' | wc -l | grep 1
- name: Run Nextcloud
# Only run if phpunit integration config file exists
@@ -148,8 +187,8 @@ jobs:
summary:
permissions:
contents: none
- runs-on: ubuntu-latest
- needs: phpunit-sqlite
+ runs-on: ubuntu-latest-low
+ needs: [changes, phpunit-sqlite]
if: always()
@@ -157,4 +196,4 @@ jobs:
steps:
- name: Summary status
- run: if ${{ needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi
+ run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/pr-feedback.yml b/.github/workflows/pr-feedback.yml
index be0d028f..6a01fa09 100644
--- a/.github/workflows/pr-feedback.yml
+++ b/.github/workflows/pr-feedback.yml
@@ -35,7 +35,7 @@ jobs:
with:
feedback-message: |
Hello there,
- Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.
+ Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.
We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.
@@ -45,6 +45,6 @@ jobs:
(If you believe you should not receive this message, you can add yourself to the [blocklist](https://github.com/nextcloud/.github/blob/master/non-community-usernames.txt).)
days-before-feedback: 14
- start-date: "2024-04-30"
- exempt-authors: "${{ steps.blocklist.outputs.blocklist }},${{ steps.scrape.outputs.users }},nextcloud-command,nextcloud-android-bot"
+ start-date: '2024-04-30'
+ exempt-authors: '${{ steps.blocklist.outputs.blocklist }},${{ steps.scrape.outputs.users }}'
exempt-bots: true
diff --git a/.github/workflows/psalm-matrix.yml b/.github/workflows/psalm-matrix.yml
new file mode 100644
index 00000000..840f8c3f
--- /dev/null
+++ b/.github/workflows/psalm-matrix.yml
@@ -0,0 +1,80 @@
+# 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
+#
+# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: MIT
+
+name: Static analysis
+
+on:
+ pull_request:
+ push:
+ branches:
+ - main
+ - master
+ - stable*
+
+concurrency:
+ group: psalm-${{ github.head_ref || github.run_id }}
+ cancel-in-progress: true
+
+jobs:
+ matrix:
+ runs-on: ubuntu-latest-low
+ outputs:
+ ocp-matrix: ${{ steps.versions.outputs.ocp-matrix }}
+ steps:
+ - name: Checkout app
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+ - name: Get version matrix
+ id: versions
+ uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
+
+ static-analysis:
+ runs-on: ubuntu-latest
+ needs: matrix
+ strategy:
+ # do not stop on another job's failure
+ fail-fast: false
+ matrix: ${{ fromJson(needs.matrix.outputs.ocp-matrix) }}
+
+ name: static-psalm-analysis ${{ matrix.ocp-version }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+
+ - name: Set up php${{ matrix.php-versions }}
+ uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
+ with:
+ php-version: ${{ matrix.php-versions }}
+ extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
+ coverage: none
+ ini-file: development
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Install dependencies
+ run: |
+ composer remove nextcloud/ocp --dev
+ composer i
+
+
+ - name: Install dependencies
+ run: composer require --dev 'nextcloud/ocp:${{ matrix.ocp-version }}' --ignore-platform-reqs --with-dependencies
+
+ - name: Run coding standards check
+ run: composer run psalm
+
+ summary:
+ runs-on: ubuntu-latest-low
+ needs: static-analysis
+
+ if: always()
+
+ name: static-psalm-analysis-summary
+
+ steps:
+ - name: Summary status
+ run: if ${{ needs.static-analysis.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml
deleted file mode 100644
index 3f4f0fb4..00000000
--- a/.github/workflows/psalm.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-# 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
-
-name: Static analysis
-
-on:
- pull_request:
- paths:
- - 'lib/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - composer.lock
- push:
- branches:
- - master
- - main
- - stable*
-
-concurrency:
- group: psalm-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
-
-jobs:
- static-analysis:
- runs-on: ubuntu-latest
-
- strategy:
- matrix:
- php-versions: [ '8.1', '8.2', '8.3' ]
- server-versions: [ 'dev-master' ]
- fail-fast: false
-
- name: Nextcloud
- steps:
- - name: Checkout
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
-
- - name: Set up php
- uses: shivammathur/setup-php@v2 # v2
- with:
- php-version: ${{ matrix.php-versions }}
- coverage: none
- ini-file: development
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Install dependencies
- run: |
- composer require --with-all-dependencies nextcloud/ocp:${{ matrix.server-versions }}
- composer install
-
- - name: Run coding standards check
- run: composer run psalm
diff --git a/src/admin.js b/src/admin.js
index 87545723..6dfef98f 100644
--- a/src/admin.js
+++ b/src/admin.js
@@ -1,10 +1,8 @@
import Vue from 'vue'
-import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
import App from './components/ViewAdmin.vue'
import AppGlobal from './mixins/AppGlobal.js'
Vue.mixin(AppGlobal)
-Vue.directive('tooltip', Tooltip)
global.Recognize = new Vue({
el: '#recognize',
diff --git a/src/components/ViewAdmin.vue b/src/components/ViewAdmin.vue
index 571ab594..a044b6c6 100644
--- a/src/components/ViewAdmin.vue
+++ b/src/components/ViewAdmin.vue
@@ -40,7 +40,7 @@
{{ t('recognize', 'By default all available CPU cores will be used which may put your system under considerable load. To avoid this, you can limit the amount of CPU Cores used. (Note: In WASM mode, currently only 1 core can be used at all times.)') }}
-
{{ t('recognize', 'By default, recognize will only ever run one classifier process at a time. If you have a lot of resources available and want to run as many processes in parallel as possible, you can turn on concurrency here.') }}
@@ -294,7 +294,7 @@ {{ t('recognize', 'Checking libtensorflow') }} -