diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..49f4ca5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI +on: + pull_request: + types: [opened, edited, synchronize, labeled, unlabeled, ready_for_review, reopened] +jobs: + ci: + name: CI + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + version: "0.8.2" + - name: Static code check + run: uv run poe ci_checker + - name: Check docs build + working-directory: ./docs + run: | + uv sync --group docs + make html + - name: Check PR title style + uses: actions/github-script@v7 + with: + script: | + const title = context.payload.pull_request.title; + const labels = context.payload.pull_request.labels.map(l => l.name); + if (labels.includes('dev')) { + console.log('Skipping PR title check due to dev label.'); + return; + } + const regex = /^(feat|fix|refactor|doc|perf|style|test|chore|revert)!?:[ ][a-z].*$/; + if (!regex.test(title)) { + core.setFailed( + `PR title "${title}" does not match the expected conventional commit format` + ); + } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e038faf..8f39790 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,9 +27,9 @@ jobs: echo "::error ::Tag doesn't match project version" exit 1 - name: Install uv - uses: astral-sh/setup-uv@v5 + uses: astral-sh/setup-uv@v6 with: - version: "0.5.20" + version: "0.8.2" - name: Build package run: uv build - name: Publish package to PyPI diff --git a/docs/Makefile b/docs/Makefile index d0c3cbf..faf5089 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line, and also # from the environment for the first two. SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build +SPHINXBUILD ?= uv run sphinx-build SOURCEDIR = source BUILDDIR = build diff --git a/pyproject.toml b/pyproject.toml index 1c3d32c..755f69a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,8 @@ dependencies = [ "anyio>=4.8.0", ] -[project.optional-dependencies] +[dependency-groups] +dev = ["mypy>=1.14.1", "poethepoet>=0.36.0", "ruff>=0.9.1"] docs = [ "enum-tools[sphinx]>=0.12.0", "furo>=2024.8.6", @@ -21,9 +22,6 @@ docs = [ "sphinx-autodoc-typehints>=3.0.0", ] -[dependency-groups] -dev = ["mypy>=1.14.1", "poethepoet>=0.36.0", "ruff>=0.9.1"] - [build-system] requires = ["hatchling"] build-backend = "hatchling.build" @@ -49,4 +47,7 @@ extend-select = ["I"] linter = "uv run ruff check --fix" formatter = "uv run ruff format" type_checker = "uv run mypy" +ci_linter = "uv run ruff check" +ci_formatter = "uv run ruff format --check" checker = ["linter", "formatter", "type_checker"] +ci_checker = ["ci_linter", "ci_formatter", "type_checker"] diff --git a/uv.lock b/uv.lock index 6ce71d0..21f1d32 100644 --- a/uv.lock +++ b/uv.lock @@ -1021,7 +1021,12 @@ dependencies = [ { name = "types-protobuf" }, ] -[package.optional-dependencies] +[package.dev-dependencies] +dev = [ + { name = "mypy" }, + { name = "poethepoet" }, + { name = "ruff" }, +] docs = [ { name = "enum-tools", extra = ["sphinx"] }, { name = "furo" }, @@ -1030,27 +1035,14 @@ docs = [ { name = "sphinx-autodoc-typehints" }, ] -[package.dev-dependencies] -dev = [ - { name = "mypy" }, - { name = "poethepoet" }, - { name = "ruff" }, -] - [package.metadata] requires-dist = [ { name = "anyio", specifier = ">=4.8.0" }, - { name = "enum-tools", extras = ["sphinx"], marker = "extra == 'docs'", specifier = ">=0.12.0" }, - { name = "furo", marker = "extra == 'docs'", specifier = ">=2024.8.6" }, { name = "grpc-stubs", specifier = ">=1.53.0.5" }, { name = "grpcio", specifier = ">=1.69.0" }, { name = "grpcio-tools", specifier = ">=1.69.0" }, - { name = "myst-parser", marker = "extra == 'docs'", specifier = ">=4.0.0" }, - { name = "sphinx", marker = "extra == 'docs'", specifier = "==8.1.3" }, - { name = "sphinx-autodoc-typehints", marker = "extra == 'docs'", specifier = ">=3.0.0" }, { name = "types-protobuf", specifier = ">=5.29.1.20241207" }, ] -provides-extras = ["docs"] [package.metadata.requires-dev] dev = [ @@ -1058,6 +1050,13 @@ dev = [ { name = "poethepoet", specifier = ">=0.36.0" }, { name = "ruff", specifier = ">=0.9.1" }, ] +docs = [ + { name = "enum-tools", extras = ["sphinx"], specifier = ">=0.12.0" }, + { name = "furo", specifier = ">=2024.8.6" }, + { name = "myst-parser", specifier = ">=4.0.0" }, + { name = "sphinx", specifier = "==8.1.3" }, + { name = "sphinx-autodoc-typehints", specifier = ">=3.0.0" }, +] [[package]] name = "tabulate"