From ea5f0dd7afda99c28e45fd80e2e6c2d20919530a Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 20 Oct 2023 02:09:27 +0200 Subject: [PATCH] chore(tests): Migrate code coverage generation from drone to GitHub Signed-off-by: Ferdinand Thiessen --- .drone.yml | 64 ---------------------------- .github/workflows/phpunit-sqlite.yml | 14 ++++-- 2 files changed, 11 insertions(+), 67 deletions(-) diff --git a/.drone.yml b/.drone.yml index ade2aa0478117..64e8dcc9157ab 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1360,70 +1360,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 diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml index 8cbfd34e13b31..c099fc5165261 100644 --- a/.github/workflows/phpunit-sqlite.yml +++ b/.github/workflows/phpunit-sqlite.yml @@ -60,6 +60,7 @@ jobs: include: - php-versions: '8.3' database-only: false + coverage: true name: SQLite (PHP ${{ matrix.php-versions }}) - ${{ matrix.database-only && 'database' || 'all' }} tests @@ -81,9 +82,8 @@ jobs: 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 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: none + coverage: ${{ matrix.coverage && 'xdebug' || 'none' }} ini-file: development env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -107,7 +107,15 @@ jobs: - name: PHPUnit full testsuite if: ${{ ! matrix.database-only }} - run: composer run test + run: composer run test ${{ matrix.coverage && ' -- --coverage-clover ./clover.xml' || '' }} + + - name: Upload code coverage + if: ${{ !cancelled() && matrix.coverage }} + uses: codecov/codecov-action@v3 + with: + files: ./clover.xml + fail_ci_if_error: true + flags: unit - name: Print logs if: always()