Skip to content

Commit

Permalink
Enhancement: Split running tests and collecting code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz authored and sebastianbergmann committed May 21, 2021
1 parent 245874a commit 4f60da8
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
extensions: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter
ini-values: assert.exception=1, zend.assertions=1

Expand Down Expand Up @@ -157,6 +156,54 @@ jobs:
run: bash ./build/scripts/sanity-check

- name: Run tests with phpunit
run: php ./phpunit

code-coverage:
name: Code Coverage

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version:
- 8.0

dependencies:
- highest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
extensions: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter
ini-values: assert.exception=1, zend.assertions=1

- name: Determine composer cache directory
run: echo "COMPOSER_CACHE_DIR=$(./tools/composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
- name: Install lowest dependencies with composer
if: matrix.dependencies == 'lowest'
run: php ./tools/composer update --no-ansi --no-interaction --no-progress --prefer-lowest

- name: Install highest dependencies with composer
if: matrix.dependencies == 'highest'
run: php ./tools/composer update --no-ansi --no-interaction --no-progress

- name: Collect code coverage with phpunit
run: php ./phpunit --coverage-clover=coverage.xml

- name: Send code coverage report to Codecov.io
Expand Down

0 comments on commit 4f60da8

Please sign in to comment.