Continuous Integration #76
This file contains hidden or 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: Continuous Integration | |
| on: | |
| push: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: 0 0 * * 0 | |
| jobs: | |
| phpunit: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| php: ['8.2', '8.3', '8.4', '8.5'] | |
| steps: | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: xdebug | |
| tools: composer:v2 | |
| - name: Checkout Repository | |
| uses: actions/checkout@v2 | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: | | |
| echo "::set-output name=dir::$(composer config cache-files-dir)" | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-php${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php${{ matrix.php }}-composer- | |
| - name: Install Dependencies | |
| run: composer install | |
| - name: Test | |
| run: vendor/bin/phpunit tests --testdox --coverage-clover coverage.xml | |
| - name: Upload Coverage Artifact | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ matrix.php == '8.4' && matrix.os == 'ubuntu-latest' }} | |
| with: | |
| name: codecov | |
| path: coverage.xml | |
| codecov: | |
| name: Code Coverage Report | |
| runs-on: ubuntu-latest | |
| needs: phpunit | |
| steps: | |
| - name: Download Coverage Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: codecov | |
| - name: Upload to CodeCov | |
| uses: codecov/codecov-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: coverage.xml | |
| fail_ci_if_error: true | |
| phpstan: | |
| name: Static Analysis Check | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php: ['8.2', '8.3', '8.4', '8.5'] | |
| steps: | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| tools: composer:v2 | |
| - name: Checkout Repository | |
| uses: actions/checkout@v2 | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: | | |
| echo "::set-output name=dir::$(composer config cache-files-dir)" | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-php${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php${{ matrix.php }}-composer- | |
| - name: Install Dependencies | |
| run: composer install | |
| - name: Run PHPStan | |
| run: vendor/bin/phpstan | |
| phpcs: | |
| name: Code Style (PSR-12) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.5 | |
| tools: composer:v2 | |
| - name: Checkout Repository | |
| uses: actions/checkout@v2 | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: | | |
| echo "::set-output name=dir::$(composer config cache-files-dir)" | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-php${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php${{ matrix.php }}-composer- | |
| - name: Install Dependencies | |
| run: composer install | |
| - name: PHP Code Sniffer | |
| run: vendor/bin/phpcs | |
| infection: | |
| name: Infection Check | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| strategy: | |
| matrix: | |
| php: ['8.5'] | |
| steps: | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: xdebug | |
| tools: composer:v2 | |
| ini-values: error_reporting=-1 | |
| - name: Checkout Repository | |
| uses: actions/checkout@v2 | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: | | |
| echo "::set-output name=dir::$(composer config cache-files-dir)" | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-php${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php${{ matrix.php }}-composer- | |
| - name: Install Dependencies | |
| run: composer install | |
| - name: Check for Mutants | |
| env: | |
| INFECTION_BADGE_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} | |
| run: vendor/bin/infection --threads=$(nproc) --min-msi=100 --no-progress --logger-github |