> For the complete documentation index, see [llms.txt](https://juampi92.gitbook.io/phecks/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://juampi92.gitbook.io/phecks/user-guide/continuous-integration-ci.md).

# 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

```yaml
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](/phecks/user-guide/the-baseline.md) 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.
