# https://docs.astral.sh/ty/ name: ty on: push: branches: - master pull_request: branches: - master jobs: ty: runs-on: ubuntu-latest # Informational only: ty is not yet a required gate. This job surfaces # type-check findings in the logs so they can be triaged into gradual # [tool.ty] rules without blocking merges. Flip `continue-on-error` to # false once the baseline is clean. continue-on-error: true steps: - uses: actions/checkout@v7 with: persist-credentials: false - uses: astral-sh/setup-uv@v7 with: enable-cache: true cache-dependency-glob: uv.lock # Mirror the `build` job: `uv sync` installs the dependencies without # building this flat-layout repo as a wheel. pyproject.toml has no # [build-system], so uv treats the project as virtual and installs only # its dependencies -- no "Multiple top-level packages discovered in a # flat-layout" error and no need for a src-layout. (`uv pip install .` # would force that wheel build and fail.) Pin a regular GIL 3.15 so typed # third-party dependencies resolve; the free-threaded 3.15t interpreter the # test matrix uses lacks wheels for several of them. ty itself is pulled in # ephemerally with `--with` so it needn't be added to the lockfile. - run: uv sync --python 3.15 # Pin the *run* to the same regular-GIL 3.15 too. Without `--python 3.15` # here, `uv run` re-resolved the project's default interpreter -- the # free-threaded 3.15t used by the test matrix -- so ty type-checked against # an env where many third-party stubs don't resolve, drowning real findings # in `unresolved-import` / `unresolved-attribute` noise. Pinning 3.15 lets # ty see the synced dependencies, so the `[tool.ty.rules]` severities in # pyproject.toml apply to a meaningful baseline. # # `--exit-zero` is ty's native advisory switch (the analog of ruff's # `ruff check --exit-zero`): the step always exits 0, yet with # `--output-format=github` ty still emits ::error annotations that render # inline on the diff, so findings stay visible without a red X. Promotion # path: `--exit-zero` (informational, always green) -> `--exit-zero-on-warning` # (fail only on error-severity, tolerate warnings) -> drop the flag entirely # to make ty a required gate once the [tool.ty] baseline is clean. # `continue-on-error: true` above stays as a belt-and-suspenders guard so a # ty *crash* (not a diagnostic) can never block a merge either. - run: uv run --python 3.15 --with ty ty check --output-format=github --exit-zero