Continuous Integration (CI)

phecks:run will return with an exit code of 0 if there were no errors, and 1 if there were errors.

Github Actions

jobs:
  phecks:
    name: phecks
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.1'
          coverage: none

      - name: Install composer dependencies
        uses: ramsey/composer-install@v1

      - name: Run Phecks
        run: php artisan phecks:run --format=github

Tips

  • To get the max speed of CI, it is advised to run phecks only on a PHP container. Being this said, if your checks require the database, then you'll need a different container with the seeded database.

  • Make Phecks required, and use the baseline when required. Since phecks run against the entire codebase, merging a violation into the main branch will make all other branches fail. That's why nobody should introduce a violation, and why the baseline can help your team achieve a starting point.

Last updated