Skip to content

Merge pull request #2 from netlogix/feature/switch-namespace #40

Merge pull request #2 from netlogix/feature/switch-namespace

Merge pull request #2 from netlogix/feature/switch-namespace #40

Workflow file for this run

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
env:
XDEBUG_MODE: coverage
run: vendor/bin/phpunit \
--configuration phpunit.xml.dist \
--coverage-php "coverage/test.${{ matrix.env.php }}.${{ matrix.env.symfony }}.cov"
- 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 --clover coverage/clover.xml ./coverage
- name: 'Generate code coverage summary report'
uses: saschanowak/[email protected]
with:
filename: coverage/clover.xml
- name: 'Add code coverage summary as action run comment'
run: |
cat code-coverage-summary.md >> $GITHUB_STEP_SUMMARY
cat code-coverage-details.md >> $GITHUB_STEP_SUMMARY
- name: 'Add code coverage summary as pr comment'
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-summary.md