Skip to content

Commit

Permalink
Merge pull request #5 from MacPaw/feat/ORC-1772-update-request-dto-re…
Browse files Browse the repository at this point in the history
…solver

feat: add code coverage
  • Loading branch information
Yozhef authored May 30, 2024
2 parents 9abba1f + 2ecafdf commit 9ac2391
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 81 deletions.
120 changes: 62 additions & 58 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,63 +1,67 @@
name: CI

on:
pull_request:
push:
branches: [main, develop]
pull_request:
push:
branches: [main, develop]

jobs:
run:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.2'
- '8.3'
symfony-versions:
- '^6.4'
- '^7.0'

name: PHP ${{ matrix.php }} Symfony ${{ matrix.symfony-versions }} ${{ matrix.description }}
steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: ${{ matrix.php }}-${{ matrix.symfony-versions }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.coverage }}

- name: Add PHPUnit matcher
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Set composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer
uses: actions/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.symfony-versions }}-composer-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.symfony-versions }}-composer

- name: Update Symfony version
if: matrix.symfony-versions != ''
run: |
composer require symfony/form:${{ matrix.symfony-versions }} --no-update --no-scripts
composer require symfony/framework-bundle:${{ matrix.symfony-versions }} --no-update --no-scripts
composer require symfony/validator:${{ matrix.symfony-versions }} --no-update --no-scripts
composer require --dev symfony/yaml:${{ matrix.symfony-versions }} --no-update --no-scripts
- name: Install dependencies
run: composer install

- name: Run PHPUnit tests
run: vendor/bin/phpunit
run:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3']
symfony-versions: ['^6.4', '^7.0']

name: Test with PHP ${{ matrix.php }} Symfony ${{ matrix.symfony-versions }} ${{ matrix.description }}
steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: ${{ matrix.php }}-${{ matrix.symfony-versions }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: xdebug
coverage: xdebug

- name: Add PHPUnit matcher
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Set composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer
uses: actions/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.symfony-versions }}-composer-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.symfony-versions }}-composer

- name: Update Symfony version
if: matrix.symfony-versions != ''
run: |
composer require symfony/form:${{ matrix.symfony-versions }} --no-update --no-scripts
composer require symfony/framework-bundle:${{ matrix.symfony-versions }} --no-update --no-scripts
composer require symfony/validator:${{ matrix.symfony-versions }} --no-update --no-scripts
composer require --dev symfony/yaml:${{ matrix.symfony-versions }} --no-update --no-scripts
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: PHPUnit tests with coverage
run: vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload coverage to Codecov
if: matrix.php == '8.3' && matrix.symfony-versions == '^7.0'
uses: codecov/[email protected]
with:
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
52 changes: 29 additions & 23 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,33 @@
cacheResult="false"
beStrictAboutOutputDuringTests="true"
>
<php>
<ini name="error_reporting" value="-1"/>
<ini name="memory_limit" value="-1"/>
<server name="APP_ENV" value="test" force="true"/>
<server name="APP_DEBUG" value="0" force="true"/>
<server name="SHELL_VERBOSITY" value="-1"/>
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
<server name="SYMFONY_PHPUNIT_VERSION" value="10"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
</php>
<testsuites>
<testsuite name="integration">
<directory>tests/Integration</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>./src</directory>
</include>
<exclude>
<directory suffix="Exception.php">./src</directory>
</exclude>
</source>
<php>
<ini name="error_reporting" value="-1"/>
<ini name="memory_limit" value="-1"/>
<server name="APP_ENV" value="test" force="true"/>
<server name="APP_DEBUG" value="0" force="true"/>
<server name="SHELL_VERBOSITY" value="-1"/>
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
<server name="SYMFONY_PHPUNIT_VERSION" value="10"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
</php>
<testsuites>
<testsuite name="integration">
<directory>tests/Integration</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>./src</directory>
</include>
<exclude>
<directory suffix="Exception.php">src</directory>
<directory suffix="php">src/DependencyInjection</directory>
</exclude>
</source>
<coverage>
<report>
<clover outputFile="coverage.xml"/>
</report>
</coverage>
</phpunit>

0 comments on commit 9ac2391

Please sign in to comment.