From 17cefd035fa6de2aca1e88667ffede71a5379c3b Mon Sep 17 00:00:00 2001 From: codemasher Date: Wed, 4 Dec 2019 18:34:08 +0100 Subject: [PATCH] :octocat: logging & coverage -> .build --- .github/workflows/tests.yml | 30 +++++++++++++++++++++------ .gitignore | 7 +++---- phpunit.xml | 17 ++++++++------- tests/Output/QROutputTestAbstract.php | 11 +++++++--- 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9c69d7888..e73d8395e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,6 @@ jobs: dependencies: - lowest -# - locked - highest steps: @@ -38,13 +37,32 @@ jobs: if: matrix.dependencies == 'lowest' run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest --prefer-lowest -# - name: "Install locked dependencies with composer" -# if: matrix.dependencies == 'locked' -# run: ${{ matrix.php-binary }} $(which composer) install --no-interaction --no-progress --no-suggest - - name: "Install highest dependencies with composer" if: matrix.dependencies == 'highest' run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest - name: "Run unit tests with phpunit" - run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=phpunit.xml + run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=phpunit.xml --no-coverage + + + code-coverage: + name: "Code Coverage" + runs-on: ubuntu-latest + + steps: + - name: "Checkout" + uses: actions/checkout@v1.1.0 + + - name: "Install locked dependencies with composer" + run: php7.3 $(which composer) install --no-interaction --no-progress --no-suggest + + - name: "Dump Xdebug filter with phpunit/phpunit" + run: php7.3 vendor/bin/phpunit --configuration=phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php + + - name: "Collect code coverage with Xdebug and phpunit/phpunit" + run: php7.3 vendor/bin/phpunit --configuration=phpunit.xml --prepend=.build/phpunit/xdebug-filter.php + + - name: "Send code coverage report to Codecov.io" + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: bash <(curl -s https://codecov.io/bash) diff --git a/.gitignore b/.gitignore index b7d3238f4..6361335f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -vendor -.idea -tests/Output/output_test.* +.build/* +.idea/* +vendor/* composer.lock -*.phpunit.result.cache diff --git a/phpunit.xml b/phpunit.xml index 2a41c5d15..de751fd04 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,13 +1,9 @@ - - @@ -19,4 +15,9 @@ ./tests/ + + + + + diff --git a/tests/Output/QROutputTestAbstract.php b/tests/Output/QROutputTestAbstract.php index 3a44a3349..6cd95d080 100644 --- a/tests/Output/QROutputTestAbstract.php +++ b/tests/Output/QROutputTestAbstract.php @@ -17,11 +17,11 @@ use chillerlan\QRCode\Data\Byte; use chillerlan\QRCode\Output\{QRCodeOutputException, QROutputInterface}; use chillerlan\QRCodeTest\QRTestAbstract; -/** - */ +use function dirname, file_exists, mkdir; + abstract class QROutputTestAbstract extends QRTestAbstract{ - const cachefile = __DIR__.'/output_test.'; + const cachefile = __DIR__.'/../../.build/output_test/test.'; /** * @var \chillerlan\QRCode\Output\QROutputInterface @@ -41,6 +41,11 @@ abstract class QROutputTestAbstract extends QRTestAbstract{ protected function setUp():void{ parent::setUp(); + $buildDir = dirname($this::cachefile); + if(!file_exists($buildDir)){ + mkdir($buildDir, 0777, true); + } + $this->options = new QROptions; $this->setOutputInterface(); }