# 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](https://juampi92.gitbook.io/phecks/user-guide/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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://juampi92.gitbook.io/phecks/user-guide/continuous-integration-ci.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
