From 24a3ad2f0dfef84dcba93cb46904b542bade372e Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 10:15:45 -0300 Subject: [PATCH 01/12] feat: Bump version Signed-off-by: Vitor Mattos --- appinfo/info.xml | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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/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": { From 281b31d52437936b2fd16f836d9f91d57a581c05 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 10:21:59 -0300 Subject: [PATCH 02/12] feat: Bump appstore script Signed-off-by: Vitor Mattos --- .github/workflows/appstore-build-publish.yml | 27 +++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/appstore-build-publish.yml b/.github/workflows/appstore-build-publish.yml index 1438a64d67..40354ce638 100644 --- a/.github/workflows/appstore-build-publish.yml +++ b/.github/workflows/appstore-build-publish.yml @@ -9,9 +9,6 @@ on: release: types: [published] -env: - PHP_VERSION: 8.0 - jobs: build_and_publish: runs-on: ubuntu-latest @@ -21,7 +18,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 @@ -51,12 +48,12 @@ jobs: 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 }} @@ -65,17 +62,23 @@ jobs: if: ${{ steps.versions.outputs.npmVersion }} run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" - - name: Set up php ${{ env.PHP_VERSION }} - uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 + - name: Get php version + id: php-versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + with: + filename: ${{ env.APP_NAME }}/appinfo/info.xml + + - name: Set up php ${{ steps.php-versions.outputs.php-min }} + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 with: - php-version: ${{ env.PHP_VERSION }} + php-version: ${{ steps.php-versions.outputs.php-min }} coverage: none env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - 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 +100,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 +154,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 }} From c1270615796386ce993d532f1d7bb3c5860eb338 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 10:39:10 -0300 Subject: [PATCH 03/12] feat: Bump workflows Signed-off-by: Vitor Mattos --- .../block-unconventional-commits.yml | 31 ++++++++ .github/workflows/command-rebase.yml | 8 +- .../workflows/dependabot-approve-merge.yml | 6 +- .github/workflows/dependabot-approve.yml | 12 --- .../workflows/lint-eslint-when-unrelated.yml | 39 ---------- .github/workflows/lint-eslint.yml | 6 +- .github/workflows/lint-php-cs.yml | 11 ++- .github/workflows/lint-php.yml | 17 +++- .github/workflows/lint-stylelint.yml | 4 +- .github/workflows/node.yml | 6 +- .github/workflows/npm-audit-fix.yml | 12 +-- .github/workflows/psalm.yml | 13 +++- .github/workflows/release-drafter.yml | 15 ---- .../update-nextcloud-ocp-approve-merge.yml | 49 ++++++++++++ .github/workflows/update-nextcloud-ocp.yml | 77 +++++++++++++++---- 15 files changed, 195 insertions(+), 111 deletions(-) create mode 100644 .github/workflows/block-unconventional-commits.yml delete mode 100644 .github/workflows/dependabot-approve.yml delete mode 100644 .github/workflows/lint-eslint-when-unrelated.yml delete mode 100644 .github/workflows/release-drafter.yml create mode 100644 .github/workflows/update-nextcloud-ocp-approve-merge.yml 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..3d2cd33ecd 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: @@ -60,10 +60,10 @@ jobs: 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..1ffee78013 100644 --- a/.github/workflows/lint-php-cs.yml +++ b/.github/workflows/lint-php-cs.yml @@ -24,10 +24,15 @@ jobs: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Set up php8.2 - uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 + - 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: 8.2 + 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: 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..4effd42926 100644 --- a/.github/workflows/lint-stylelint.yml +++ b/.github/workflows/lint-stylelint.yml @@ -29,10 +29,10 @@ jobs: 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..d289e244dd 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: @@ -54,10 +54,10 @@ jobs: 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..a5f6741c89 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: ['main', 'stable29', 'stable28'] + name: npm-audit-fix-${{ matrix.branches }} steps: @@ -33,10 +33,10 @@ jobs: 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/psalm.yml b/.github/workflows/psalm.yml index 302873bcd2..b8e12b4e25 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -15,15 +15,20 @@ 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 + - 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: 8.2 + 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: 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-approve-merge.yml b/.github/workflows/update-nextcloud-ocp-approve-merge.yml new file mode 100644 index 0000000000..c3f571616f --- /dev/null +++ b/.github/workflows/update-nextcloud-ocp-approve-merge.yml @@ -0,0 +1,49 @@ +# 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: Auto approve nextcloud/ocp + +on: + pull_request_target: + branches: + - main + - master + - stable* + +permissions: + contents: read + +concurrency: + group: update-nextcloud-ocp-approve-merge-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + auto-approve-merge: + if: github.actor == 'nextcloud-command' + runs-on: ubuntu-latest + permissions: + # for hmarr/auto-approve-action to approve PRs + pull-requests: write + # for alexwilson/enable-github-automerge-action to approve PRs + contents: write + + steps: + - uses: mdecoleman/pr-branch-name@bab4c71506bcd299fb350af63bb8e53f2940a599 # v2.0.0 + id: branchname + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + # GitHub actions bot approve + - uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2 + if: startsWith(steps.branchname.outputs.branch, 'automated/noid/') && endsWith(steps.branchname.outputs.branch, 'update-nextcloud-ocp') + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + # Enable GitHub auto merge + - name: Auto merge + uses: alexwilson/enable-github-automerge-action@56e3117d1ae1540309dc8f7a9f2825bc3c5f06ff # main + if: startsWith(steps.branchname.outputs.branch, 'automated/noid/') && endsWith(steps.branchname.outputs.branch, 'update-nextcloud-ocp') + with: + 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: | From 243dbe9aa8b626bf45f91355e2c8d2779845cc35 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 12:13:09 -0300 Subject: [PATCH 04/12] refactor: split phpunit databases Signed-off-by: Vitor Mattos --- .github/workflows/phpunit-mariadb.yml | 207 ++++++++++++++++++++++++++ .github/workflows/phpunit-mysql.yml | 207 ++++++++++++++++++++++++++ .github/workflows/phpunit-pgsql.yml | 203 +++++++++++++++++++++++++ .github/workflows/phpunit-sqlite.yml | 198 ++++++++++++++++++++++++ 4 files changed, 815 insertions(+) create mode 100644 .github/workflows/phpunit-mariadb.yml create mode 100644 .github/workflows/phpunit-mysql.yml create mode 100644 .github/workflows/phpunit-pgsql.yml create mode 100644 .github/workflows/phpunit-sqlite.yml diff --git a/.github/workflows/phpunit-mariadb.yml b/.github/workflows/phpunit-mariadb.yml new file mode 100644 index 0000000000..38eefad34a --- /dev/null +++ b/.github/workflows/phpunit-mariadb.yml @@ -0,0 +1,207 @@ +# 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: + 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + + 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, matrix] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + mariadb-versions: ['10.6', '10.11'] + 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: 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: 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 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-low + needs: [changes, phpunit-mariadb] + + if: always() + + name: phpunit-mariadb-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi + + 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/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml new file mode 100644 index 0000000000..1025234c7c --- /dev/null +++ b/.github/workflows/phpunit-mysql.yml @@ -0,0 +1,207 @@ +# 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: + matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.versions.outputs.sparse-matrix }} + steps: + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + with: + matrix: '{"mysql-versions": ["8.1"]}' + + 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, matrix] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + 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: 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 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 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-low + needs: [changes, phpunit-mysql] + + if: always() + + name: phpunit-mysql-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi + + 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/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml new file mode 100644 index 0000000000..b3d69a8ed9 --- /dev/null +++ b/.github/workflows/phpunit-pgsql.yml @@ -0,0 +1,203 @@ +# 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: + 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + + 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, matrix] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + 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: 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 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 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-low + needs: [changes, phpunit-mariadb] + + if: always() + + name: phpunit-mariadb-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi + + 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/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml new file mode 100644 index 0000000000..d2cb2629f4 --- /dev/null +++ b/.github/workflows/phpunit-sqlite.yml @@ -0,0 +1,198 @@ +# 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: + 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + + 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, matrix] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + coverage: ['xdebug'] + testsuite: [unit, api] + xdebug_mode: ['debug'] + include: + - php-versions: '8.2' + coverage: xdebug + testsuite: default + xdebug_mode: coverage + server-versions: master + + 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: 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 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 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-low + 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: 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 From ec28c501420eea24e3b67a49093885b48d27443a Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 12:45:27 -0300 Subject: [PATCH 05/12] feat: split behat tests Signed-off-by: Vitor Mattos --- .github/workflows/behat-mariadb.yml | 175 ++++++++++++++++++++++++ .github/workflows/behat-mysql.yml | 183 ++++++++++++++++++++++++++ .github/workflows/behat-pgsql.yml | 179 +++++++++++++++++++++++++ .github/workflows/behat-sqlite.yml | 170 ++++++++++++++++++++++++ .github/workflows/phpunit-mariadb.yml | 25 ++-- .github/workflows/phpunit-mysql.yml | 25 ++-- .github/workflows/phpunit-pgsql.yml | 29 ++-- .github/workflows/phpunit-sqlite.yml | 23 ++-- tests/Api/ApiRequester.php | 2 +- 9 files changed, 761 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/behat-mariadb.yml create mode 100644 .github/workflows/behat-mysql.yml create mode 100644 .github/workflows/behat-pgsql.yml create mode 100644 .github/workflows/behat-sqlite.yml diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml new file mode 100644 index 0000000000..22067142d3 --- /dev/null +++ b/.github/workflows/behat-mariadb.yml @@ -0,0 +1,175 @@ +name: Behat MariaDB + +on: pull_request + +permissions: + contents: read + +concurrency: + group: behat-mariadb-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + + 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, matrix] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + mariadb-versions: ['10.6', '10.11'] + + name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} + + services: + mariadb: + image: ghcr.io/nextcloud/continuous-integration-mariadb-${{ matrix.mariadb-versions }}:latest + ports: + - 4444:3306/tcp + env: + MYSQL_ROOT_PASSWORD: rootpassword + options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5 + 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..167058160c --- /dev/null +++ b/.github/workflows/behat-mysql.yml @@ -0,0 +1,183 @@ +name: Behat MySQL + +on: pull_request + +permissions: + contents: read + +concurrency: + group: behat-mysql-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.versions.outputs.sparse-matrix }} + steps: + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + with: + matrix: '{"mysql-versions": ["8.1"]}' + + 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, matrix] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + + 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.phpunit-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..0df0826734 --- /dev/null +++ b/.github/workflows/behat-pgsql.yml @@ -0,0 +1,179 @@ +name: Behat PostgreSQL + +on: pull_request + +permissions: + contents: read + +concurrency: + group: behat-pgsql-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + + 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, matrix] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + + 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..900ff9fc8e --- /dev/null +++ b/.github/workflows/behat-sqlite.yml @@ -0,0 +1,170 @@ +name: Behat SQLite + +on: pull_request + +permissions: + contents: read + +concurrency: + group: behat-sqlite-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + + 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, matrix] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + + 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/phpunit-mariadb.yml b/.github/workflows/phpunit-mariadb.yml index 38eefad34a..c81da7de44 100644 --- a/.github/workflows/phpunit-mariadb.yml +++ b/.github/workflows/phpunit-mariadb.yml @@ -139,16 +139,17 @@ 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 + ./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 @@ -173,7 +174,7 @@ jobs: summary: permissions: contents: none - runs-on: ubuntu-latest-low + runs-on: ubuntu-latest needs: [changes, phpunit-mariadb] if: always() @@ -182,10 +183,10 @@ jobs: steps: - name: Summary status - run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mariadb.result != 'success' }}; then exit 1; fi upload-coverage: - needs: phpunit + needs: [changes, phpunit-mariadb] runs-on: ubuntu-latest steps: - name: Upload coverage results to Coveralls diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml index 1025234c7c..0361ede80f 100644 --- a/.github/workflows/phpunit-mysql.yml +++ b/.github/workflows/phpunit-mysql.yml @@ -139,16 +139,17 @@ 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 + ./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 @@ -173,7 +174,7 @@ jobs: summary: permissions: contents: none - runs-on: ubuntu-latest-low + runs-on: ubuntu-latest needs: [changes, phpunit-mysql] if: always() @@ -182,10 +183,10 @@ jobs: steps: - name: Summary status - run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi upload-coverage: - needs: phpunit + needs: [changes, phpunit-mysql] runs-on: ubuntu-latest steps: - name: Upload coverage results to Coveralls diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml index b3d69a8ed9..abfeedf8e5 100644 --- a/.github/workflows/phpunit-pgsql.yml +++ b/.github/workflows/phpunit-pgsql.yml @@ -135,16 +135,17 @@ 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 + ./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 @@ -169,19 +170,19 @@ jobs: summary: permissions: contents: none - runs-on: ubuntu-latest-low - needs: [changes, phpunit-mariadb] + runs-on: ubuntu-latest + needs: [changes, phpunit-pgsql] if: always() - name: phpunit-mariadb-summary + name: phpunit-pgsql-summary steps: - name: Summary status - run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi upload-coverage: - needs: phpunit + needs: [changes, phpunit-pgsql] runs-on: ubuntu-latest steps: - name: Upload coverage results to Coveralls diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml index d2cb2629f4..77cb53a5c4 100644 --- a/.github/workflows/phpunit-sqlite.yml +++ b/.github/workflows/phpunit-sqlite.yml @@ -130,16 +130,17 @@ 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 + ./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 @@ -164,7 +165,7 @@ jobs: summary: permissions: contents: none - runs-on: ubuntu-latest-low + runs-on: ubuntu-latest needs: [changes, phpunit-sqlite] if: always() @@ -176,7 +177,7 @@ jobs: run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi upload-coverage: - needs: phpunit + needs: [changes, phpunit-sqlite] runs-on: ubuntu-latest steps: - name: Upload coverage results to Coveralls 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]); From 42a84b332aa1313dd6141e4ee073cc3d66af6077 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 13:51:46 -0300 Subject: [PATCH 06/12] feat: update baseline at github actions Signed-off-by: Vitor Mattos --- .github/workflows/update-psalm-baseline.yml | 64 +++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/update-psalm-baseline.yml diff --git a/.github/workflows/update-psalm-baseline.yml b/.github/workflows/update-psalm-baseline.yml new file mode 100644 index 0000000000..73143410d7 --- /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: ["main", "stable29", "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 From 71b3a1e8cae706eb5f38416beb18edda9f756f6c Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 14:08:00 -0300 Subject: [PATCH 07/12] chore: temporary remove support to TwoFactorGateway Signed-off-by: Vitor Mattos --- .github/workflows/behat-mysql.yml | 2 +- .github/workflows/phpunit-mariadb.yml | 8 ++++---- .github/workflows/phpunit-mysql.yml | 8 ++++---- .github/workflows/phpunit-pgsql.yml | 8 ++++---- .github/workflows/phpunit-sqlite.yml | 8 ++++---- lib/Controller/SignFileController.php | 9 ++++----- 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index 167058160c..2a83e9bf00 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -180,4 +180,4 @@ jobs: steps: - name: Summary status - run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi + run: if ${{ needs.changes.outputs.src != 'false' && needs.behat-mysql.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/phpunit-mariadb.yml b/.github/workflows/phpunit-mariadb.yml index c81da7de44..306684b298 100644 --- a/.github/workflows/phpunit-mariadb.yml +++ b/.github/workflows/phpunit-mariadb.yml @@ -152,10 +152,10 @@ jobs: ./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: 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 & diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml index 0361ede80f..331964cc1e 100644 --- a/.github/workflows/phpunit-mysql.yml +++ b/.github/workflows/phpunit-mysql.yml @@ -152,10 +152,10 @@ jobs: ./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: 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 & diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml index abfeedf8e5..6182a918ea 100644 --- a/.github/workflows/phpunit-pgsql.yml +++ b/.github/workflows/phpunit-pgsql.yml @@ -148,10 +148,10 @@ jobs: ./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: 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 & diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml index 77cb53a5c4..44885442dc 100644 --- a/.github/workflows/phpunit-sqlite.yml +++ b/.github/workflows/phpunit-sqlite.yml @@ -143,10 +143,10 @@ jobs: ./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: 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 & 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; From cdd75e2de448b2d4a330aec172cd18dd9403c9de Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 14:23:23 -0300 Subject: [PATCH 08/12] fix: enable xdebug Signed-off-by: Vitor Mattos --- .github/workflows/phpunit-mariadb.yml | 2 +- .github/workflows/phpunit-mysql.yml | 2 +- .github/workflows/phpunit-pgsql.yml | 2 +- .github/workflows/phpunit-sqlite.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/phpunit-mariadb.yml b/.github/workflows/phpunit-mariadb.yml index 306684b298..a9165754e1 100644 --- a/.github/workflows/phpunit-mariadb.yml +++ b/.github/workflows/phpunit-mariadb.yml @@ -102,7 +102,7 @@ jobs: php-version: ${{ matrix.php-versions }} # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql - coverage: none + coverage: ${{ matrix.coverage }} ini-file: development env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml index 331964cc1e..5d5401eff6 100644 --- a/.github/workflows/phpunit-mysql.yml +++ b/.github/workflows/phpunit-mysql.yml @@ -102,7 +102,7 @@ jobs: 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: none + coverage: ${{ matrix.coverage }} ini-file: development env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml index 6182a918ea..17b1dd80c4 100644 --- a/.github/workflows/phpunit-pgsql.yml +++ b/.github/workflows/phpunit-pgsql.yml @@ -103,7 +103,7 @@ jobs: 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: none + coverage: ${{ matrix.coverage }} ini-file: development env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml index 44885442dc..aef128dc7f 100644 --- a/.github/workflows/phpunit-sqlite.yml +++ b/.github/workflows/phpunit-sqlite.yml @@ -98,7 +98,7 @@ jobs: 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: none + coverage: ${{ matrix.coverage }} ini-file: development env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e9264ab6326c39fb248811d0440712c4003a8598 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 14:28:44 -0300 Subject: [PATCH 09/12] fix: nextcloud.f.status isn't in GROUP BY SQLSTATE[42000]: Syntax error or access violation: 1055 'nextcloud.f.status' isn't in GROUP BY" Signed-off-by: Vitor Mattos --- lib/Db/AccountFileMapper.php | 1 + 1 file changed, 1 insertion(+) 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', From 1c5eccc7c2aeaa693227bc6ef4b480b75e3b8cf5 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 14:37:15 -0300 Subject: [PATCH 10/12] fix: matrix output Signed-off-by: Vitor Mattos --- .github/workflows/behat-mysql.yml | 3 +++ .github/workflows/phpunit-mysql.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index 2a83e9bf00..d114a5bfe2 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -14,6 +14,8 @@ jobs: runs-on: ubuntu-latest outputs: matrix: ${{ steps.versions.outputs.sparse-matrix }} + php-version: ${{ steps.versions.outputs.php-available-list }} + server-max: ${{ steps.versions.outputs.branches-max-list }} steps: - name: Checkout app uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -58,6 +60,7 @@ jobs: matrix: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + mysq-versions: ${{ fromJson(needs.matrix.outputs.matrix.mysql-versions) }} name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml index 5d5401eff6..7b2d6cb95e 100644 --- a/.github/workflows/phpunit-mysql.yml +++ b/.github/workflows/phpunit-mysql.yml @@ -19,6 +19,8 @@ jobs: runs-on: ubuntu-latest outputs: matrix: ${{ steps.versions.outputs.sparse-matrix }} + php-version: ${{ steps.versions.outputs.php-available-list }} + server-max: ${{ steps.versions.outputs.branches-max-list }} steps: - name: Checkout app uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -63,6 +65,7 @@ jobs: matrix: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + mysq-versions: ${{ fromJson(needs.matrix.outputs.matrix.mysql-versions) }} coverage: ['xdebug'] testsuite: [unit, api] xdebug_mode: ['debug'] From e94bd10691a0f46493ef38dbac737fbca664b080 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 15:12:55 -0300 Subject: [PATCH 11/12] chore: bump bkjnldsv/read-package-engines-version Signed-off-by: Vitor Mattos --- .github/workflows/appstore-build-publish.yml | 2 +- .github/workflows/behat-mysql.yml | 3 +-- .github/workflows/lint-eslint.yml | 2 +- .github/workflows/lint-stylelint.yml | 2 +- .github/workflows/node.yml | 2 +- .github/workflows/npm-audit-fix.yml | 2 +- .github/workflows/phpunit-mysql.yml | 3 +-- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/appstore-build-publish.yml b/.github/workflows/appstore-build-publish.yml index 40354ce638..84da54381c 100644 --- a/.github/workflows/appstore-build-publish.yml +++ b/.github/workflows/appstore-build-publish.yml @@ -41,7 +41,7 @@ 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 diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index d114a5bfe2..c4b0708439 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -13,7 +13,6 @@ jobs: matrix: runs-on: ubuntu-latest outputs: - matrix: ${{ steps.versions.outputs.sparse-matrix }} php-version: ${{ steps.versions.outputs.php-available-list }} server-max: ${{ steps.versions.outputs.branches-max-list }} steps: @@ -60,7 +59,7 @@ jobs: matrix: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} - mysq-versions: ${{ fromJson(needs.matrix.outputs.matrix.mysql-versions) }} + mysql-versions: ['8.1'] name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} diff --git a/.github/workflows/lint-eslint.yml b/.github/workflows/lint-eslint.yml index 3d2cd33ecd..5c3d3c6bc3 100644 --- a/.github/workflows/lint-eslint.yml +++ b/.github/workflows/lint-eslint.yml @@ -56,7 +56,7 @@ 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' diff --git a/.github/workflows/lint-stylelint.yml b/.github/workflows/lint-stylelint.yml index 4effd42926..6ff950466f 100644 --- a/.github/workflows/lint-stylelint.yml +++ b/.github/workflows/lint-stylelint.yml @@ -25,7 +25,7 @@ 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' diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index d289e244dd..7a5c90688d 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -50,7 +50,7 @@ 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' diff --git a/.github/workflows/npm-audit-fix.yml b/.github/workflows/npm-audit-fix.yml index a5f6741c89..284a90efd6 100644 --- a/.github/workflows/npm-audit-fix.yml +++ b/.github/workflows/npm-audit-fix.yml @@ -29,7 +29,7 @@ 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' diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml index 7b2d6cb95e..cdac3aae62 100644 --- a/.github/workflows/phpunit-mysql.yml +++ b/.github/workflows/phpunit-mysql.yml @@ -18,7 +18,6 @@ jobs: matrix: runs-on: ubuntu-latest outputs: - matrix: ${{ steps.versions.outputs.sparse-matrix }} php-version: ${{ steps.versions.outputs.php-available-list }} server-max: ${{ steps.versions.outputs.branches-max-list }} steps: @@ -65,7 +64,7 @@ jobs: matrix: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} - mysq-versions: ${{ fromJson(needs.matrix.outputs.matrix.mysql-versions) }} + mysql-versions: ['8.1'] coverage: ['xdebug'] testsuite: [unit, api] xdebug_mode: ['debug'] From 6c648f7159a660e74b2db066b8411ef0775f66b2 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 28 Mar 2024 16:50:17 -0300 Subject: [PATCH 12/12] feat: lock version at stable28 Signed-off-by: Vitor Mattos --- .github/workflows/appstore-build-publish.yml | 15 +- .github/workflows/behat-mariadb.yml | 19 +-- .github/workflows/behat-mysql.yml | 21 +-- .github/workflows/behat-pgsql.yml | 19 +-- .github/workflows/behat-sqlite.yml | 19 +-- .github/workflows/behat.yml | 127 ---------------- .github/workflows/lint-php-cs.yml | 8 +- .github/workflows/npm-audit-fix.yml | 2 +- .github/workflows/phpunit-mariadb.yml | 19 +-- .github/workflows/phpunit-mysql.yml | 21 +-- .github/workflows/phpunit-pgsql.yml | 19 +-- .github/workflows/phpunit-sqlite.yml | 21 +-- .github/workflows/phpunit.yml | 138 ------------------ .github/workflows/psalm.yml | 8 +- .../update-nextcloud-ocp-approve-merge.yml | 49 ------- .github/workflows/update-psalm-baseline.yml | 2 +- package-lock.json | 4 +- 17 files changed, 39 insertions(+), 472 deletions(-) delete mode 100644 .github/workflows/behat.yml delete mode 100644 .github/workflows/phpunit.yml delete mode 100644 .github/workflows/update-nextcloud-ocp-approve-merge.yml diff --git a/.github/workflows/appstore-build-publish.yml b/.github/workflows/appstore-build-publish.yml index 84da54381c..d5b0f4747b 100644 --- a/.github/workflows/appstore-build-publish.yml +++ b/.github/workflows/appstore-build-publish.yml @@ -9,6 +9,9 @@ on: release: types: [published] +env: + PHP_VERSION: 8.2 + jobs: build_and_publish: runs-on: ubuntu-latest @@ -62,16 +65,10 @@ jobs: if: ${{ steps.versions.outputs.npmVersion }} run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" - - name: Get php version - id: php-versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - with: - filename: ${{ env.APP_NAME }}/appinfo/info.xml - - - name: Set up php ${{ steps.php-versions.outputs.php-min }} - uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 + - name: Set up php ${{ env.PHP_VERSION }} + uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2 with: - php-version: ${{ steps.php-versions.outputs.php-min }} + php-version: ${{ env.PHP_VERSION }} coverage: none env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index 22067142d3..697a379da4 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -10,19 +10,6 @@ concurrency: cancel-in-progress: true 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Get version matrix - id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - changes: runs-on: ubuntu-latest @@ -50,13 +37,13 @@ jobs: behat-mariadb: runs-on: ubuntu-latest - needs: [changes, matrix] + needs: [changes] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} - server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + 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 }} diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index c4b0708439..8fc5388cee 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -10,21 +10,6 @@ concurrency: cancel-in-progress: true 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Get version matrix - id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - with: - matrix: '{"mysql-versions": ["8.1"]}' - changes: runs-on: ubuntu-latest @@ -52,13 +37,13 @@ jobs: behat-mysql: runs-on: ubuntu-latest - needs: [changes, matrix] + needs: [changes] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} - server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + 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 }} diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index 0df0826734..8b66a15be7 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -10,19 +10,6 @@ concurrency: cancel-in-progress: true 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Get version matrix - id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - changes: runs-on: ubuntu-latest @@ -50,13 +37,13 @@ jobs: behat-pgsql: runs-on: ubuntu-latest - needs: [changes, matrix] + needs: [changes] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} - server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + 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 }} diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index 900ff9fc8e..bbf84b0f42 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -10,19 +10,6 @@ concurrency: cancel-in-progress: true 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Get version matrix - id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - changes: runs-on: ubuntu-latest @@ -50,13 +37,13 @@ jobs: behat-sqlite: runs-on: ubuntu-latest - needs: [changes, matrix] + needs: [changes] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} - server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + 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 }} 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/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml index 1ffee78013..497533e8f6 100644 --- a/.github/workflows/lint-php-cs.yml +++ b/.github/workflows/lint-php-cs.yml @@ -24,14 +24,10 @@ jobs: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Get php version - id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - - - name: Set up php${{ steps.versions.outputs.php-available }} + - name: Set up php8.2 uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 with: - php-version: ${{ steps.versions.outputs.php-available }} + 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 diff --git a/.github/workflows/npm-audit-fix.yml b/.github/workflows/npm-audit-fix.yml index 284a90efd6..d5ad1c0090 100644 --- a/.github/workflows/npm-audit-fix.yml +++ b/.github/workflows/npm-audit-fix.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - branches: ['main', 'stable29', 'stable28'] + branches: ['stable28'] name: npm-audit-fix-${{ matrix.branches }} diff --git a/.github/workflows/phpunit-mariadb.yml b/.github/workflows/phpunit-mariadb.yml index a9165754e1..5bfceb75bb 100644 --- a/.github/workflows/phpunit-mariadb.yml +++ b/.github/workflows/phpunit-mariadb.yml @@ -15,19 +15,6 @@ concurrency: cancel-in-progress: true 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Get version matrix - id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - changes: runs-on: ubuntu-latest @@ -55,13 +42,13 @@ jobs: phpunit-mariadb: runs-on: ubuntu-latest - needs: [changes, matrix] + needs: [changes] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} - server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] mariadb-versions: ['10.6', '10.11'] coverage: ['xdebug'] testsuite: [unit, api] diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml index cdac3aae62..88afdd74a0 100644 --- a/.github/workflows/phpunit-mysql.yml +++ b/.github/workflows/phpunit-mysql.yml @@ -15,21 +15,6 @@ concurrency: cancel-in-progress: true 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Get version matrix - id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - with: - matrix: '{"mysql-versions": ["8.1"]}' - changes: runs-on: ubuntu-latest @@ -57,13 +42,13 @@ jobs: phpunit-mysql: runs-on: ubuntu-latest - needs: [changes, matrix] + needs: [changes] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} - server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] mysql-versions: ['8.1'] coverage: ['xdebug'] testsuite: [unit, api] diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml index 17b1dd80c4..c7758c22af 100644 --- a/.github/workflows/phpunit-pgsql.yml +++ b/.github/workflows/phpunit-pgsql.yml @@ -15,19 +15,6 @@ concurrency: cancel-in-progress: true 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Get version matrix - id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - changes: runs-on: ubuntu-latest @@ -55,13 +42,13 @@ jobs: phpunit-pgsql: runs-on: ubuntu-latest - needs: [changes, matrix] + needs: [changes] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} - server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] coverage: ['xdebug'] testsuite: [unit, api] xdebug_mode: ['debug'] diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml index aef128dc7f..ad912d1aa5 100644 --- a/.github/workflows/phpunit-sqlite.yml +++ b/.github/workflows/phpunit-sqlite.yml @@ -15,19 +15,6 @@ concurrency: cancel-in-progress: true 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Get version matrix - id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - changes: runs-on: ubuntu-latest @@ -55,13 +42,13 @@ jobs: phpunit-sqlite: runs-on: ubuntu-latest - needs: [changes, matrix] + needs: [changes] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} - server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + php-versions: ['8.0','8.1','8.2'] + server-versions: [stable28] coverage: ['xdebug'] testsuite: [unit, api] xdebug_mode: ['debug'] @@ -70,7 +57,7 @@ jobs: coverage: xdebug testsuite: default xdebug_mode: coverage - server-versions: master + server-versions: stable28 name: SQLite PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} Testsuite ${{ matrix.testsuite }} 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 b8e12b4e25..e3a573a3da 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -20,14 +20,10 @@ jobs: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Get php version - id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - - - name: Set up php${{ steps.versions.outputs.php-available }} + - name: Set up php8.2 uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 with: - php-version: ${{ steps.versions.outputs.php-available }} + 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 diff --git a/.github/workflows/update-nextcloud-ocp-approve-merge.yml b/.github/workflows/update-nextcloud-ocp-approve-merge.yml deleted file mode 100644 index c3f571616f..0000000000 --- a/.github/workflows/update-nextcloud-ocp-approve-merge.yml +++ /dev/null @@ -1,49 +0,0 @@ -# This workflow is provided via the organization template repository -# -# https://github.com/nextcloud/.github -# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization - -name: Auto approve nextcloud/ocp - -on: - pull_request_target: - branches: - - main - - master - - stable* - -permissions: - contents: read - -concurrency: - group: update-nextcloud-ocp-approve-merge-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - auto-approve-merge: - if: github.actor == 'nextcloud-command' - runs-on: ubuntu-latest - permissions: - # for hmarr/auto-approve-action to approve PRs - pull-requests: write - # for alexwilson/enable-github-automerge-action to approve PRs - contents: write - - steps: - - uses: mdecoleman/pr-branch-name@bab4c71506bcd299fb350af63bb8e53f2940a599 # v2.0.0 - id: branchname - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - # GitHub actions bot approve - - uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2 - if: startsWith(steps.branchname.outputs.branch, 'automated/noid/') && endsWith(steps.branchname.outputs.branch, 'update-nextcloud-ocp') - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - # Enable GitHub auto merge - - name: Auto merge - uses: alexwilson/enable-github-automerge-action@56e3117d1ae1540309dc8f7a9f2825bc3c5f06ff # main - if: startsWith(steps.branchname.outputs.branch, 'automated/noid/') && endsWith(steps.branchname.outputs.branch, 'update-nextcloud-ocp') - with: - github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-psalm-baseline.yml b/.github/workflows/update-psalm-baseline.yml index 73143410d7..d621ade08c 100644 --- a/.github/workflows/update-psalm-baseline.yml +++ b/.github/workflows/update-psalm-baseline.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - branches: ["main", "stable29", "stable28"] + branches: ["stable28"] name: update-psalm-baseline-${{ matrix.branches }} 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",