fastbolt/entity-importer

View on GitHub
.github/workflows/phpunit.yaml

Summary

Maintainability
Test Coverage
name: "PHPUnit tests"


on:
    pull_request:
        paths:
            - "**.php"
            - "phpunit.xml.dist"
            - ".github/workflows/phpunit.yaml"
    push:
        paths:
            - "**.php"
            - "phpunit.xml.dist"
            - ".github/workflows/phpunit.yaml"

jobs:
    unit-tests:
        name: Unit Tests
        runs-on: ubuntu-latest
        strategy:
            matrix:
                php-version:
                    - "7.4"
                    - "8.0"
                    - "8.1"
                    - "8.2"
                include:
                    -   php-versions: '8.1'
                        coverage: xdebug
                        composer-prefer: '--prefer-lowest --prefer-stable'
                        phpunit-flags: '--coverage-clover coverage.xml'
        steps:
            -   uses: actions/checkout@master

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

            -   name: Validate composer.json and composer.lock
                run: composer validate --strict

            -   name: Cache Composer packages
                id: composer-cache
                uses: actions/cache@v2
                with:
                    path: vendor
                    key: ${{ runner.os }}-composer-${{ matrix.composer-prefer }}$-${{ hashFiles('**/composer.lock') }}
                    restore-keys: |
                        ${{ runner.os }}-composer-${{ matrix.composer-prefer }}-

            -   name: Install dependencies
                run: composer update --prefer-dist --no-progress --ignore-platform-req="ext-*" ${{ matrix.composer-prefer }}

            -   name: Run test suite
                run: vendor/bin/phpunit ${{ matrix.phpunit-flags }}

            -   name: Upload PHPunit coverage
                uses: codecov/codecov-action@v3
                with:
                    fail_ci_if_error: true # optional (default = false)
                    verbose: true # optional (default = false)
                    flags: unittests