chore(tests): Migrate code coverage generation from drone to GitHub

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/41003/head
Ferdinand Thiessen 7 months ago committed by Joas Schilling
parent 32a4849757
commit 8a68232804
No known key found for this signature in database
GPG Key ID: 74434EFE0D2E2205

@ -216,70 +216,6 @@ trigger:
- pull_request
- push
---
kind: pipeline
name: nodb-codecov
steps:
- name: submodules
image: ghcr.io/nextcloud/continuous-integration-alpine-git:latest
commands:
- git submodule update --init
- name: nodb-codecov
image: ghcr.io/nextcloud/continuous-integration-php8.0:latest
environment:
CODECOV_TOKEN:
from_secret: CODECOV_TOKEN
XDEBUG_MODE: coverage
commands:
- phpenmod xdebug
- TEST_SELECTION=NODB ./autotest.sh sqlite
- wget https://codecov.io/bash -O codecov.sh
- bash codecov.sh -Z -C $DRONE_COMMIT -f tests/autotest-clover-sqlite.xml
services:
- name: cache
image: ghcr.io/nextcloud/continuous-integration-redis:latest
trigger:
branch:
- master
- stable*
event:
- push
---
kind: pipeline
name: db-codecov
steps:
- name: submodules
image: ghcr.io/nextcloud/continuous-integration-alpine-git:latest
commands:
- git submodule update --init
- name: db-codecov
image: ghcr.io/nextcloud/continuous-integration-php8.0:latest
environment:
CODECOV_TOKEN:
from_secret: CODECOV_TOKEN
XDEBUG_MODE: coverage
commands:
- phpenmod xdebug
- TEST_SELECTION=QUICKDB ./autotest.sh sqlite
- wget https://codecov.io/bash -O codecov.sh
- bash codecov.sh -Z -C $DRONE_COMMIT -f tests/autotest-clover-sqlite.xml
services:
- name: cache
image: ghcr.io/nextcloud/continuous-integration-redis:latest
trigger:
branch:
- master
- stable*
event:
- push
---
kind: pipeline
name: object-store-s3

@ -60,6 +60,7 @@ jobs:
include:
- php-versions: '8.3'
mariadb-versions: '10.6'
coverage: true
name: MariaDB ${{ matrix.mariadb-versions }} (PHP ${{ matrix.php-versions }}) - database tests
@ -93,7 +94,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, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql
coverage: none
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -101,19 +102,12 @@ jobs:
- name: Set up dependencies
run: composer i
- name: Wait for MariaDB
id: check_mariadb_up
run: |
apps/files_external/tests/env/wait-for-connection localhost 4444 30
- name: Enable ONLY_FULL_GROUP_BY MySQL option
if: steps.check_mariadb_up.outcome == 'success'
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 Nextcloud
if: steps.check_mariadb_up.outcome == 'success'
env:
DB_PORT: 4444
run: |
@ -124,8 +118,14 @@ jobs:
php -f tests/enable_all.php | grep -i -C9999 error && echo "Error during app setup" && exit 1 || exit 0
- name: PHPUnit
if: steps.check_mariadb_up.outcome == 'success'
run: composer run test:db
run: composer run test:db ${{ matrix.coverage && ' -- --coverage-clover ./clover.db.xml' || '' }}
- name: Upload db code coverage
if: ${{ !cancelled() && matrix.coverage }}
uses: codecov/codecov-action@v3
with:
files: ./clover.db.xml
flags: phpunit-mariadb
- name: Print logs
if: always()

@ -58,8 +58,9 @@ jobs:
php-versions: ['8.0']
mysql-versions: ['8.0', '8.1']
include:
- php-versions: '8.3'
mysql-versions: '8.1'
- mysql-versions: '8.1'
php-versions: '8.3'
coverage: true
name: MySQL ${{ matrix.mysql-versions }} (PHP ${{ matrix.php-versions }}) - database tests
@ -93,7 +94,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, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql
coverage: none
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -101,19 +102,12 @@ jobs:
- name: Set up dependencies
run: composer i
- name: Wait for MySQL
id: check_mysql_up
run: |
apps/files_external/tests/env/wait-for-connection localhost 4444 30
- name: Enable ONLY_FULL_GROUP_BY MySQL option
if: steps.check_mysql_up.outcome == 'success'
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 Nextcloud
if: steps.check_mysql_up.outcome == 'success'
env:
DB_PORT: 4444
run: |
@ -124,8 +118,14 @@ jobs:
php -f tests/enable_all.php | grep -i -C9999 error && echo "Error during app setup" && exit 1 || exit 0
- name: PHPUnit
if: steps.check_mysql_up.outcome == 'success'
run: composer run test:db
run: composer run test:db ${{ matrix.coverage && ' -- --coverage-clover ./clover.db.xml' || '' }}
- name: Upload db code coverage
if: ${{ !cancelled() && matrix.coverage }}
uses: codecov/codecov-action@v3
with:
files: ./clover.db.xml
flags: phpunit-mysql
- name: Print logs
if: always()

@ -0,0 +1,130 @@
# 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
# This is the testsuite running all non-database agnostic unit tests
name: PHPUnit nodb
on:
pull_request:
push:
branches:
- main
- master
- stable*
permissions:
contents: read
concurrency:
group: phpunit-nodb-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.src}}
steps:
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/**'
- '3rdparty/**'
- '**/appinfo/**'
- '**/lib/**'
- '**/templates/**'
- '**/tests/**'
- 'vendor/**'
- 'vendor-bin/**'
- '.php-cs-fixer.dist.php'
- 'composer.json'
- 'composer.lock'
- '**.php'
phpunit-nodb:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
strategy:
matrix:
php-versions: ['8.0', '8.1', '8.2', '8.3']
include:
- php-versions: '8.2'
coverage: true
name: No DB unit tests (PHP ${{ matrix.php-versions }})
services:
cache:
image: ghcr.io/nextcloud/continuous-integration-redis:latest
ports:
- 6379:6379/tcp
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout server
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
submodules: true
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@7fdd3ece872ec7ec4c098ae5ab7637d5e0a96067 # 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, imagick, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
ini-file: development
# Required for tests that use pcntl
ini-values: disable_functions=""
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up dependencies
run: composer i
- name: Set up Nextcloud
run: |
mkdir data
cp tests/redis.config.php config/
cp tests/preseed-config.php config/config.php
./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
php -f tests/enable_all.php | grep -i -C9999 error && echo "Error during app setup" && exit 1 || exit 0
- name: PHPUnit nodb testsuite
run: composer run test -- --exclude-group DB,SLOWDB ${{ matrix.coverage && ' --coverage-clover ./clover.nodb.xml' || '' }}
- name: Upload nodb code coverage
if: ${{ !cancelled() && matrix.coverage }}
uses: codecov/codecov-action@v3
with:
files: ./clover.nodb.xml
flags: phpunit-nodb
- name: Print logs
if: always()
run: |
cat data/nextcloud.log
summary:
permissions:
contents: none
runs-on: ubuntu-latest
needs: [changes, phpunit-nodb]
if: always()
name: phpunit-nodb-summary
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-nodb.result != 'success' }}; then exit 1; fi

@ -61,6 +61,7 @@ jobs:
include:
- php-versions: '8.3'
postgres-versions: '15'
coverage: true
name: PostgreSQL ${{ matrix.postgres-versions }} (PHP ${{ matrix.php-versions }}) - database tests
@ -93,7 +94,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, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql
coverage: none
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -101,13 +102,7 @@ jobs:
- name: Set up dependencies
run: composer i
- name: Wait for pgsql
id: check_pgsql_up
run: |
apps/files_external/tests/env/wait-for-connection localhost 4444 30
- name: Set up Nextcloud
if: steps.check_pgsql_up.outcome == 'success'
env:
DB_PORT: 4444
run: |
@ -117,12 +112,17 @@ jobs:
./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
php -f tests/enable_all.php | grep -i -C9999 error && echo "Error during app setup" && exit 1 || exit 0
- name: PHPUnit
if: steps.check_pgsql_up.outcome == 'success'
run: composer run test:db
- name: PHPUnit database tests
run: composer run test:db ${{ matrix.coverage && ' -- --coverage-clover ./clover.db.xml' || '' }}
- name: Upload db code coverage
if: ${{ !cancelled() && matrix.coverage }}
uses: codecov/codecov-action@v3
with:
files: ./clover.db.xml
flags: phpunit-postgres
- name: Run repair steps
if: steps.check_pgsql_up.outcome == 'success'
run: |
./occ maintenance:repair --include-expensive

@ -56,12 +56,11 @@ jobs:
strategy:
matrix:
php-versions: ['8.0', '8.1', '8.2', '8.3']
database-only: [true]
include:
- php-versions: '8.2'
database-only: false
- php-versions: '8.1'
coverage: true
name: SQLite (PHP ${{ matrix.php-versions }}) - ${{ matrix.database-only && 'database' || 'all' }} tests
name: SQLite (PHP ${{ matrix.php-versions }})
services:
cache:
@ -77,12 +76,12 @@ jobs:
submodules: true
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
uses: shivammathur/setup-php@7fdd3ece872ec7ec4c098ae5ab7637d5e0a96067 # 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, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite ${{ matrix.database-only && '' || ', imagick' }}
coverage: none
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -98,13 +97,18 @@ jobs:
./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
php -f tests/enable_all.php | grep -i -C9999 error && echo "Error during app setup" && exit 1 || exit 0
- name: Nextcloud debug information
run: ./occ app:list && echo "======= System config =======" && ./occ config:list system
- name: PHPUnit database tests
if: ${{ matrix.database-only }}
run: composer run test:db
run: composer run test:db ${{ matrix.coverage && ' -- --coverage-clover ./clover.db.xml' || '' }}
- name: PHPUnit full testsuite
if: ${{ ! matrix.database-only }}
run: composer run test
- name: Upload db code coverage
if: ${{ !cancelled() && matrix.coverage }}
uses: codecov/codecov-action@v3
with:
files: ./clover.db.xml
flags: phpunit-sqlite
- name: Print logs
if: always()

Loading…
Cancel
Save