Skip to content
Closed
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
70 changes: 60 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,78 @@ name: Publish to PyPI
on:
release:
types: [published]
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
name: Publish to PyPI
build:
name: Build distribution
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.x"

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build

- name: Build package
run: uv build
run: python -m build

- name: Store distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/toon-format
permissions:
id-token: write

steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

publish-to-testpypi:
name: Publish to TestPyPI
if: github.event_name == 'workflow_dispatch'
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/toon-format
permissions:
id-token: write

steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
57 changes: 36 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,62 @@ name: Tests

on:
push:
branches: [main]
branches: [main, develop]
pull_request:
branches: [main]
branches: [main, develop]

jobs:
test:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-cov

- name: Run tests
run: uv run pytest tests/ -v

- name: Run tests with coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
run: |
uv run pytest tests/ --cov=src/toon_format --cov-report=xml --cov-report=term-missing
run: pytest --cov=toon_format --cov-report=xml --cov-report=term

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
- name: Upload coverage
uses: codecov/codecov-action@v4
if: matrix.python-version == '3.12'
with:
file: ./coverage.xml
fail_ci_if_error: false

lint:
name: Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff mypy

- name: Run ruff
run: ruff check src/toon_format tests

- name: Run mypy
run: mypy src/toon_format
continue-on-error: true # Mypy is informational only
69 changes: 56 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
Expand All @@ -23,7 +27,36 @@ share/python-wheels/
*.egg
MANIFEST

# Virtual environments
# Package-specific
toon_format.egg-info/

# Ruff cache
.ruff_cache/

# Mypy cache
.mypy_cache/
.dmypy.json
dmypy.json

# PyInstaller
*.manifest
*.spec

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Environments
.env
.venv
env/
Expand All @@ -38,20 +71,30 @@ venv.bak/
*.swp
*.swo
*~
.claude/
CLAUDE.md

# macOS
.DS_Store
.AppleDouble
.LSOverride
._*

# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/
.nox/
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Type checking
.mypy_cache/
.pytype/
.pyre/
.pyright/
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# uv
.uv/
Expand Down
Loading
Loading