From 5fd9c4f75044726ac4160bb47bd03e5c4a7430e5 Mon Sep 17 00:00:00 2001 From: Mike Bonnet Date: Tue, 28 Oct 2025 16:57:27 -0700 Subject: [PATCH] ci: run type checking Add a "make type-check" Makefile target, and run it as part of the CI workflow. Add a couple extra depedencies to enable type checking for yaml and jsonschema. Signed-off-by: Mike Bonnet --- .github/workflows/ci.yml | 4 ++++ Makefile | 8 ++++++-- pyproject.toml | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93e9f83b..791a0040 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,10 @@ jobs: run: | uv run -- make man-check + - name: Run type checking + run: | + uv run -- make type-check + build-image: runs-on: ubuntu-24.04 timeout-minutes: 60 diff --git a/Makefile b/Makefile index 8cfba80a..ab5a4935 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ PATH := $(PATH):$(HOME)/.local/bin MYPIP ?= pip IMAGE ?= ramalama PROJECT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) -EXCLUDE_DIRS := .venv venv .tox +EXCLUDE_DIRS := .venv venv .tox build EXCLUDE_OPTS := $(addprefix --exclude-dir=,$(EXCLUDE_DIRS)) PYTHON_SCRIPTS := $(shell grep -lEr "^\#\!\s*/usr/bin/(env +)?python(3)?(\s|$$)" $(EXCLUDE_OPTS) $(PROJECT_DIR) || true) BATS_IMAGE ?= localhost/bats:latest @@ -146,8 +146,12 @@ ifeq ($(OS),Linux) hack/xref-helpmsgs-manpages endif +.PHONY: type-check +type-check: + mypy $(addprefix --exclude=,$(EXCLUDE_DIRS)) --exclude test $(PROJECT_DIR) + .PHONY: validate -validate: codespell lint check-format man-check +validate: codespell lint check-format man-check type-check .PHONY: pypi-build pypi-build: clean diff --git a/pyproject.toml b/pyproject.toml index eb8da6d3..7c4639c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,6 +65,8 @@ dev = [ "pytest~=8.3", "wheel~=0.45.0", "mypy", + "types-PyYAML", + "types-jsonschema", "tox" ]