diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 55ea8455..75c6b53f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,3 +20,18 @@ jobs: cache: 'pip' - run: make dev - run: make test + + format: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.12"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + cache: 'pip' + - run: make dev + - run: make fmt-check diff --git a/Makefile b/Makefile index c98443dd..16bfebd6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: install test typecheck unittest dev fmt generate clean update-proto coverage +.PHONY: install test typecheck unittest dev fmt fmt-check generate clean update-proto coverage PYTHON := python @@ -14,6 +14,11 @@ fmt: $(PYTHON) -m isort . $(PYTHON) -m black . +fmt-check: + @$(PYTHON) -m isort . --check --diff; isort_status=$$?; \ + $(PYTHON) -m black . --check --diff; black_status=$$?; \ + exit $$((isort_status + black_status)) + typecheck: $(PYTHON) -m mypy src tests