diff --git a/.github/workflows/fixup.yml b/.github/workflows/fixup.yml
index 9548d19..807f5fd 100644
--- a/.github/workflows/fixup.yml
+++ b/.github/workflows/fixup.yml
@@ -28,6 +28,6 @@ jobs:
steps:
- name: Run check
- uses: skjnldsv/block-fixup-merge-action@42d26e1b536ce61e5cf467d65fb76caf4aa85acf # v1
+ uses: skjnldsv/block-fixup-merge-action@c138ea99e45e186567b64cf065ce90f7158c236a # v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/lint-eslint.yml b/.github/workflows/lint-eslint.yml
index 3d2cd33..f2dafac 100644
--- a/.github/workflows/lint-eslint.yml
+++ b/.github/workflows/lint-eslint.yml
@@ -20,6 +20,9 @@ concurrency:
jobs:
changes:
runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ pull-requests: read
outputs:
src: ${{ steps.changes.outputs.src}}
@@ -53,10 +56,10 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Read package.json node and npm engines version
- uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
+ uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
id: versions
with:
fallbackNode: '^20'
@@ -68,7 +71,7 @@ jobs:
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:
@@ -76,6 +79,14 @@ jobs:
PUPPETEER_SKIP_DOWNLOAD: true
run: npm ci
+ - name: Install dependencies
+ env:
+ CYPRESS_INSTALL_BINARY: 0
+ PUPPETEER_SKIP_DOWNLOAD: true
+ # Install specific versions of dependencies to ensure compatibility
+ # https://github.com/nextcloud/server/blob/stable30/package.json
+ run: npm install @mdi/js@^7.4.47 @nextcloud/vue@^8.26.1 vue-material-design-icons@5.3.1
+
- name: Lint
run: npm run lint
diff --git a/.github/workflows/lint-info-xml.yml b/.github/workflows/lint-info-xml.yml
index bf6f178..ee4ab25 100644
--- a/.github/workflows/lint-info-xml.yml
+++ b/.github/workflows/lint-info-xml.yml
@@ -21,7 +21,7 @@ jobs:
name: info.xml lint
steps:
- name: Checkout
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+ 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
diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml
index 1ffee78..d892b89 100644
--- a/.github/workflows/lint-php-cs.yml
+++ b/.github/workflows/lint-php-cs.yml
@@ -22,14 +22,14 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+ 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${{ steps.versions.outputs.php-available }}
- uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2
+ uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0
with:
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
diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml
index a965ecc..4cec1c5 100644
--- a/.github/workflows/lint-php.yml
+++ b/.github/workflows/lint-php.yml
@@ -21,7 +21,7 @@ jobs:
php-versions: ${{ steps.versions.outputs.php-versions }}
steps:
- name: Checkout app
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Get version matrix
id: versions
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0
@@ -37,10 +37,10 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up php ${{ matrix.php-versions }}
- uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2
+ uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0
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
diff --git a/.github/workflows/lint-stylelint.yml b/.github/workflows/lint-stylelint.yml
index 4effd42..0988b4d 100644
--- a/.github/workflows/lint-stylelint.yml
+++ b/.github/workflows/lint-stylelint.yml
@@ -22,10 +22,10 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Read package.json node and npm engines version
- uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
+ uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
id: versions
with:
fallbackNode: '^20'
@@ -37,7 +37,7 @@ jobs:
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:
diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml
index e44d42d..c30e063 100644
--- a/.github/workflows/phpunit-mysql.yml
+++ b/.github/workflows/phpunit-mysql.yml
@@ -1,6 +1,6 @@
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
-name: PHPUnit
+name: PHPUnit MySQL
on:
pull_request:
@@ -9,61 +9,121 @@ on:
- master
- stable*
+permissions:
+ contents: read
+
+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/phpunit.xml
- PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
+ APP_NAME: simplesettings
jobs:
+ matrix:
+ runs-on: ubuntu-latest
+ 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
+ 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.3']
- server-versions: ['master', 'stable29']
+ matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
+
+ name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
services:
mysql:
- image: mariadb:10.5
+ 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
run: |
# Split and keep last
- echo "APP_NAME=simplesettings" >> $GITHUB_ENV
-
- - 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
+ echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@v3
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@v3
+ 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
+ uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0
with:
php-version: ${{ matrix.php-versions }}
- tools: phpunit
- extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql
+ # 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: Set up PHPUnit
+ - 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: 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 i
@@ -72,39 +132,57 @@ 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 app:enable ${{ env.APP_NAME }}
+ ./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 config file existence
+ - name: Check PHPUnit script is defined
id: check_phpunit
- uses: andstor/file-existence-action@v1
- with:
- files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
-
- - name: Run Nextcloud
- run: php -S localhost:8080 &
+ 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: ./vendor/bin/phpunit -c ${{ env.PHPUNIT_CONFIG }}
+ 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@v1
- 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.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/bin/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+ 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
- needs: phpunit-mysql
+ needs: [changes, phpunit-mysql]
if: always()
@@ -112,4 +190,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 4c4f0ac..154c0c7 100644
--- a/.github/workflows/phpunit-pgsql.yml
+++ b/.github/workflows/phpunit-pgsql.yml
@@ -1,6 +1,6 @@
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
-name: PHPUnit
+name: PHPUnit PostgreSQL
on:
pull_request:
@@ -9,23 +9,73 @@ on:
- master
- stable*
+permissions:
+ contents: read
+
+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/phpunit.xml
- PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
+ APP_NAME: simplesettings
jobs:
+ matrix:
+ runs-on: ubuntu-latest
+ 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
+ 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:
matrix:
- php-versions: ['8.3']
- server-versions: ['master', 'stable29']
+ 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:
- image: postgres
+ image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest
ports:
- 4444:5432/tcp
env:
@@ -38,29 +88,40 @@ jobs:
- name: Set app env
run: |
# Split and keep last
- echo "APP_NAME=simplesettings" >> $GITHUB_ENV
+ echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@v3
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@v3
+ 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
+ uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0
with:
php-version: ${{ matrix.php-versions }}
- tools: phpunit
- extensions: mbstring, iconv, fileinfo, intl, pgsql, pdo_pgsql
+ # 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, pgsql, pdo_pgsql
coverage: none
+ ini-file: development
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - 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 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 }}
run: composer i
@@ -69,41 +130,57 @@ 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 app:enable ${{ env.APP_NAME }}
+ ./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 config file existence
+ - name: Check PHPUnit script is defined
id: check_phpunit
- uses: andstor/file-existence-action@v1
- 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: ./vendor/bin/phpunit -c ${{ env.PHPUNIT_CONFIG }}
+ 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@v1
- 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/bin/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+ 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
- needs: phpunit-pgsql
+ needs: [changes, phpunit-pgsql]
if: always()
@@ -111,4 +188,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 05b1009..d86e490 100644
--- a/.github/workflows/phpunit-sqlite.yml
+++ b/.github/workflows/phpunit-sqlite.yml
@@ -1,6 +1,6 @@
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
-name: PHPUnit
+name: PHPUnit SQLite
on:
pull_request:
@@ -9,47 +9,108 @@ on:
- master
- stable*
+permissions:
+ contents: read
+
+concurrency:
+ group: phpunit-sqlite-${{ github.head_ref || github.run_id }}
+ cancel-in-progress: true
+
env:
- # Location of the phpunit.xml and phpunit.integration.xml files
- PHPUNIT_CONFIG: ./tests/phpunit.xml
- PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
+ APP_NAME: simplesettings
jobs:
+ matrix:
+ runs-on: ubuntu-latest
+ 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
+ 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:
matrix:
- php-versions: ['8.3']
- server-versions: ['master', 'stable29']
+ 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
run: |
# Split and keep last
- echo "APP_NAME=simplesettings" >> $GITHUB_ENV
+ echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@v3
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@v3
+ 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
+ uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0
with:
php-version: ${{ matrix.php-versions }}
- tools: phpunit
- extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite
+ # 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, sqlite, pdo_sqlite
coverage: none
+ ini-file: development
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - 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 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 }}
run: composer i
@@ -58,41 +119,57 @@ 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 app:enable ${{ env.APP_NAME }}
+ ./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 config file existence
+ - name: Check PHPUnit script is defined
id: check_phpunit
- uses: andstor/file-existence-action@v1
- 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: ./vendor/bin/phpunit -c ${{ env.PHPUNIT_CONFIG }}
+ 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@v1
- 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/bin/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+ 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
- needs: phpunit-sqlite
+ needs: [changes, phpunit-sqlite]
if: always()
@@ -100,4 +177,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/psalm.yml b/.github/workflows/psalm.yml
new file mode 100644
index 0000000..169446c
--- /dev/null
+++ b/.github/workflows/psalm.yml
@@ -0,0 +1,44 @@
+# 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
+
+concurrency:
+ group: psalm-${{ github.head_ref || github.run_id }}
+ cancel-in-progress: true
+
+jobs:
+ static-analysis:
+ runs-on: ubuntu-latest
+
+ name: static-psalm-analysis
+ steps:
+ - name: Checkout
+ 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${{ steps.versions.outputs.php-available }}
+ uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0
+ with:
+ 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:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Install dependencies
+ run: composer i
+
+ - name: Run coding standards check
+ run: composer run psalm
diff --git a/.github/workflows/update-nextcloud-ocp.yml b/.github/workflows/update-nextcloud-ocp.yml
new file mode 100644
index 0000000..ae3f020
--- /dev/null
+++ b/.github/workflows/update-nextcloud-ocp.yml
@@ -0,0 +1,119 @@
+# 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: Update nextcloud/ocp
+
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: "5 2 * * 0"
+
+jobs:
+ update-nextcloud-ocp:
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ branches: ['main', 'master', 'stable29', 'stable28', 'stable27']
+
+ name: update-nextcloud-ocp-${{ matrix.branches }}
+
+ steps:
+ - id: checkout
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+ with:
+ ref: ${{ matrix.branches }}
+ submodules: true
+ continue-on-error: true
+
+ - name: Set up php8.2
+ if: steps.checkout.outcome == 'success'
+ uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0
+ with:
+ php-version: 8.2
+ # 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, sqlite, pdo_sqlite
+ coverage: none
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Read codeowners
+ if: steps.checkout.outcome == 'success'
+ id: codeowners
+ run: |
+ grep '/appinfo/info.xml' .github/CODEOWNERS | cut -f 2- -d ' ' | xargs | awk '{ print "codeowners="$0 }' >> $GITHUB_OUTPUT
+ continue-on-error: true
+
+ - name: Composer install
+ if: steps.checkout.outcome == 'success'
+ run: composer install
+
+ - name: Composer update nextcloud/ocp
+ id: update_branch
+ if: ${{ steps.checkout.outcome == 'success' && matrix.branches != 'main' }}
+ run: composer require --dev 'nextcloud/ocp:dev-${{ matrix.branches }}'
+
+ - name: Raise on issue on failure
+ uses: dacbd/create-issue-action@cdb57ab6ff8862aa09fee2be6ba77a59581921c2 # v2.0.0
+ if: ${{ steps.checkout.outcome == 'success' && failure() && steps.update_branch.conclusion == 'failure' }}
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ title: 'Failed to update nextcloud/ocp package on branch ${{ matrix.branches }}'
+ body: 'Please check the output of the GitHub action and manually resolve the issues
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
${{ steps.codeowners.outputs.codeowners }}'
+
+ - name: Composer update nextcloud/ocp
+ id: update_main
+ if: ${{ steps.checkout.outcome == 'success' && matrix.branches == 'main' }}
+ run: composer require --dev nextcloud/ocp:dev-master
+
+ - name: Raise on issue on failure
+ uses: dacbd/create-issue-action@cdb57ab6ff8862aa09fee2be6ba77a59581921c2 # v2.0.0
+ if: ${{ steps.checkout.outcome == 'success' && failure() && steps.update_main.conclusion == 'failure' }}
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ title: 'Failed to update nextcloud/ocp package on branch ${{ matrix.branches }}'
+ body: 'Please check the output of the GitHub action and manually resolve the issues
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
${{ steps.codeowners.outputs.codeowners }}'
+
+ - name: Reset checkout 3rdparty
+ if: steps.checkout.outcome == 'success'
+ run: |
+ git clean -f 3rdparty
+ git checkout 3rdparty
+ continue-on-error: true
+
+ - name: Reset checkout vendor
+ if: steps.checkout.outcome == 'success'
+ run: |
+ git clean -f vendor
+ git checkout vendor
+ continue-on-error: true
+
+ - name: Reset checkout vendor-bin
+ if: steps.checkout.outcome == 'success'
+ run: |
+ git clean -f vendor-bin
+ git checkout vendor-bin
+ continue-on-error: true
+
+ - name: Create Pull Request
+ if: steps.checkout.outcome == 'success'
+ uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
+ with:
+ token: ${{ secrets.COMMAND_BOT_PAT }}
+ commit-message: 'chore(dev-deps): Bump nextcloud/ocp package'
+ committer: GitHub
+ author: nextcloud-command
+ signoff: true
+ branch: 'automated/noid/${{ matrix.branches }}-update-nextcloud-ocp'
+ title: '[${{ matrix.branches }}] Update nextcloud/ocp dependency'
+ body: |
+ Auto-generated update of [nextcloud/ocp](https://github.com/nextcloud-deps/ocp/) dependency
+ labels: |
+ dependencies
+ 3. to review
diff --git a/appinfo/info.xml b/appinfo/info.xml
index dc548fd..e4a66df 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -12,7 +12,7 @@
tools
https://github.com/IONOS-Productivity/nc-simple-settings
-
+