Skip to content

Commit

Permalink
Merge pull request phpmd#1061 from phpmd/fix/coverage-script
Browse files Browse the repository at this point in the history
Split test packages in coverage like in tests
  • Loading branch information
kylekatarnls authored Jan 11, 2024
2 parents 74a1f56 + 4a17e57 commit ea80ce8
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,40 @@ jobs:
tools: composer:v2
coverage: xdebug

- name: Cache Composer packages
- name: Cache library packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: coverage-${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.dependency-version }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
coverage-${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.dependency-version }}
key: ${{ runner.os }}-coverage-${{ matrix.php }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-coverage-${{ matrix.php }}-

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
- name: Cache test packages
id: composer-test-cache
uses: actions/cache@v3
with:
path: src/test/vendor
key: ${{ runner.os }}-coverage-test-${{ matrix.php }}-${{ hashFiles('src/test/composer.json') }}
restore-keys: ${{ runner.os }}-coverage-test-${{ matrix.php }}-

- name: Upgrade PHPUnit
run: |
composer require phpunit/phpunit:^5.7.27 --no-update --no-interaction --dev
composer require symfony/config:^6.4 --no-update --no-interaction --dev
composer update --prefer-dist --no-progress --${{ matrix.dependency-version }} --ignore-platform-req=php
cd src/test && composer require phpunit/phpunit:^5.7.27 --no-update --no-interaction --dev
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer update --no-progress --prefer-stable --prefer-dist --no-progress --ignore-platform-req=php+

- name: Install test dependencies
if: steps.composer-test-cache.outputs.cache-hit != 'true'
run: cd src/test && composer update --no-progress --prefer-dist --prefer-stable --ignore-platform-req=php+

- name: Fix PHP compatibility
run: php src/test/php/fix-php-compatibility.php

- name: Execute Unit Tests
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml --coverage-html=coverage_html
run: src/test/vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml

- name: Archive code coverage results
uses: codecov/codecov-action@v3
Expand Down

0 comments on commit ea80ce8

Please sign in to comment.