Skip to content

Commit 38ffced

Browse files
connorhunorkunas
andcommitted
Added CodeCov coverage report support and badge
Co-authored-by: Tomas Norkūnas <[email protected]>
1 parent 5bd8b3c commit 38ffced

File tree

3 files changed

+41
-12
lines changed

3 files changed

+41
-12
lines changed

.github/workflows/tests.yml

+39-12
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@ jobs:
2929
strategy:
3030
matrix:
3131
php-version: ['7.4', '8.1', '8.2', '8.3']
32-
sf-version: ['5.4.*', '6.4.*', '7.0.*']
32+
sf-version: ['5.4', '6.4', '7.0']
3333
exclude:
3434
- php-version: '7.4'
35-
sf-version: '6.4.*'
35+
sf-version: '6.4'
3636
- php-version: '7.4'
37-
sf-version: '7.0.*'
37+
sf-version: '7.0'
3838
- php-version: '8.1'
39-
sf-version: '5.4.*'
39+
sf-version: '5.4'
4040
- php-version: '8.1'
41-
sf-version: '7.0.*'
41+
sf-version: '7.0'
4242
- php-version: '8.2'
43-
sf-version: '5.4.*'
43+
sf-version: '5.4'
4444
- php-version: '8.3'
45-
sf-version: '5.4.*'
45+
sf-version: '5.4'
4646
- php-version: '8.3'
47-
sf-version: '5.4.*'
47+
sf-version: '5.4'
4848

49-
name: integration-tests (PHP ${{ matrix.php-version }}) (Symfony ${{ matrix.sf-version }})
49+
name: integration-tests (PHP ${{ matrix.php-version }}) (Symfony ${{ matrix.sf-version }}.*)
5050
steps:
5151
- uses: actions/checkout@v4
5252
- name: Install PHP
@@ -58,14 +58,19 @@ jobs:
5858
run: composer validate
5959
- name: Install dependencies
6060
env:
61-
SYMFONY_REQUIRE: ${{ matrix.sf-version }}
61+
SYMFONY_REQUIRE: '${{ matrix.sf-version }}.*'
6262
run: composer install --prefer-dist --no-progress
63-
- name: "Remove doctrine/annotations"
63+
- name: Remove doctrine/annotations
6464
if: matrix.php-version != '7.4'
6565
run: |
6666
composer remove --dev doctrine/annotations
6767
- name: Run test suite
68-
run: composer test:unit
68+
run: composer test:unit -- --coverage-clover coverage.xml
69+
- name: Upload coverage file
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: 'phpunit-${{ matrix.php-version }}-${{ matrix.sf-version }}-coverage'
73+
path: 'coverage.xml'
6974

7075
code-style:
7176
runs-on: ubuntu-latest
@@ -105,3 +110,25 @@ jobs:
105110
uses: ibiqlik/action-yamllint@v3
106111
with:
107112
config_file: .yamllint.yml
113+
114+
upload-coverage:
115+
name: Upload coverage to Codecov
116+
runs-on: ubuntu-latest
117+
needs:
118+
- integration-tests
119+
120+
steps:
121+
- name: Checkout
122+
uses: actions/checkout@v4
123+
with:
124+
fetch-depth: 2
125+
126+
- name: Download coverage files
127+
uses: actions/download-artifact@v4
128+
with:
129+
path: reports
130+
131+
- name: Upload to Codecov
132+
uses: codecov/codecov-action@v3
133+
with:
134+
directory: reports

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
</h4>
1616

1717
<p align="center">
18+
<a href="https://codecov.io/gh/meilisearch/meilisearch-symfony/branch/main"><img src="https://codecov.io/gh/meilisearch/meilisearch-symfony/branch/main/graph/badge.svg" alt="Codecov coverage"></a>
1819
<a href="https://packagist.org/packages/meilisearch/search-bundle"><img src="https://img.shields.io/packagist/v/meilisearch/search-bundle" alt="Latest Stable Version"></a>
1920
<a href="https://github.com/meilisearch/meilisearch-symfony/actions"><img src="https://github.com/meilisearch/meilisearch-symfony/workflows/Tests/badge.svg" alt="Test"></a>
2021
<a href="https://github.com/meilisearch/meilisearch-symfony/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-informational" alt="License"></a>

phpunit.xml.dist

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<env name="MEILISEARCH_PREFIX" value="sf_phpunit_"/>
1515
<env name="MEILISEARCH_URL" value="http://127.0.0.1:7700"/>
1616
<env name="MEILISEARCH_API_KEY" value="masterKey"/>
17+
<env name="SYMFONY_PHPUNIT_VERSION" value="9.6"/>
1718
</php>
1819
<testsuites>
1920
<testsuite name="Integration">

0 commit comments

Comments
 (0)