diff --git a/.github/workflows/appstore-build-publish.yml b/.github/workflows/appstore-build-publish.yml index 1438a64d67..d5b0f4747b 100644 --- a/.github/workflows/appstore-build-publish.yml +++ b/.github/workflows/appstore-build-publish.yml @@ -10,7 +10,7 @@ on: types: [published] env: - PHP_VERSION: 8.0 + PHP_VERSION: 8.2 jobs: build_and_publish: @@ -21,7 +21,7 @@ jobs: steps: - name: Check actor permission - uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2.1 + uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0 with: require: write @@ -44,19 +44,19 @@ jobs: expression: "//info//dependencies//nextcloud/@min-version" - 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 # Continue if no package.json continue-on-error: true with: path: ${{ env.APP_NAME }} fallbackNode: '^20' - fallbackNpm: '^9' + fallbackNpm: '^10' - name: Set up node ${{ steps.versions.outputs.nodeVersion }} # Skip if no package.json if: ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3 with: node-version: ${{ steps.versions.outputs.nodeVersion }} @@ -66,7 +66,7 @@ jobs: run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" - name: Set up php ${{ env.PHP_VERSION }} - uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 + uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2 with: php-version: ${{ env.PHP_VERSION }} coverage: none @@ -75,7 +75,7 @@ jobs: - name: Check composer.json id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 with: files: "${{ env.APP_NAME }}/composer.json" @@ -97,7 +97,7 @@ jobs: - name: Check Krankerl config id: krankerl - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 with: files: ${{ env.APP_NAME }}/krankerl.toml @@ -151,7 +151,7 @@ jobs: tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }} - name: Attach tarball to github release - uses: svenstaro/upload-release-action@1beeb572c19a9242f4361f4cee78f8e0d9aec5df # v2 + uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2 id: attach_to_release with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml new file mode 100644 index 0000000000..697a379da4 --- /dev/null +++ b/.github/workflows/behat-mariadb.yml @@ -0,0 +1,162 @@ +name: Behat MariaDB + +on: pull_request + +permissions: + contents: read + +concurrency: + group: behat-mariadb-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + + 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' + + behat-mariadb: + runs-on: ubuntu-latest + + needs: [changes] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] + 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 + mailhog: + image: mailhog/mailhog + ports: + - 8025:8025/tcp + - 1025:1025/tcp + + steps: + - name: Set app env + run: | + # Split and keep last + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + + - name: Checkout server + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + submodules: true + repository: nextcloud/server + ref: ${{ matrix.server-versions }} + + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 + with: + php-version: ${{ matrix.php-versions }} + tools: phpunit + # 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: Set up dependencies + working-directory: apps/${{ env.APP_NAME }} + run: | + composer install --no-dev + composer --working-dir=tests/integration install + + - name: Prevent Nextcloud OCP outdated + working-directory: apps/${{ env.APP_NAME }} + run: make updateocp + + - name: Set up Nextcloud + env: + DB_PORT: 4444 + run: | + sudo echo "127.0.0.1 mailhog" | sudo tee -a /etc/hosts + 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 --version + ./occ app:enable --force ${{ env.APP_NAME }} + git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/notifications apps/notifications + ./occ app:enable --force notifications + git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/activity apps/activity + ./occ app:enable --force activity + ./occ config:system:set mail_smtpport --value 1025 --type integer + ./occ config:system:set mail_smtphost --value mailhog + ./occ config:system:set allow_local_remote_servers --value true --type boolean + + - name: Run behat + working-directory: apps/${{ env.APP_NAME }}/tests/integration + env: + BEHAT_ROOT_DIR: ../../../../ + run: | + export BEHAT_RUN_AS=runner + export BEHAT_VERBOSE="$RUNNER_DEBUG" + vendor/bin/behat -f junit -f pretty --colors + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, behat-mariadb] + + if: always() + + name: behat-mariadb-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.behat-mariadb.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml new file mode 100644 index 0000000000..8fc5388cee --- /dev/null +++ b/.github/workflows/behat-mysql.yml @@ -0,0 +1,170 @@ +name: Behat MySQL + +on: pull_request + +permissions: + contents: read + +concurrency: + group: behat-mysql-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + + 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' + + behat-mysql: + runs-on: ubuntu-latest + + needs: [changes] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] + mysql-versions: ['8.1'] + + name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} + + services: + mysql: + 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 10 + mailhog: + image: mailhog/mailhog + ports: + - 8025:8025/tcp + - 1025:1025/tcp + + steps: + - name: Set app env + run: | + # Split and keep last + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + + - name: Checkout server + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + submodules: true + repository: nextcloud/server + ref: ${{ matrix.server-versions }} + + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 + with: + php-version: ${{ matrix.php-versions }} + tools: phpunit + # 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: 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 install --no-dev + composer --working-dir=tests/integration install + + - name: Prevent Nextcloud OCP outdated + working-directory: apps/${{ env.APP_NAME }} + run: make updateocp + + - name: Set up Nextcloud + env: + DB_PORT: 4444 + run: | + sudo echo "127.0.0.1 mailhog" | sudo tee -a /etc/hosts + 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 --version + ./occ app:enable --force ${{ env.APP_NAME }} + git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/notifications apps/notifications + ./occ app:enable --force notifications + git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/activity apps/activity + ./occ app:enable --force activity + ./occ config:system:set mail_smtpport --value 1025 --type integer + ./occ config:system:set mail_smtphost --value mailhog + ./occ config:system:set allow_local_remote_servers --value true --type boolean + + - name: Run behat + working-directory: apps/${{ env.APP_NAME }}/tests/integration + env: + BEHAT_ROOT_DIR: ../../../../ + run: | + export BEHAT_RUN_AS=runner + export BEHAT_VERBOSE="$RUNNER_DEBUG" + vendor/bin/behat -f junit -f pretty --colors + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, behat-mysql] + + if: always() + + name: behat-mysql-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.behat-mysql.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml new file mode 100644 index 0000000000..8b66a15be7 --- /dev/null +++ b/.github/workflows/behat-pgsql.yml @@ -0,0 +1,166 @@ +name: Behat PostgreSQL + +on: pull_request + +permissions: + contents: read + +concurrency: + group: behat-pgsql-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + + 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' + + behat-pgsql: + runs-on: ubuntu-latest + + needs: [changes] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] + + name: PostgreSQL PHP ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} + + services: + postgres: + image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest + ports: + - 4444:5432/tcp + env: + POSTGRES_USER: root + POSTGRES_PASSWORD: rootpassword + POSTGRES_DB: nextcloud + options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 + mailhog: + image: mailhog/mailhog + ports: + - 8025:8025/tcp + - 1025:1025/tcp + + steps: + - name: Set app env + run: | + # Split and keep last + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + + - name: Checkout server + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + submodules: true + repository: nextcloud/server + ref: ${{ matrix.server-versions }} + + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 + with: + php-version: ${{ matrix.php-versions }} + tools: phpunit + # 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 dependencies + # 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 + composer --working-dir=tests/integration install + + - name: Prevent Nextcloud OCP outdated + working-directory: apps/${{ env.APP_NAME }} + run: make updateocp + + - name: Set up Nextcloud + env: + DB_PORT: 4444 + run: | + sudo echo "127.0.0.1 mailhog" | sudo tee -a /etc/hosts + 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 admin + ./occ --version + ./occ app:enable --force ${{ env.APP_NAME }} + git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/notifications apps/notifications + ./occ app:enable --force notifications + git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/activity apps/activity + ./occ app:enable --force activity + ./occ config:system:set mail_smtpport --value 1025 --type integer + ./occ config:system:set mail_smtphost --value mailhog + ./occ config:system:set allow_local_remote_servers --value true --type boolean + + - name: Run behat + working-directory: apps/${{ env.APP_NAME }}/tests/integration + env: + BEHAT_ROOT_DIR: ../../../../ + run: | + export BEHAT_RUN_AS=runner + export BEHAT_VERBOSE="$RUNNER_DEBUG" + vendor/bin/behat -f junit -f pretty --colors + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, behat-pgsql] + + if: always() + + name: behat-pgsql-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.behat-pgsql.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml new file mode 100644 index 0000000000..bbf84b0f42 --- /dev/null +++ b/.github/workflows/behat-sqlite.yml @@ -0,0 +1,157 @@ +name: Behat SQLite + +on: pull_request + +permissions: + contents: read + +concurrency: + group: behat-sqlite-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + + 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' + + behat-sqlite: + runs-on: ubuntu-latest + + needs: [changes] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] + + name: SQLite PHP ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} + + services: + mailhog: + image: mailhog/mailhog + ports: + - 8025:8025/tcp + - 1025:1025/tcp + + steps: + - name: Set app env + run: | + # Split and keep last + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + + - name: Checkout server + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + submodules: true + repository: nextcloud/server + ref: ${{ matrix.server-versions }} + + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 + with: + php-version: ${{ matrix.php-versions }} + tools: phpunit + # 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 dependencies + # 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 + composer --working-dir=tests/integration install + + - name: Prevent Nextcloud OCP outdated + working-directory: apps/${{ env.APP_NAME }} + run: make updateocp + + - name: Set up Nextcloud + env: + DB_PORT: 4444 + run: | + sudo echo "127.0.0.1 mailhog" | sudo tee -a /etc/hosts + 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 admin + ./occ --version + ./occ app:enable --force ${{ env.APP_NAME }} + git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/notifications apps/notifications + ./occ app:enable --force notifications + git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/activity apps/activity + ./occ app:enable --force activity + ./occ config:system:set mail_smtpport --value 1025 --type integer + ./occ config:system:set mail_smtphost --value mailhog + ./occ config:system:set allow_local_remote_servers --value true --type boolean + + - name: Run behat + working-directory: apps/${{ env.APP_NAME }}/tests/integration + env: + BEHAT_ROOT_DIR: ../../../../ + run: | + export BEHAT_RUN_AS=runner + export BEHAT_VERBOSE="$RUNNER_DEBUG" + vendor/bin/behat -f junit -f pretty --colors + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, behat-sqlite] + + if: always() + + name: behat-sqlite-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.behat-sqlite.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/behat.yml b/.github/workflows/behat.yml deleted file mode 100644 index 50513760e4..0000000000 --- a/.github/workflows/behat.yml +++ /dev/null @@ -1,127 +0,0 @@ -name: Behat - -on: - pull_request: - paths: - - '.github/workflows/**' - - 'appinfo/**' - - 'lib/**' - - 'templates/**' - - 'tests/**' - - 'vendor/**' - - 'vendor-bin/**' - - '.php-cs-fixer.dist.php' - - 'composer.json' - - 'composer.lock' - push: - branches: - - main - - stable* - -env: - APP_NAME: libresign - -jobs: - behat: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - php-versions: ['8.0', '8.1', '8.2'] - databases: ['sqlite', 'mysql', 'pgsql'] - server-versions: ['stable28'] - - name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }} - - services: - postgres: - image: postgres:15 - ports: - - 4445:5432/tcp - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: rootpassword - POSTGRES_DB: nextcloud - options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 - mysql: - image: ghcr.io/nextcloud/continuous-integration-mariadb-10.6:latest - ports: - - 4444:3306/tcp - env: - MYSQL_ROOT_PASSWORD: rootpassword - options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5 - mailhog: - image: mailhog/mailhog - ports: - - 8025:8025/tcp - - 1025:1025/tcp - - steps: - - name: Checkout server - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - repository: nextcloud/server - ref: ${{ matrix.server-versions }} - - - name: Checkout submodules - shell: bash - run: | - auth_header="$(git config --local --get http.https://github.com/.extraheader)" - git submodule sync --recursive - git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 - - - name: Checkout app - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - path: apps/${{ env.APP_NAME }} - - - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # 2.30.0 - with: - php-version: ${{ matrix.php-versions }} - tools: phpunit - extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, mysql, pdo_mysql, pgsql, pdo_pgsql, - coverage: none - - - name: Set up dependencies - working-directory: apps/${{ env.APP_NAME }} - run: | - composer install --no-dev - composer --working-dir=tests/integration install - - - name: Set up Nextcloud - run: | - if [ "${{ matrix.databases }}" = "mysql" ]; then - export DB_PORT=4444 - elif [ "${{ matrix.databases }}" = "pgsql" ]; then - export DB_PORT=4445 - fi - sudo echo "127.0.0.1 mailhog" | sudo tee -a /etc/hosts - mkdir data - ./occ maintenance:install \ - --verbose \ - --database=${{ matrix.databases }} \ - --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 ${{ env.APP_NAME }} - git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/notifications apps/notifications - ./occ app:enable --force notifications - git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/activity apps/activity - ./occ app:enable --force activity - ./occ config:system:set mail_smtpport --value 1025 --type integer - ./occ config:system:set mail_smtphost --value mailhog - ./occ config:system:set allow_local_remote_servers --value true --type boolean - - - name: Run behat - working-directory: apps/${{ env.APP_NAME }}/tests/integration - env: - BEHAT_ROOT_DIR: ../../../../ - run: | - export BEHAT_RUN_AS=runner - export BEHAT_VERBOSE="$RUNNER_DEBUG" - vendor/bin/behat -f junit -f pretty --colors diff --git a/.github/workflows/block-unconventional-commits.yml b/.github/workflows/block-unconventional-commits.yml new file mode 100644 index 0000000000..90dd0879a8 --- /dev/null +++ b/.github/workflows/block-unconventional-commits.yml @@ -0,0 +1,31 @@ +# 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: Block unconventional commits + +on: + pull_request: + types: [opened, ready_for_review, reopened, synchronize] + +permissions: + contents: read + +concurrency: + group: block-unconventional-commits-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + block-unconventional-commits: + name: Block unconventional commits + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - uses: webiny/action-conventional-commits@8bc41ff4e7d423d56fa4905f6ff79209a78776c7 # v1.3.0 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/command-rebase.yml b/.github/workflows/command-rebase.yml index 1b388439bd..ec95ccbbf4 100644 --- a/.github/workflows/command-rebase.yml +++ b/.github/workflows/command-rebase.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Add reaction on start - uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # v2.1.0 + uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b # v3.0.1 with: token: ${{ secrets.COMMAND_BOT_PAT }} repository: ${{ github.event.repository.full_name }} @@ -31,18 +31,18 @@ jobs: reaction-type: "+1" - name: Checkout the latest code - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 with: fetch-depth: 0 token: ${{ secrets.COMMAND_BOT_PAT }} - name: Automatic Rebase - uses: cirrus-actions/rebase@6e572f08c244e2f04f9beb85a943eb618218714d # 1.7 + uses: cirrus-actions/rebase@b87d48154a87a85666003575337e27b8cd65f691 # 1.8 env: GITHUB_TOKEN: ${{ secrets.COMMAND_BOT_PAT }} - name: Add reaction on failure - uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # v2.1.0 + uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b # v3.0.1 if: failure() with: token: ${{ secrets.COMMAND_BOT_PAT }} diff --git a/.github/workflows/dependabot-approve-merge.yml b/.github/workflows/dependabot-approve-merge.yml index f5f4fe7aa7..e81d209bf7 100644 --- a/.github/workflows/dependabot-approve-merge.yml +++ b/.github/workflows/dependabot-approve-merge.yml @@ -21,7 +21,7 @@ concurrency: jobs: auto-approve-merge: - if: github.actor == 'dependabot[bot]' + if: github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]' runs-on: ubuntu-latest permissions: # for hmarr/auto-approve-action to approve PRs @@ -29,12 +29,12 @@ jobs: steps: # Github actions bot approve - - uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v3.2.1 + - uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} # Nextcloud bot approve and merge request - - uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2.6.6 + - uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2 with: target: minor github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }} diff --git a/.github/workflows/dependabot-approve.yml b/.github/workflows/dependabot-approve.yml deleted file mode 100644 index 89c7e2d5d4..0000000000 --- a/.github/workflows/dependabot-approve.yml +++ /dev/null @@ -1,12 +0,0 @@ - -name: Dependabot auto approve -on: pull_request_target - -jobs: - auto-aprove: - runs-on: ubuntu-latest - permissions: - pull-requests: write - if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' - steps: - - uses: hmarr/auto-approve-action@v3 diff --git a/.github/workflows/lint-eslint-when-unrelated.yml b/.github/workflows/lint-eslint-when-unrelated.yml deleted file mode 100644 index 7a2e9f0581..0000000000 --- a/.github/workflows/lint-eslint-when-unrelated.yml +++ /dev/null @@ -1,39 +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 -# -# 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 eslint - -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 99b624d1a6..5c3d3c6bc3 100644 --- a/.github/workflows/lint-eslint.yml +++ b/.github/workflows/lint-eslint.yml @@ -25,7 +25,7 @@ jobs: src: ${{ steps.changes.outputs.src}} steps: - - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes continue-on-error: true with: @@ -56,14 +56,14 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - 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' - fallbackNpm: '^9' + fallbackNpm: '^10' - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3 with: node-version: ${{ steps.versions.outputs.nodeVersion }} diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml index c23fc7c401..497533e8f6 100644 --- a/.github/workflows/lint-php-cs.yml +++ b/.github/workflows/lint-php-cs.yml @@ -25,9 +25,10 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Set up php8.2 - uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 with: php-version: 8.2 + 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: diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml index 92769c49f9..a965ecc73c 100644 --- a/.github/workflows/lint-php.yml +++ b/.github/workflows/lint-php.yml @@ -15,11 +15,23 @@ concurrency: cancel-in-progress: true jobs: + matrix: + runs-on: ubuntu-latest + outputs: + php-versions: ${{ steps.versions.outputs.php-versions }} + steps: + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - 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 @@ -28,9 +40,10 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 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: diff --git a/.github/workflows/lint-stylelint.yml b/.github/workflows/lint-stylelint.yml index 684bb6198e..6ff950466f 100644 --- a/.github/workflows/lint-stylelint.yml +++ b/.github/workflows/lint-stylelint.yml @@ -25,14 +25,14 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - 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' - fallbackNpm: '^9' + fallbackNpm: '^10' - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3 with: node-version: ${{ steps.versions.outputs.nodeVersion }} diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 75c32b44b6..7a5c90688d 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -22,7 +22,7 @@ jobs: src: ${{ steps.changes.outputs.src}} steps: - - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes continue-on-error: true with: @@ -50,14 +50,14 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - 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' - fallbackNpm: '^9' + fallbackNpm: '^10' - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3 with: node-version: ${{ steps.versions.outputs.nodeVersion }} diff --git a/.github/workflows/npm-audit-fix.yml b/.github/workflows/npm-audit-fix.yml index 0dd7355835..d5ad1c0090 100644 --- a/.github/workflows/npm-audit-fix.yml +++ b/.github/workflows/npm-audit-fix.yml @@ -18,8 +18,8 @@ jobs: strategy: fail-fast: false matrix: - branches: ['main', 'stable28'] - + branches: ['stable28'] + name: npm-audit-fix-${{ matrix.branches }} steps: @@ -29,14 +29,14 @@ jobs: ref: ${{ matrix.branches }} - 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' - fallbackNpm: '^9' + fallbackNpm: '^10' - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3 with: node-version: ${{ steps.versions.outputs.nodeVersion }} @@ -57,10 +57,10 @@ jobs: - name: Create Pull Request if: always() - uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5 + uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc # v6.0.1 with: token: ${{ secrets.COMMAND_BOT_PAT }} - commit-message: "chore(deps): fix npm audit" + commit-message: "fix(deps): fix npm audit" committer: GitHub author: nextcloud-command signoff: true diff --git a/.github/workflows/phpunit-mariadb.yml b/.github/workflows/phpunit-mariadb.yml new file mode 100644 index 0000000000..5bfceb75bb --- /dev/null +++ b/.github/workflows/phpunit-mariadb.yml @@ -0,0 +1,195 @@ +# 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: PHPUnit MariaDB + +on: pull_request + +permissions: + contents: read + +concurrency: + group: phpunit-mariadb-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + + 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] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] + mariadb-versions: ['10.6', '10.11'] + coverage: ['xdebug'] + testsuite: [unit, api] + xdebug_mode: ['debug'] + + 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + submodules: true + repository: nextcloud/server + ref: ${{ matrix.server-versions }} + + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 + 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: ${{ matrix.coverage }} + 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: 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 + + - name: Prevent Nextcloud OCP outdated + working-directory: apps/${{ env.APP_NAME }} + run: make updateocp + + - name: Checkout site + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: libresign/libresign.github.io + path: 'apps/${{ env.APP_NAME }}/build/site' + + - 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 --version + ./occ app:enable --force ${{ env.APP_NAME }} + + # - name: Set up dependencies apps + # run: | + # ./occ app:install --force --keep-disabled twofactor_gateway + # ./occ app:enable --force twofactor_gateway + + - name: Run Nextcloud + run: php -S localhost:8080 & + + - name: PHPUnit + working-directory: apps/${{ env.APP_NAME }} + env: + XDEBUG_MODE: ${{ matrix.xdebug_mode }} + run: ./vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + 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 + + upload-coverage: + needs: [changes, phpunit-mariadb] + runs-on: ubuntu-latest + steps: + - name: Upload coverage results to Coveralls + working-directory: apps/${{ env.APP_NAME }} + if: matrix.xdebug_mode == 'coverage' + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_PARALLEL: true + COVERALLS_FLAG_NAME: php-${{ matrix.php-versions }} + run: vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml --json_path=build/logs/coveralls-upload.json -v + finish-coverage: + needs: upload-coverage + runs-on: ubuntu-latest + steps: + - name: Let Coveralls know that all tests have finished + uses: coverallsapp/github-action@v2.0.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml new file mode 100644 index 0000000000..88afdd74a0 --- /dev/null +++ b/.github/workflows/phpunit-mysql.yml @@ -0,0 +1,195 @@ +# 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: PHPUnit MySQL + +on: pull_request + +permissions: + contents: read + +concurrency: + group: phpunit-mysql-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + + 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] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] + mysql-versions: ['8.1'] + coverage: ['xdebug'] + testsuite: [unit, api] + xdebug_mode: ['debug'] + + name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} Testsuite ${{ matrix.testsuite }} + + services: + mysql: + 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 10 + + steps: + - name: Set app env + run: | + # Split and keep last + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + + - name: Checkout server + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + submodules: true + repository: nextcloud/server + ref: ${{ matrix.server-versions }} + + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 + 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, sqlite, pdo_sqlite + coverage: ${{ matrix.coverage }} + ini-file: development + 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: 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 + + - name: Prevent Nextcloud OCP outdated + working-directory: apps/${{ env.APP_NAME }} + run: make updateocp + + - name: Checkout site + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: libresign/libresign.github.io + path: 'apps/${{ env.APP_NAME }}/build/site' + + - 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 --version + ./occ app:enable --force ${{ env.APP_NAME }} + + # - name: Set up dependencies apps + # run: | + # ./occ app:install --force --keep-disabled twofactor_gateway + # ./occ app:enable --force twofactor_gateway + + - name: Run Nextcloud + run: php -S localhost:8080 & + + - name: PHPUnit + working-directory: apps/${{ env.APP_NAME }} + env: + XDEBUG_MODE: ${{ matrix.xdebug_mode }} + run: ./vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, phpunit-mysql] + + if: always() + + name: phpunit-mysql-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi + + upload-coverage: + needs: [changes, phpunit-mysql] + runs-on: ubuntu-latest + steps: + - name: Upload coverage results to Coveralls + working-directory: apps/${{ env.APP_NAME }} + if: matrix.xdebug_mode == 'coverage' + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_PARALLEL: true + COVERALLS_FLAG_NAME: php-${{ matrix.php-versions }} + run: vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml --json_path=build/logs/coveralls-upload.json -v + finish-coverage: + needs: upload-coverage + runs-on: ubuntu-latest + steps: + - name: Let Coveralls know that all tests have finished + uses: coverallsapp/github-action@v2.0.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml new file mode 100644 index 0000000000..c7758c22af --- /dev/null +++ b/.github/workflows/phpunit-pgsql.yml @@ -0,0 +1,191 @@ +# 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: PHPUnit PostgreSQL + +on: pull_request + +permissions: + contents: read + +concurrency: + group: phpunit-pgsql-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + + 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] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] + coverage: ['xdebug'] + testsuite: [unit, api] + xdebug_mode: ['debug'] + + name: PostgreSQL PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} + + services: + postgres: + image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest + ports: + - 4444:5432/tcp + env: + POSTGRES_USER: root + POSTGRES_PASSWORD: rootpassword + POSTGRES_DB: nextcloud + options: --health-cmd pg_isready --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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + submodules: true + repository: nextcloud/server + ref: ${{ matrix.server-versions }} + + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 + 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, pgsql, pdo_pgsql + coverage: ${{ matrix.coverage }} + 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 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 + + - name: Prevent Nextcloud OCP outdated + working-directory: apps/${{ env.APP_NAME }} + run: make updateocp + + - name: Checkout site + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: libresign/libresign.github.io + path: 'apps/${{ env.APP_NAME }}/build/site' + + - name: Set up Nextcloud + env: + 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 admin + ./occ --version + ./occ app:enable --force ${{ env.APP_NAME }} + + # - name: Set up dependencies apps + # run: | + # ./occ app:install --force --keep-disabled twofactor_gateway + # ./occ app:enable --force twofactor_gateway + + - name: Run Nextcloud + run: php -S localhost:8080 & + + - name: PHPUnit + working-directory: apps/${{ env.APP_NAME }} + env: + XDEBUG_MODE: ${{ matrix.xdebug_mode }} + run: ./vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, phpunit-pgsql] + + if: always() + + name: phpunit-pgsql-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi + + upload-coverage: + needs: [changes, phpunit-pgsql] + runs-on: ubuntu-latest + steps: + - name: Upload coverage results to Coveralls + working-directory: apps/${{ env.APP_NAME }} + if: matrix.xdebug_mode == 'coverage' + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_PARALLEL: true + COVERALLS_FLAG_NAME: php-${{ matrix.php-versions }} + run: vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml --json_path=build/logs/coveralls-upload.json -v + finish-coverage: + needs: upload-coverage + runs-on: ubuntu-latest + steps: + - name: Let Coveralls know that all tests have finished + uses: coverallsapp/github-action@v2.0.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml new file mode 100644 index 0000000000..ad912d1aa5 --- /dev/null +++ b/.github/workflows/phpunit-sqlite.yml @@ -0,0 +1,186 @@ +# 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: PHPUnit SQLite + +on: pull_request + +permissions: + contents: read + +concurrency: + group: phpunit-sqlite-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + + 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] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] + coverage: ['xdebug'] + testsuite: [unit, api] + xdebug_mode: ['debug'] + include: + - php-versions: '8.2' + coverage: xdebug + testsuite: default + xdebug_mode: coverage + server-versions: stable28 + + name: SQLite PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} Testsuite ${{ matrix.testsuite }} + + steps: + - name: Set app env + run: | + # Split and keep last + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + + - name: Checkout server + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + submodules: true + repository: nextcloud/server + ref: ${{ matrix.server-versions }} + + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 + 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, sqlite, pdo_sqlite + coverage: ${{ matrix.coverage }} + 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 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 + + - name: Prevent Nextcloud OCP outdated + working-directory: apps/${{ env.APP_NAME }} + run: make updateocp + + - name: Checkout site + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: libresign/libresign.github.io + path: 'apps/${{ env.APP_NAME }}/build/site' + + - name: Set up Nextcloud + env: + 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 admin + ./occ --version + ./occ app:enable --force ${{ env.APP_NAME }} + + # - name: Set up dependencies apps + # run: | + # ./occ app:install --force --keep-disabled twofactor_gateway + # ./occ app:enable --force twofactor_gateway + + - name: Run Nextcloud + run: php -S localhost:8080 & + + - name: PHPUnit + working-directory: apps/${{ env.APP_NAME }} + env: + XDEBUG_MODE: ${{ matrix.xdebug_mode }} + run: ./vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, phpunit-sqlite] + + if: always() + + name: phpunit-sqlite-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi + + upload-coverage: + needs: [changes, phpunit-sqlite] + runs-on: ubuntu-latest + steps: + - name: Upload coverage results to Coveralls + working-directory: apps/${{ env.APP_NAME }} + if: matrix.xdebug_mode == 'coverage' + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_PARALLEL: true + COVERALLS_FLAG_NAME: php-${{ matrix.php-versions }} + run: vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml --json_path=build/logs/coveralls-upload.json -v + finish-coverage: + needs: upload-coverage + runs-on: ubuntu-latest + steps: + - name: Let Coveralls know that all tests have finished + uses: coverallsapp/github-action@v2.0.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml deleted file mode 100644 index a53b1727e6..0000000000 --- a/.github/workflows/phpunit.yml +++ /dev/null @@ -1,138 +0,0 @@ -name: PHPUnit - -on: - pull_request: - paths: - - '.github/workflows/**' - - 'appinfo/**' - - 'lib/**' - - 'templates/**' - - 'tests/**' - - 'vendor/**' - - 'vendor-bin/**' - - '.php-cs-fixer.dist.php' - - 'composer.json' - - 'composer.lock' - - push: - branches: - - main - - master - - stable* - -env: - APP_NAME: libresign - -jobs: - phpunit: - runs-on: ubuntu-latest - strategy: - # do not stop on another job's failure - fail-fast: false - matrix: - php-versions: ['8.0', '8.1', '8.2'] - databases: ['sqlite'] - coverage: ['xdebug'] - testsuite: [unit, api] - xdebug_mode: ['debug'] - server-versions: ['stable28'] - include: - - php-versions: '8.0' - databases: sqlite - coverage: xdebug - testsuite: default - xdebug_mode: debug - server-versions: stable28 - name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}-${{ matrix.testsuite }} - - steps: - - name: Checkout server - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - repository: nextcloud/server - ref: ${{ matrix.server-versions }} - - - name: Checkout submodules - shell: bash - run: | - auth_header="$(git config --local --get http.https://github.com/.extraheader)" - git submodule sync --recursive - git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 - - - name: Checkout app - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - path: apps/${{ env.APP_NAME }} - - - name: Checkout site - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - repository: libresign/libresign.github.io - path: 'apps/${{ env.APP_NAME }}/build/site' - - - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - coverage: ${{ matrix.coverage }} - tools: phpunit - extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite - - - name: Set up PHP dependencies - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - name: Prevent Nextcloud OCP outdated - working-directory: apps/${{ env.APP_NAME }} - run: make updateocp - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - run: | - mkdir data - ./occ maintenance:install \ - --verbose \ - --database=${{ matrix.databases }} \ - --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 - - name: Enable app - run: | - ./occ app:enable ${{ env.APP_NAME }} - - name: Start built in server - run: | - php -S localhost:8080 & - - name: Set up dependencies apps - run: | - ./occ app:install --force --keep-disabled twofactor_gateway - ./occ app:enable --force twofactor_gateway - - name: PHPUnit - working-directory: apps/${{ env.APP_NAME }} - env: - XDEBUG_MODE: ${{ matrix.xdebug_mode }} - run: ./vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} - upload-coverage: - needs: phpunit - runs-on: ubuntu-latest - steps: - - name: Upload coverage results to Coveralls - working-directory: apps/${{ env.APP_NAME }} - if: matrix.xdebug_mode == 'coverage' - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_PARALLEL: true - COVERALLS_FLAG_NAME: php-${{ matrix.php-versions }} - run: vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml --json_path=build/logs/coveralls-upload.json -v - finish-coverage: - needs: upload-coverage - runs-on: ubuntu-latest - steps: - - name: Let Coveralls know that all tests have finished - uses: coverallsapp/github-action@v2.0.0 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - parallel-finished: true diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml index 302873bcd2..e3a573a3da 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -15,15 +15,16 @@ jobs: static-analysis: runs-on: ubuntu-latest - name: Nextcloud + name: static-psalm-analysis steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Set up php8.2 - uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 with: php-version: 8.2 + 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: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index bf74002e07..0000000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Release Drafter - -on: - push: - # branches to consider in the event; optional, defaults to all - branches: - - stable* - -jobs: - update_release_draft: - runs-on: ubuntu-latest - steps: - - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-nextcloud-ocp.yml b/.github/workflows/update-nextcloud-ocp.yml index 174cdb71a4..952e9731f1 100644 --- a/.github/workflows/update-nextcloud-ocp.yml +++ b/.github/workflows/update-nextcloud-ocp.yml @@ -17,51 +17,98 @@ jobs: strategy: fail-fast: false matrix: - include: - - branch: main - ocp: stable28 + branches: ['stable28'] - name: update-nextcloud-ocp-${{ matrix.ocp }} + name: update-nextcloud-ocp-${{ matrix.branches }} steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - id: checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: - ref: ${{ matrix.branch }} + ref: ${{ matrix.branches }} submodules: true + continue-on-error: true - name: Set up php8.2 - uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 + if: steps.checkout.outcome == 'success' + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 with: php-version: 8.2 - extensions: ctype,curl,dom,fileinfo,gd,intl,json,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip + # 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 - run: composer require --dev nextcloud/ocp:dev-${{ matrix.ocp }} - continue-on-error: true + 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: Reset checkout dirs + - 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 3rdparty vendor vendor-bin + git checkout vendor-bin continue-on-error: true - name: Create Pull Request - uses: peter-evans/create-pull-request@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 # v4 + if: steps.checkout.outcome == 'success' + uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc # v6.0.1 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.branch }}-update-nextcloud-ocp - title: "[${{ matrix.branch }}] Update nextcloud/ocp dependency" + 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: | diff --git a/.github/workflows/update-psalm-baseline.yml b/.github/workflows/update-psalm-baseline.yml new file mode 100644 index 0000000000..d621ade08c --- /dev/null +++ b/.github/workflows/update-psalm-baseline.yml @@ -0,0 +1,64 @@ +name: Update Psalm baseline + +on: + workflow_dispatch: + schedule: + - cron: "5 2 * * *" + +jobs: + update-psalm-baseline: + runs-on: ubuntu-latest + + if: ${{ github.repository_owner != 'nextcloud-gmbh' }} + + strategy: + fail-fast: false + matrix: + branches: ["stable28"] + + name: update-psalm-baseline-${{ matrix.branches }} + + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ matrix.branches }} + submodules: true + + - 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 + 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: Psalm + run: composer run psalm:update-baseline -- --monochrome --no-progress --output-format=text + continue-on-error: true + + - name: Create Pull Request + uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc + with: + token: ${{ secrets.COMMAND_BOT_PAT }} + commit-message: Update psalm baseline + committer: GitHub + author: nextcloud-command + signoff: true + branch: automated/noid/${{ matrix.branches }}-update-psalm-baseline + title: "[${{ matrix.branches }}] Update psalm-baseline.xml" + body: | + Auto-generated update psalm-baseline.xml with fixed psalm warnings + labels: | + automated pr + 3. to review + team-reviewers: server-backend diff --git a/appinfo/info.xml b/appinfo/info.xml index 2587e4024a..ecf8dfa4a7 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -9,7 +9,7 @@ ]]> - 8.0.0-rc9 + 8.0.0-rc10 agpl LibreCode @@ -22,7 +22,7 @@ https://t.me/libresign https://github.com/LibreSign/libresign/issues https://github.com/LibreSign/libresign - https://raw.githubusercontent.com/LibreSign/libresign/main/img/LibreSign.png?v=8.0.0-rc9 + https://raw.githubusercontent.com/LibreSign/libresign/main/img/LibreSign.png?v=8.0.0-rc10 openssl diff --git a/lib/Controller/SignFileController.php b/lib/Controller/SignFileController.php index 4fc1820617..cc67ac2377 100644 --- a/lib/Controller/SignFileController.php +++ b/lib/Controller/SignFileController.php @@ -36,7 +36,6 @@ use OCA\Libresign\Service\FileService; use OCA\Libresign\Service\IdentifyMethodService; use OCA\Libresign\Service\SignFileService; -use OCA\TwoFactorGateway\Exception\SmsTransmissionException; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; @@ -212,10 +211,10 @@ private function getCode(string $uuid = null, int $fileId = null): JSONResponse ); $message = $this->l10n->t('The code to sign file was successfully requested.'); $statusCode = Http::STATUS_OK; - } catch (SmsTransmissionException $e) { - // There was an error when to send SMS code to user. - $message = $this->l10n->t('Failed to send code.'); - $statusCode = Http::STATUS_UNPROCESSABLE_ENTITY; + // } catch (\OCA\TwoFactorGateway\Exception\SmsTransmissionException $e) { + // // There was an error when to send SMS code to user. + // $message = $this->l10n->t('Failed to send code.'); + // $statusCode = Http::STATUS_UNPROCESSABLE_ENTITY; } catch (\Throwable $th) { $message = $th->getMessage(); $statusCode = Http::STATUS_UNPROCESSABLE_ENTITY; diff --git a/lib/Db/AccountFileMapper.php b/lib/Db/AccountFileMapper.php index 023fa0b34b..288137ba4f 100644 --- a/lib/Db/AccountFileMapper.php +++ b/lib/Db/AccountFileMapper.php @@ -136,6 +136,7 @@ private function getUserAccountFile(array $filter = [], bool $count = false): Pa 'f.uuid', 'f.name', 'f.callback', + 'f.status', 'f.node_id', 'f.created_at', 'af.file_type', diff --git a/package-lock.json b/package-lock.json index abce05ded7..44daefe9f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "libresign", - "version": "8.0.0-rc9", + "version": "8.0.0-rc10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "libresign", - "version": "8.0.0-rc9", + "version": "8.0.0-rc10", "license": "agpl", "dependencies": { "@fontsource/dancing-script": "^5.0.17", diff --git a/package.json b/package.json index 8cf63409fa..04bfb9b93d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "libresign", "description": "A app for signing documents", - "version": "8.0.0-rc9", + "version": "8.0.0-rc10", "license": "agpl", "private": true, "scripts": { diff --git a/tests/Api/ApiRequester.php b/tests/Api/ApiRequester.php index 818c498f3c..b79c5dc0ea 100644 --- a/tests/Api/ApiRequester.php +++ b/tests/Api/ApiRequester.php @@ -28,7 +28,7 @@ protected function handleRequest(RequestInterface $request) { $response = Response::getInstance(http_response_code()); $response = $response->withBody(new Stream($body)); - $headers = xdebug_get_headers(); + $headers = \xdebug_get_headers(); foreach ($headers as $header) { $header = explode(': ', $header, 2); $response = $response->withHeader($header[0], $header[1]);