Skip to content

Commit

Permalink
chore(tests): Migrate code coverage generation from drone to GitHub
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Oct 20, 2023
1 parent be221e3 commit 59abd8e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 71 deletions.
64 changes: 0 additions & 64 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/phpunit-sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand All @@ -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()
Expand Down

0 comments on commit 59abd8e

Please sign in to comment.