Skip to content
Merged
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
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI

permissions:
contents: read

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: pre-commit/action@v3.0.1

bandit:
name: Bandit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
# Pinned to .pre-commit-config.yaml so local and CI agree.
# -lll/-iii = high severity, high confidence. This is a library other
# projects install, so findings fail the build rather than being noted.
- name: Run Bandit
run: |
pip install bandit==1.7.8
bandit -r src -lll -iii

test:
name: Test (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# requires-python is ">=3.9"; the oldest and newest supported versions
# are the ones that actually catch a broken promise.
python-version: ["3.9", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Sync dependencies
run: uv sync --all-extras --dev --python ${{ matrix.python-version }}
- name: Run tests
run: uv run --python ${{ matrix.python-version }} pytest tests/

build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
# The package directory name only has to match the build config on a
# case-sensitive filesystem, so this check has to run on Linux.
- name: Build the wheel
run: uv build
- name: Import it from a clean environment
run: uv run --no-project --with dist/*.whl python -c "import loggerhelper; print(loggerhelper.__version__)"
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
dist/
__pycache__
__pycache__/
.venv/
.pytest_cache/
.ruff_cache/
*.egg-info/
log/
.env
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
# Developed on Windows, built on Linux; keep the line endings from
# showing up as a whole-file diff.
- id: mixed-line-ending
args: [--fix=lf]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

# Version pinned to match the CI job, so local and CI agree on findings.
- repo: https://github.com/PyCQA/bandit
rev: 1.7.8
hooks:
- id: bandit
args: ["-lll"]
exclude: ^tests/
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
Loading
Loading