From 59abd8ed3054c1e3e53c4bb0b526d6cdb6500326 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 | 23 +++++++--- 2 files changed, 16 insertions(+), 71 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 5250bebedf901..d2c7bd93bfc59 100644 --- a/.github/workflows/phpunit-sqlite.yml +++ b/.github/workflows/phpunit-sqlite.yml @@ -55,12 +55,13 @@ jobs: strategy: matrix: php-versions: ['8.0', '8.1', '8.2', '8.3'] - with-nodb: [false] + database-only: [true] include: - php-versions: '8.3' - with-nodb: true + database-only: false + coverage: true - name: PHPUnit sqlite (PHP ${{ matrix.php-versions }}) - ${{ matrix.with-nodb && 'all' || 'database' }} tests + name: PHPUnit sqlite (PHP ${{ matrix.php-versions }}) - ${{ matrix.database-only && 'database' || 'all' }} tests services: cache: @@ -80,7 +81,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 && 'xdebug' || 'none' }} ini-file: development env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -98,12 +99,20 @@ jobs: run: php -S localhost:8080 & - name: PHPUnit DB test - if: ${{ ! matrix.with-nodb }} + if: ${{ matrix.database-only }} run: composer run test:db - name: PHPUnit nodb test - if: ${{ matrix.with-nodb }} - run: composer run test + if: ${{ ! matrix.database-only }} + run: composer run test ${{ matrix.coverage && ' -- --coverage-clover ./clover.xml' || '' }} + + - name: Upload code coverage + if: matrix.coverage + uses: codecov/codecov-action@v3 + with: + files: ./clover.xml + fail_ci_if_error: true + flags: unit - name: Print logs if: always()