init #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
test: | |
name: "PHP ${{ matrix.env.php }} - Symfony ${{ matrix.env.symfony }}" | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.env.experimental == true }} | |
strategy: | |
fail-fast: false | |
matrix: | |
env: | |
- { php: 7.4, symfony: 5.4 } | |
- { php: 8.0, symfony: 5.4 } | |
- { php: 8.1, symfony: 5.4 } | |
- { php: 8.2, symfony: 5.4 } | |
- { php: 8.1, symfony: 6.4 } | |
- { php: 8.2, symfony: 6.4 } | |
- { php: 8.3, symfony: 6.4 } | |
- { php: 8.4, symfony: 6.4, experimental: true } | |
- { php: 8.2, symfony: 7.1, experimental: true } | |
- { php: 8.3, symfony: 7.1, experimental: true } | |
- { php: 8.4, symfony: 7.1, experimental: true } | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Composer cache | |
uses: actions/cache@v3 | |
with: | |
path: "vendor" | |
key: ${{ runner.os }}-${{ matrix.env.php }}-composer-${{ hashFiles('composer.json') }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.env.php }} | |
coverage: pcov | |
- name: Configure Symfony | |
run: composer config extra.symfony.require "${{ matrix.env.symfony }}" | |
- name: Install composer | |
run: composer update --no-progress --ansi --prefer-stable | |
- name: Validate composer.json and composer.lock | |
run: composer validate --no-interaction --ansi | |
- name: PHPUnit tests | |
uses: php-actions/phpunit@v3 | |
with: | |
version: "9.5" | |
coverage_php: "coverage/test.${{ matrix.env.php }}.${{ matrix.env.symfony }}.cov" | |
php_version: "${{ matrix.env.php }}" | |
configuration: "phpunit.xml.dist" | |
- name: upload coverage file | |
if: "${{github.event_name}} == 'pull_request'" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: "coverage/test.${{ matrix.env.php }}.${{ matrix.env.symfony }}.cov" | |
- name: upload composer.lock on fail | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "composer.php-${{ matrix.env.php }}.symfony-${{ matrix.env.symfony }}" | |
path: | | |
composer.json | |
composer.lock | |
coverage_report: | |
needs: test | |
runs-on: ubuntu-latest | |
if: "${{ github.event_name }} == 'pull_request'" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
path: coverage | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
coverage: pcov | |
- name: Install phpcov | |
run: composer req --no-progress -n phpunit/phpcov | |
- name: 'merge coverage files' | |
run: vendor/bin/phpcov merge --cobertura cobertura.xml ./coverage | |
- name: "Code Coverage Report" | |
uses: irongut/[email protected] | |
with: | |
filename: cobertura.xml | |
badge: true | |
fail_below_min: true | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: true | |
indicators: true | |
output: both | |
thresholds: '60 80' | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
recreate: true | |
path: code-coverage-results.md |