mirror of
https://github.com/NCBM/plyngent.git
synced 2026-07-23 05:55:16 +08:00
Compare commits
2 Commits
v0.1.3
...
614ffaaf8f
| Author | SHA1 | Date | |
|---|---|---|---|
| 614ffaaf8f | |||
| 7bdd9ff8b7 |
@@ -1,11 +1,20 @@
|
||||
# Single pipeline: CI on main/PRs; on v* tags, publish only after CI succeeds.
|
||||
# Retagging the same commit (delete + push tag) re-triggers this workflow.
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
# Cancel superseded runs on the same ref (e.g. force-push / retag races).
|
||||
concurrency:
|
||||
group: ci-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -18,15 +27,14 @@ jobs:
|
||||
python-version: "3.14"
|
||||
|
||||
- name: Install PDM
|
||||
uses: pdm-project/setup-pdm@v4
|
||||
with:
|
||||
python-version: "3.14"
|
||||
run: pip install pdm
|
||||
|
||||
- name: Install dependencies
|
||||
run: pdm sync --dev
|
||||
# Locked install so CI matches prek pins / pdm.lock.
|
||||
run: pdm install --check -G :all
|
||||
|
||||
- name: Ruff check
|
||||
run: pdm run ruff check --output-format=github .
|
||||
run: pdm run ruff check .
|
||||
|
||||
- name: Ruff format
|
||||
run: pdm run ruff format --check .
|
||||
@@ -34,5 +42,39 @@ jobs:
|
||||
- name: basedpyright
|
||||
run: pdm run basedpyright .
|
||||
|
||||
- name: pytest
|
||||
- name: Pytest
|
||||
run: pdm run pytest
|
||||
|
||||
# Only on version tags, and only after check is green (no publish on red CI).
|
||||
publish:
|
||||
needs: check
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.14"
|
||||
|
||||
- name: Install PDM
|
||||
run: pip install pdm
|
||||
|
||||
- name: Build package
|
||||
run: pdm build
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: dist/*
|
||||
generate_release_notes: true
|
||||
fail_on_unmatched_files: true
|
||||
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
name: Release and Publish Python Package
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.14"
|
||||
|
||||
- name: Install build
|
||||
run: python -m pip install --upgrade pip build
|
||||
|
||||
- name: Build package
|
||||
run: python -m build --sdist --wheel --outdir dist/ .
|
||||
|
||||
- name: Publish package
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
|
||||
- name: Create GitHub release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: |
|
||||
dist/*
|
||||
generate_release_notes: true
|
||||
@@ -5,7 +5,7 @@
|
||||
groups = ["default", "dev"]
|
||||
strategy = ["inherit_metadata"]
|
||||
lock_version = "4.5.0"
|
||||
content_hash = "sha256:b849e1647ce0ec47b61889ae0e66863acce020cd1f2e3deaeb9e2e92becf9da5"
|
||||
content_hash = "sha256:94dc16bf6ed12e2fcd7a109b500e9b2d7e39f224b60472d64ecb1d3436ddbb82"
|
||||
|
||||
[[metadata.targets]]
|
||||
requires_python = "~=3.14"
|
||||
@@ -527,13 +527,13 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "tomlkit"
|
||||
version = "0.15.0"
|
||||
version = "0.15.1"
|
||||
requires_python = ">=3.9"
|
||||
summary = "Style preserving TOML library"
|
||||
groups = ["default"]
|
||||
files = [
|
||||
{file = "tomlkit-0.15.0-py3-none-any.whl", hash = "sha256:4dbc8f0fc024412b57ced8757ac7461305126a648ff8c2c807fcb8e133a78738"},
|
||||
{file = "tomlkit-0.15.0.tar.gz", hash = "sha256:7d1a9ecba3086638211b13814ea79c90dd54dd11993564376f3aa92271f5c7a3"},
|
||||
{file = "tomlkit-0.15.1-py3-none-any.whl", hash = "sha256:177a05aece5a8ca5266fd3c448abb47b8d352f09d477d3ca8332db4d89b24304"},
|
||||
{file = "tomlkit-0.15.1.tar.gz", hash = "sha256:e25bbf38843005246210a12982776f27f99cb9be67160e14434d0c0d21ee1e97"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -549,7 +549,7 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "urllib3-future"
|
||||
version = "2.22.901"
|
||||
version = "2.23.900"
|
||||
requires_python = ">=3.7"
|
||||
summary = "urllib3.future is a powerful HTTP 1.1, 2, and 3 client with both sync and async interfaces"
|
||||
groups = ["default"]
|
||||
@@ -559,8 +559,8 @@ dependencies = [
|
||||
"qh3<2.0.0,>=1.5.4; (platform_system == \"Darwin\" or platform_system == \"Windows\" or platform_system == \"Linux\") and platform_python_implementation == \"PyPy\" and (platform_machine == \"x86_64\" or platform_machine == \"s390x\" or platform_machine == \"armv7l\" or platform_machine == \"ppc64le\" or platform_machine == \"ppc64\" or platform_machine == \"AMD64\" or platform_machine == \"aarch64\" or platform_machine == \"arm64\" or platform_machine == \"ARM64\" or platform_machine == \"x86\" or platform_machine == \"i686\" or platform_machine == \"riscv64\" or platform_machine == \"riscv64gc\") and python_version < \"3.12\" or (platform_system == \"Darwin\" or platform_system == \"Windows\" or platform_system == \"Linux\") and python_full_version > \"3.7.10\" and (platform_machine == \"x86_64\" or platform_machine == \"s390x\" or platform_machine == \"armv7l\" or platform_machine == \"ppc64le\" or platform_machine == \"ppc64\" or platform_machine == \"AMD64\" or platform_machine == \"aarch64\" or platform_machine == \"arm64\" or platform_machine == \"ARM64\" or platform_machine == \"x86\" or platform_machine == \"i686\" or platform_machine == \"riscv64\" or platform_machine == \"riscv64gc\") and platform_python_implementation == \"CPython\"",
|
||||
]
|
||||
files = [
|
||||
{file = "urllib3_future-2.22.901-py3-none-any.whl", hash = "sha256:dc2d4572ba612be69e3f6db87d1f469b7d08f107e80fd8749081d7e6a5a2fe10"},
|
||||
{file = "urllib3_future-2.22.901.tar.gz", hash = "sha256:fbece0ff51299a213c926897ffbed61d820ab5ef2ba81cece361c049fe2f51a9"},
|
||||
{file = "urllib3_future-2.23.900-py3-none-any.whl", hash = "sha256:4303dc9a5d8c4c810f3fcd3b13bd62d69c3a4f63bb7e62089410907c34aeaf6b"},
|
||||
{file = "urllib3_future-2.23.900.tar.gz", hash = "sha256:f488f22983f96cd8c733640b47e6a32def462d33c59bcc4bea6d97a8568b70c8"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -2,26 +2,47 @@
|
||||
# Install: uv tool install prek (or: pipx install prek)
|
||||
# Wire git: prek install
|
||||
# Manual: prek run --all-files
|
||||
#
|
||||
# Pin additional_dependencies to the same versions as pdm.lock (dev group).
|
||||
# Bump these when you pdm update ruff / basedpyright.
|
||||
|
||||
default_install_hook_types = ["pre-commit"]
|
||||
default_stages = ["pre-commit"]
|
||||
default_language_version = { python = "python3.14" }
|
||||
|
||||
# Ruff: lint (with autofix) then format — order matters (fix before format).
|
||||
# https://docs.astral.sh/ruff/integrations/#pre-commit
|
||||
[[repos]]
|
||||
repo = "https://github.com/astral-sh/ruff-pre-commit"
|
||||
rev = "v0.15.22"
|
||||
hooks = [
|
||||
{ id = "ruff-check", args = ["--fix"], types_or = ["python", "pyi"] },
|
||||
{ id = "ruff-format", types_or = ["python", "pyi"] },
|
||||
]
|
||||
|
||||
# basedpyright: full-project typecheck (same as CI `pdm run basedpyright .`).
|
||||
# Mirror hook: https://docs.basedpyright.com/latest/installation/prek-hook/
|
||||
# Uses system+PDM so imports resolve from the project venv (isolated hook envs lack deps).
|
||||
[[repos]]
|
||||
repo = "local"
|
||||
hooks = [
|
||||
{ id = "basedpyright", name = "basedpyright", language = "system", entry = "pdm run basedpyright .", pass_filenames = false, files = "\\.pyi?$" },
|
||||
# Match CI / local pdm env (see pdm.lock).
|
||||
repos = [
|
||||
{
|
||||
repo = "local",
|
||||
hooks = [
|
||||
{
|
||||
id = "ruff-check",
|
||||
name = "ruff check",
|
||||
entry = "ruff check",
|
||||
language = "python",
|
||||
types_or = ["python", "pyi"],
|
||||
args = [],
|
||||
require_serial = true,
|
||||
additional_dependencies = ["ruff==0.15.22"],
|
||||
},
|
||||
{
|
||||
id = "ruff-format",
|
||||
name = "ruff format",
|
||||
entry = "ruff format --check --force-exclude",
|
||||
language = "python",
|
||||
types_or = ["python", "pyi"],
|
||||
require_serial = true,
|
||||
additional_dependencies = ["ruff==0.15.22"],
|
||||
},
|
||||
{
|
||||
id = "basedpyright",
|
||||
name = "basedpyright",
|
||||
entry = "basedpyright",
|
||||
language = "python",
|
||||
pass_filenames = false,
|
||||
require_serial = true,
|
||||
additional_dependencies = ["basedpyright==1.39.9"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
+2
-2
@@ -27,8 +27,8 @@ plyngent = "plyngent.cli:main"
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"basedpyright>=1.39.7",
|
||||
"ruff>=0.15.17",
|
||||
"basedpyright==1.39.9",
|
||||
"ruff==0.15.22",
|
||||
"pytest>=9.1.1",
|
||||
"pytest-asyncio>=1.4.0",
|
||||
]
|
||||
|
||||
@@ -114,6 +114,7 @@ async def test_confirm_deny_with_comment() -> None:
|
||||
assert "user comment:" in out
|
||||
assert "too destructive" in out
|
||||
|
||||
|
||||
def test_shell_confirm_formats_command_placeholder() -> None:
|
||||
script = chr(10).join(["line1", "line2", "line3"])
|
||||
reason = classify_danger(
|
||||
@@ -130,4 +131,3 @@ def test_shell_confirm_formats_command_placeholder() -> None:
|
||||
body = lines[idx + 1 :]
|
||||
assert body
|
||||
assert all(ln.startswith(" ") for ln in body)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user