From e6cda8f9a6aee31c8558547024509131d7955a64 Mon Sep 17 00:00:00 2001 From: CoderDeltaLAN Date: Tue, 9 Sep 2025 20:39:28 +0100 Subject: [PATCH 1/6] ci: add Windows as optional (continue-on-error) and keep Linux required --- .github/workflows/ci.yml | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef6a2ab..2597e06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: branches: [main] pull_request: types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled] + workflow_dispatch: permissions: contents: read @@ -13,13 +14,17 @@ concurrency: cancel-in-progress: true jobs: - python: - if: ${{ (github.event_name == 'push' && startsWith(github.ref,'refs/heads/main')) || (github.event_name == 'pull_request' && github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name,'ready')) }} + linux: + name: linux (py=${{ matrix.python-version }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python-version: ['3.11','3.12'] + python-version: + - "3.11" + - "3.12" + env: + PYTHONPATH: src steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -31,3 +36,21 @@ jobs: - run: black --check . - run: pytest -q - run: mypy . + + windows_optional: + name: windows (optional) + runs-on: windows-latest + continue-on-error: true + env: + PYTHONPATH: src + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - run: python -m pip install -U pip + - run: pip install ruff black pytest mypy + - run: ruff check . + - run: black --check . + - run: pytest -q + - run: mypy . From 913f8c7c5867177919594e3dc0b03c450c5444c5 Mon Sep 17 00:00:00 2001 From: CoderDeltaLAN Date: Tue, 9 Sep 2025 23:25:49 +0100 Subject: [PATCH 2/6] ci: set PYTHONPATH=src for pytest; keep Windows optional --- .github/workflows/ci.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2597e06..7eec8c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,16 +20,22 @@ jobs: strategy: fail-fast: false matrix: +<<<<<<< HEAD python-version: - "3.11" - "3.12" +||||||| parent of 9d52d28 (ci: set PYTHONPATH=src for pytest; keep Windows optional) + python-version: ['3.11','3.12'] + name: linux (py=${{ matrix.python-version }}) +======= + python-version: ["3.11","3.12"] +>>>>>>> 9d52d28 (ci: set PYTHONPATH=src for pytest; keep Windows optional) env: PYTHONPATH: src steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + with: { python-version: ${{ matrix.python-version }} } - run: python -m pip install -U pip - run: pip install ruff black pytest mypy - run: ruff check . @@ -46,8 +52,15 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 +<<<<<<< HEAD with: python-version: "3.12" +||||||| parent of 9d52d28 (ci: set PYTHONPATH=src for pytest; keep Windows optional) + with: + python-version: ${{ matrix.python-version }} +======= + with: { python-version: "3.12" } +>>>>>>> 9d52d28 (ci: set PYTHONPATH=src for pytest; keep Windows optional) - run: python -m pip install -U pip - run: pip install ruff black pytest mypy - run: ruff check . From 1dbfb833b9ac4e7de1126be7173ab240c17d6e09 Mon Sep 17 00:00:00 2001 From: CoderDeltaLAN Date: Tue, 9 Sep 2025 23:46:27 +0100 Subject: [PATCH 3/6] build: define build backend (poetry-core) --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index ae26475..36ef7e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,3 +31,7 @@ python_version = "3.11" warn_unused_ignores = true warn_redundant_casts = true disallow_untyped_defs = true + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" From 3af22dc0ada9ec453654c577b537f6e8dfc331fd Mon Sep 17 00:00:00 2001 From: CoderDeltaLAN Date: Tue, 9 Sep 2025 23:46:50 +0100 Subject: [PATCH 4/6] docs: add CI and CodeQL badges to README --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index b35b132..32bba7c 100644 --- a/README.md +++ b/README.md @@ -1 +1,6 @@ +

+ CI + CodeQL +

+ # commit-guardian From 14331a6470395f0cfd35a7e630fb2735bb3b7000 Mon Sep 17 00:00:00 2001 From: CoderDeltaLAN Date: Tue, 9 Sep 2025 23:52:59 +0100 Subject: [PATCH 5/6] chore: remove unused import and tidy whitespace; keep tests green --- src/commit_guardian/__init__.py | 1 + src/commit_guardian/cli.py | 3 ++- tests/test_sanity.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/commit_guardian/__init__.py b/src/commit_guardian/__init__.py index 61d8083..18a159d 100644 --- a/src/commit_guardian/__init__.py +++ b/src/commit_guardian/__init__.py @@ -1,5 +1,6 @@ __all__ = ["ping", "__version__"] __version__ = "0.1.0" + def ping() -> str: return "pong" diff --git a/src/commit_guardian/cli.py b/src/commit_guardian/cli.py index 1841125..2e95176 100644 --- a/src/commit_guardian/cli.py +++ b/src/commit_guardian/cli.py @@ -1,8 +1,8 @@ from __future__ import annotations -import sys import click from . import __version__, ping + @click.command() @click.option("--version", is_flag=True, help="Show version and exit.") def main(version: bool) -> None: @@ -12,5 +12,6 @@ def main(version: bool) -> None: click.echo(ping()) raise SystemExit(0) + if __name__ == "__main__": main() diff --git a/tests/test_sanity.py b/tests/test_sanity.py index 3d243a5..1963bc1 100644 --- a/tests/test_sanity.py +++ b/tests/test_sanity.py @@ -1,4 +1,5 @@ import commit_guardian as cg + def test_ping() -> None: assert cg.ping() == "pong" From 6d0e929859f886706643452cd59a4e2b7f19ed66 Mon Sep 17 00:00:00 2001 From: CoderDeltaLAN Date: Wed, 10 Sep 2025 00:09:16 +0100 Subject: [PATCH 6/6] ci: enable workflow_dispatch for CI and CodeQL --- .github/workflows/ci.yml | 17 ++--------------- .github/workflows/codeql.yml | 2 +- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7eec8c0..2597e06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,22 +20,16 @@ jobs: strategy: fail-fast: false matrix: -<<<<<<< HEAD python-version: - "3.11" - "3.12" -||||||| parent of 9d52d28 (ci: set PYTHONPATH=src for pytest; keep Windows optional) - python-version: ['3.11','3.12'] - name: linux (py=${{ matrix.python-version }}) -======= - python-version: ["3.11","3.12"] ->>>>>>> 9d52d28 (ci: set PYTHONPATH=src for pytest; keep Windows optional) env: PYTHONPATH: src steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - with: { python-version: ${{ matrix.python-version }} } + with: + python-version: ${{ matrix.python-version }} - run: python -m pip install -U pip - run: pip install ruff black pytest mypy - run: ruff check . @@ -52,15 +46,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 -<<<<<<< HEAD with: python-version: "3.12" -||||||| parent of 9d52d28 (ci: set PYTHONPATH=src for pytest; keep Windows optional) - with: - python-version: ${{ matrix.python-version }} -======= - with: { python-version: "3.12" } ->>>>>>> 9d52d28 (ci: set PYTHONPATH=src for pytest; keep Windows optional) - run: python -m pip install -U pip - run: pip install ruff black pytest mypy - run: ruff check . diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index e9b5f3c..e2a807f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -4,6 +4,7 @@ on: branches: [main] pull_request: types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled] + workflow_dispatch: permissions: contents: read @@ -15,7 +16,6 @@ concurrency: jobs: analyze: - if: ${{ (github.event_name == 'push' && startsWith(github.ref,'refs/heads/main')) || (github.event_name == 'pull_request' && github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name,'ready')) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4