Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #10

Merged
merged 2 commits into from
Nov 7, 2024
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
10 changes: 10 additions & 0 deletions .bumper.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[tool.bumper]
current_version = "1.0.0"

[[tool.bumper.files]]
file = "./pyproject.toml"
search = 'version = "{current_version}"'

[[tool.bumper.files]]
file = "./README.md"
search = "matplotlib-window/{current_version}"
12 changes: 0 additions & 12 deletions .bumpversion.cfg

This file was deleted.

73 changes: 51 additions & 22 deletions .github/workflows/lint_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,83 @@ jobs:
lint:
runs-on: ubuntu-latest

env:
UV_CACHE_DIR: /tmp/.uv-cache

steps:
- uses: actions/checkout@v4
- name: Install Poetry for caching
run: pipx install poetry

- name: Set up uv
run: curl -LsSf https://astral.sh/uv/0.4.30/install.sh | sh

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'poetry'
python-version-file: "pyproject.toml"

- name: Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}

- name: Install dependencies
run: |
python -m pip install -U pip setuptools importlib-metadata
python -m pip install poetry
poetry install
run: uv sync --all-extras --dev

- name: Run mypy
run: poetry run mypy .
run: uv run mypy .
if: always()

- name: Minimize uv cache
run: uv cache prune --ci

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13-dev"]
python-version: ["3.11", "3.12", "3.13"]
fail-fast: false

env:
UV_CACHE_DIR: /tmp/.uv-cache

steps:
- uses: actions/checkout@v4
- name: Install Poetry for caching
run: pipx install poetry

- name: Set up uv
run: curl -LsSf https://astral.sh/uv/0.4.30/install.sh | sh

- name: Set up (release) Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
if: "!endsWith(matrix.python-version, '-dev')"
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Set up (deadsnakes) Python ${{ matrix.python-version }}
uses: deadsnakes/[email protected]
if: endsWith(matrix.python-version, '-dev')
with:
python-version: ${{ matrix.python-version }}

- name: Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}

- name: Install dependencies
run: |
python -m pip install -U pip setuptools importlib-metadata
pip install tox-gh-actions
uv venv
uv pip install tox-gh-actions tox-uv

- name: Run tests w/tox
run: tox
run: uv run tox

- name: Cache coverage for ${{ matrix.python-version }}
uses: actions/upload-artifact@v4
Expand All @@ -73,16 +98,20 @@ jobs:
if-no-files-found: error
include-hidden-files: true

- name: Minimize uv cache
run: uv cache prune --ci

combine-cov:
runs-on: ubuntu-latest
needs: test

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version-file: "pyproject.toml"

- name: Pull coverage workflow artifacts
uses: actions/download-artifact@v4
Expand All @@ -91,17 +120,17 @@ jobs:

- name: Install cov & combine
run: |
pip install coverage
python -m pip install coverage
coverage combine ./cov_cache/**/.coverage

- name: Report coverage
run: |
echo '**Combined Coverage**' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
coverage report -m --skip-covered >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
coverage html

# Report a markdown version to the action summary
echo '**Combined Coverage**' >> $GITHUB_STEP_SUMMARY
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY

- name: Publish cov HTML
uses: actions/upload-artifact@v4
with:
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,31 @@ jobs:
build:
name: Build dist & publish
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/matplotlib-window
permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v4

- name: Set up uv
run: curl -LsSf https://astral.sh/uv/0.4.30/install.sh | sh

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version-file: "pyproject.toml"

- name: Install build dependencies & build
run: |
python -m pip install --upgrade pip
pip install poetry
poetry build
- name: Build package
run: uvx --from build pyproject-build --installer uv

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.9
uses: pypa/gh-action-pypi-publish@release/v1.10
with:
user: __token__
password: ${{ secrets.pypi_api_token }}
print-hash: true

- name: Upload wheel to release
env:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:

repos:
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
Expand Down Expand Up @@ -35,6 +35,6 @@ repos:
- id: python-check-blanket-type-ignore
- id: python-use-type-annotations
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.7.2
hooks:
- id: ruff
Loading