Skip to content

Commit 17cefd0

Browse files
committed
:octocat: logging & coverage -> .build
1 parent 314ac6d commit 17cefd0

File tree

4 files changed

+44
-21
lines changed

4 files changed

+44
-21
lines changed

.github/workflows/tests.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727

2828
dependencies:
2929
- lowest
30-
# - locked
3130
- highest
3231

3332
steps:
@@ -38,13 +37,32 @@ jobs:
3837
if: matrix.dependencies == 'lowest'
3938
run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest --prefer-lowest
4039

41-
# - name: "Install locked dependencies with composer"
42-
# if: matrix.dependencies == 'locked'
43-
# run: ${{ matrix.php-binary }} $(which composer) install --no-interaction --no-progress --no-suggest
44-
4540
- name: "Install highest dependencies with composer"
4641
if: matrix.dependencies == 'highest'
4742
run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest
4843

4944
- name: "Run unit tests with phpunit"
50-
run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=phpunit.xml
45+
run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=phpunit.xml --no-coverage
46+
47+
48+
code-coverage:
49+
name: "Code Coverage"
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- name: "Checkout"
54+
uses: actions/[email protected]
55+
56+
- name: "Install locked dependencies with composer"
57+
run: php7.3 $(which composer) install --no-interaction --no-progress --no-suggest
58+
59+
- name: "Dump Xdebug filter with phpunit/phpunit"
60+
run: php7.3 vendor/bin/phpunit --configuration=phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php
61+
62+
- name: "Collect code coverage with Xdebug and phpunit/phpunit"
63+
run: php7.3 vendor/bin/phpunit --configuration=phpunit.xml --prepend=.build/phpunit/xdebug-filter.php
64+
65+
- name: "Send code coverage report to Codecov.io"
66+
env:
67+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
68+
run: bash <(curl -s https://codecov.io/bash)

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
vendor
2-
.idea
3-
tests/Output/output_test.*
1+
.build/*
2+
.idea/*
3+
vendor/*
44
composer.lock
5-
*.phpunit.result.cache

phpunit.xml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
1+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
43
bootstrap="vendor/autoload.php"
4+
cacheResultFile=".build/phpunit.result.cache"
55
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
6+
verbose="true"
117
>
128
<filter>
139
<whitelist processUncoveredFilesFromWhitelist="true">
@@ -19,4 +15,9 @@
1915
<directory suffix=".php">./tests/</directory>
2016
</testsuite>
2117
</testsuites>
18+
<logging>
19+
<log type="coverage-clover" target=".build/coverage/clover.xml"/>
20+
<log type="coverage-xml" target=".build/coverage/coverage-xml"/>
21+
<log type="junit" target=".build/logs/junit.xml"/>
22+
</logging>
2223
</phpunit>

tests/Output/QROutputTestAbstract.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
use chillerlan\QRCode\Output\{QRCodeOutputException, QROutputInterface};
1818
use chillerlan\QRCodeTest\QRTestAbstract;
1919

20-
/**
21-
*/
20+
use function dirname, file_exists, mkdir;
21+
2222
abstract class QROutputTestAbstract extends QRTestAbstract{
2323

24-
const cachefile = __DIR__.'/output_test.';
24+
const cachefile = __DIR__.'/../../.build/output_test/test.';
2525

2626
/**
2727
* @var \chillerlan\QRCode\Output\QROutputInterface
@@ -41,6 +41,11 @@ abstract class QROutputTestAbstract extends QRTestAbstract{
4141
protected function setUp():void{
4242
parent::setUp();
4343

44+
$buildDir = dirname($this::cachefile);
45+
if(!file_exists($buildDir)){
46+
mkdir($buildDir, 0777, true);
47+
}
48+
4449
$this->options = new QROptions;
4550
$this->setOutputInterface();
4651
}

0 commit comments

Comments
 (0)