# How to use ty in CI


[ty](https://pydevtools.com/handbook/reference/ty.md) can run in CI with no installation step beyond [uv](https://pydevtools.com/handbook/reference/uv.md). Because ty is a single binary with no runtime dependencies, it adds minimal overhead to your pipeline.

## GitHub Actions

The simplest approach uses `uvx` to run ty without adding it as a project dependency:

```yaml
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- run: uvx ty check src/
```

To get inline annotations on pull requests, use the `github` output format:

```yaml
- run: uvx ty check src/ --output-format github
```

This produces GitHub-native annotations that appear directly on changed lines in the pull request diff.

## GitLab CI

GitLab has a corresponding annotation format:

```yaml
type-check:
  script:
    - uvx ty check src/ --output-format gitlab
```

## Output formats

ty supports four output formats, selected with `--output-format`:

| Format | Use case |
|---|---|
| `full` (default) | Local development. Multi-line diagnostics with code context. |
| `concise` | Log parsing and scripting. One line per error. |
| `github` | GitHub Actions annotations. |
| `gitlab` | GitLab CI annotations. |

```bash
ty check --output-format concise
```

## Pinning a ty version

To ensure consistent results across runs, pin the ty version:

```yaml
- run: uvx ty@0.0.31 check src/
```

## Running alongside Ruff

If you already use [Ruff](https://pydevtools.com/handbook/reference/ruff.md) in CI, add ty as a separate step:

```yaml
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- run: uvx ruff check .
- run: uvx ruff format --check .
- run: uvx ty check src/
```

## Learn more

- [How to try the ty type checker](https://pydevtools.com/handbook/how-to/how-to-try-the-ty-type-checker.md)
- [How to migrate from mypy to ty](https://pydevtools.com/handbook/how-to/how-to-migrate-from-mypy-to-ty.md)
- [How do mypy, pyright, and ty compare?](https://pydevtools.com/handbook/explanation/how-do-mypy-pyright-and-ty-compare.md)
