Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
workflow_dispatch:

permissions:
contents: read
Expand All @@ -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
Expand All @@ -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 .
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
workflow_dispatch:

permissions:
contents: read
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
<p align="left">
<img src="https://github.com/CoderDeltaLAN/commit-guardian/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI">
<img src="https://github.com/CoderDeltaLAN/commit-guardian/actions/workflows/codeql.yml/badge.svg?branch=main" alt="CodeQL">
</p>

# commit-guardian
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 1 addition & 0 deletions src/commit_guardian/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
__all__ = ["ping", "__version__"]
__version__ = "0.1.0"


def ping() -> str:
return "pong"
3 changes: 2 additions & 1 deletion src/commit_guardian/cli.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -12,5 +12,6 @@ def main(version: bool) -> None:
click.echo(ping())
raise SystemExit(0)


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions tests/test_sanity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import commit_guardian as cg


def test_ping() -> None:
assert cg.ping() == "pong"
Loading