Merge pull request #4520 from nextcloud/dependabot/npm_and_yarn/dompu… #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: 2026 Nextcloud contributors | |
| # SPDX-License-Identifier: AGPL-3.0-or-later | |
| name: PHPUnit Coverage | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: phpunit-coverage-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| matrix: | |
| runs-on: ubuntu-latest-low | |
| outputs: | |
| php-version: ${{ steps.versions.outputs.php-max }} | |
| server-version: ${{ steps.versions.outputs.branches-max }} | |
| steps: | |
| - name: Checkout app | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Get version matrix | |
| id: versions | |
| uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2.3.1.3.2 | |
| coverage: | |
| runs-on: ubuntu-latest | |
| needs: [matrix] | |
| name: Coverage PHP ${{ needs.matrix.outputs.php-version }} Nextcloud ${{ needs.matrix.outputs.server-version }} | |
| steps: | |
| - name: Set app env | |
| if: ${{ env.APP_NAME == '' }} | |
| run: | | |
| # Split and keep last | |
| echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV | |
| - name: Checkout server | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| submodules: true | |
| repository: nextcloud/server | |
| ref: ${{ needs.matrix.outputs.server-version }} | |
| - name: Checkout app | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| path: apps/${{ env.APP_NAME }} | |
| - name: Set up php ${{ needs.matrix.outputs.php-version }} | |
| uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0 | |
| with: | |
| php-version: ${{ needs.matrix.outputs.php-version }} | |
| 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: pcov | |
| ini-file: development | |
| ini-values: disable_functions= | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up dependencies | |
| working-directory: apps/${{ env.APP_NAME }} | |
| run: | | |
| composer remove nextcloud/ocp --dev | |
| composer i | |
| - name: Set up Nextcloud | |
| run: | | |
| mkdir data | |
| ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin | |
| ./occ app:enable --force ${{ env.APP_NAME }} | |
| - name: PHPUnit with coverage | |
| working-directory: apps/${{ env.APP_NAME }} | |
| run: composer run test:unit -- --coverage-clover coverage.xml --coverage-text --colors=never 2>&1 | tee /tmp/coverage.txt | |
| - name: Write coverage summary | |
| run: | | |
| echo '## Test Coverage' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| grep -A 999 'Code Coverage Report' /tmp/coverage.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: apps/${{ env.APP_NAME }}/coverage.xml | |
| retention-days: 7 | |
| - name: Print logs | |
| if: always() | |
| run: | | |
| cat data/nextcloud.log |