Skip to content

Commit

Permalink
Integrate codecov
Browse files Browse the repository at this point in the history
Fix #17
  • Loading branch information
CasperLaiTW committed Sep 19, 2020
1 parent d88cec5 commit 0950f57
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 27 deletions.
30 changes: 20 additions & 10 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ jobs:
matrix:
os: [ubuntu-latest]
php: [7.2, 7.3, 7.4]
laravel: [6.*, 7.*, 8.*]
laravel: [6, 7, 8]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 8.*
- laravel: 8
testbench: 6.*
- laravel: 7.*
- laravel: 7
testbench: 5.*
- laravel: 6.*
- laravel: 6
testbench: 4.*
exclude:
- laravel: 8.*
- laravel: 8
php: 7.2

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
name: P${{ matrix.php }} - L${{ matrix.laravel }}.* - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
Expand All @@ -33,18 +33,28 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
key: dependencies-laravel-${{ matrix.laravel }}.*-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
coverage: pcov

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}.*" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit
run: vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
name: laravel-prerender
flags: P${{ matrix.php }},L${{ matrix.laravel }},${{ matrix.dependency-version }},${{ matrix.os }}
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ coverage
docs
vendor
.php_cs.cache
coverage
coverage.xml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Laravel | Prerender.io ![Tests](https://github.com/codebar-ag/Laravel-Prerender/workflows/Tests/badge.svg)
Laravel | Prerender.io ![Tests](https://github.com/codebar-ag/Laravel-Prerender/workflows/Tests/badge.svg) ![codecov.io](https://codecov.io/github/codebar-ag/Laravel-Prerender/coverage.svg?branch=master)
===========================

## Credits
Expand Down
31 changes: 16 additions & 15 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
verbose="true"
>
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="codebar Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
</phpunit>

0 comments on commit 0950f57

Please sign in to comment.